DirectSoundOut 不起作用,但 WaveOut 起作用
Posted
技术标签:
【中文标题】DirectSoundOut 不起作用,但 WaveOut 起作用【英文标题】:DirectSoundOut doesn't work but WaveOut does 【发布时间】:2021-04-02 22:26:05 【问题描述】:将麦克风发送到 DirectSoundOut 不适用于此代码:
// directsound - doesn't work
var mic = new WaveInEvent() DeviceNumber = 0 ;
WaveInProvider waveInProvider = new WaveInProvider(mic);
var dso = new DirectSoundOut(DirectSoundOut.DSDEVID_DefaultPlayback, 300);
dso.Init(waveInProvider);
mic.StartRecording();
dso.Play();
但几乎相同的东西适用于 WaveOut:
var mic = new WaveInEvent() DeviceNumber = 0 ;
WaveInProvider waveInProvider = new WaveInProvider(mic);
mic.StartRecording();
var waveOut = new WaveOutEvent();
waveOut.DeviceNumber = -1;
waveOut.DesiredLatency = 300;
waveOut.Init(waveInProvider);
waveOut.Play();
NAudio:版本 1.8.4 操作系统:Win 10 64bit
有什么想法吗?
【问题讨论】:
【参考方案1】:是的,我遇到了同样的问题。 使用这个:
var mic = new WaveInEvent() DeviceNumber = 0 ;
WaveInProvider waveInProvider = new WaveInProvider(mic);
var dso = new DirectSoundOut(DirectSoundOut.DSDEVID_DefaultPlayback, 300);
dso.Init(waveInProvider);
mic.StartRecording();
dso.Play();
while(true)
【讨论】:
以上是关于DirectSoundOut 不起作用,但 WaveOut 起作用的主要内容,如果未能解决你的问题,请参考以下文章
我从 wav 文件中获取峰值频率。但是对于录制的 2 个频道 wav,它不起作用