当我使用ResamplerDmoStream
并选择除WaveOutput之外的任何内容(例如WASAPI、DirectSound)时,我遇到以下异常:无法将 COM 对象NAudio.DMO.ResamplerMediaComObject
转换为接口类型Naudio.Dmo.IMediaObject
...
异常调用堆栈:
at System.StubHelpers.StubHelpers.GetCOMIPFromRCW(Object objSrc, IntPtr pCPCMD, IntPtr& ppTarget, Boolean& pfNeedsRelease)
at NAudio.Dmo.IMediaObject.GetInputStatus(Int32 inputStreamIndex, DmoInputStatusFlags& flags)
at NAudio.Dmo.MediaObject.IsAcceptingData(Int32 inputStreamIndex) in NAudio\Dmo\MediaObject.cs:line 468
at NAudio.Wave.ResamplerDmoStream.Read(Byte[] buffer, Int32 offset, Int32 count) in NAudio\Wave\WaveStreams\ResamplerDmoStream.cs:line 136
at NAudio.Wave.Wave16ToFloatProvider.Read(Byte[] destBuffer, Int32 offset, Int32 numBytes) in NAudio\Wave\WaveProviders\Wave16toFloatProvider.cs:line 47
at NAudio.Wave.MixingWaveProvider32.Read(Byte[] buffer, Int32 offset, Int32 count) in NAudio\Wave\WaveProviders\MixingWaveProvider32.cs:line 116
at NAudio.Wave.SampleProviders.WaveToSampleProvider.Read(Single[] buffer, Int32 offset, Int32 count) in NAudio\Wave\SampleProviders\WaveToSampleProvider.cs:line 33
at NAudio.Wave.SampleProviders.MeteringSampleProvider.Read(Single[] buffer, Int32 offset, Int32 count) in NAudio\Wave\SampleProviders\MeteringSampleProvider.cs:line 72
at NAudio.Wave.SampleProviders.VolumeSampleProvider.Read(Single[] buffer, Int32 offset, Int32 sampleCount) in NAudio\Wave\SampleProviders\VolumeSampleProvider.cs:line 42
at NAudio.Wave.SampleProviders.SampleChannel.Read(Single[] buffer, Int32 offset, Int32 sampleCount) in NAudio\Wave\SampleProviders\SampleChannel.cs:line 58
at NAudio.Wave.SampleProviders.MeteringSampleProvider.Read(Single[] buffer, Int32 offset, Int32 count) in NAudio\Wave\SampleProviders\MeteringSampleProvider.cs:line 72
at NAudio.Wave.SampleProviders.MultiplexingSampleProvider.Read(Single[] buffer, Int32 offset, Int32 count) in NAudio\Wave\SampleProviders\MultiplexingSampleProvider.cs:line 93
at NAudio.Wave.SampleProviders.SampleToWaveProvider.Read(Byte[] buffer, Int32 offset, Int32 count) in NAudio\Wave\SampleProviders\SampleToWaveProvider.cs:line 35
at NAudio.Wave.DirectSoundOut.Feed(Int32 bytesToCopy) in NAudio\Wave\WaveOutputs\DirectSoundOut.cs:line 516
at NAudio.Wave.DirectSoundOut.PlaybackThreadFunc() in NAudio\Wave\WaveOutputs\DirectSoundOut.cs:line 415