我有一个ISampleProvider
我想用10秒的沉默来填充,我将如何在NAudio中实现这一目标?
var songDelayed = new AudioFileReader(filePath_1);
//Delay "songDelayed" by 10 secs
//What do I do here?
myDirectSoundObj.Init(songDelayed);
myDirectSoundObj.Play();
答案 0 :(得分:3)
您可以使用OffsetSampleProvider
var songDelayed = new AudioFileReader(filePath_1);
var offset = new OffsetSampleProvider(songDelayed);
offset.DelayBy = TimeSpan.FromSeconds(10);
// or if you don't have latest NAudio source:
// offset.DelayBySamples = songDelayed.WaveFormat.SampleRate *
// songDelayed.WaveFormat.Channels * 10;
myDirectSoundObj.Init(offset);
myDirectSoundObj.Play();