C# directsound 提示“值不在预期的范围内 ”
var fileName = "D:/ready.mp3";
DevicesCollection sound_devices = new DevicesCollection();
Device sound_device_output = new Device(sound_devices[1].DriverGuid);
sound_device_output.SetCooperativeLevel(new WindowInteropHelper(this).Handle, CooperativeLevel.Normal); //设置设备协作级别
SecondaryBuffer secondary_buffer = new SecondaryBuffer(fileName, sound_device_output); //值不在预期的范围内
secondary_buffer.Play(0, BufferPlayFlags.Looping);//设置缓冲区为循环播放
也不知道啥原因。试了各种办法,查了各种资料,都没解决,有知道的大佬帮忙解答下么,谢谢了~
SecondaryBuffer有个重载参数是用文件流。我把音频流放进去也还是报错,应该不是音频文件路径问题。
sound_device_output音频设备有两个,两个都试了,没用。
macsoft.directx.directsound.dll也替换了好几个版本,没用。
真令人头秃~