我试图弄清楚为什么NAudio会引发以下异常:
System.ArgumentOutOfRangeException was unhandled
Message: An unhandled exception of type 'System.ArgumentOutOfRangeException'
occurred in NAudio.Vorbis.dll
Additional information: Specified argument out of range.
我想要做的就是创造一种火,忘记上课的音频,这就是班级:
public class FFSoundPlayer
{
private readonly WaveOutEvent outputDevice;
private WaveMixerStream32 mixer;
private System.IO.Stream silenceStream;
private FFSoundPlayer()
{
outputDevice = new WaveOutEvent();
mixer = new WaveMixerStream32();
System.Reflection.Assembly a = System.Reflection.Assembly.GetExecutingAssembly();
silenceStream = a.GetManifestResourceStream("ProperPath.silence.ogg");
VorbisWaveReader wv = new VorbisWaveReader(silenceStream);
LoopWaveStream silence = new LoopWaveStream(wv);
mixer.AddInputStream(silence);
mixer.AutoStop = false;
outputDevice.Init(mixer);
outputDevice.Play();
}
public static FFSoundPlayer Instance = new FFSoundPlayer();
public void AddWave(WaveStream wave)
{
mixer.AddInputStream(wave);
}
}
LoopWaveStream只是一个WaveStream,当它到达流的末尾时重置位置。
通过AddWave方法发送一些文件后,我从NAudio获得了异常。有任何想法吗?我是按照正确的方式做的吗?
由于