简体   繁体   English

为什么NA​​udio只能通过“您听到的声音”音量控制来获取一个频道?

[英]Why does NAudio only grab one channel with my “What you Hear” volume control?

I'm attempting to add a volume control slider for the audio device I have selected. 我正在尝试为所选的音频设备添加音量控制滑块。 Most of the time this works properly, but for some reason when I use this method, my volume control slider only affects the left channel. 在大多数情况下,这可以正常工作,但是由于某种原因,当我使用此方法时,我的音量控制滑块只会影响左声道。 The volume on the right channel is still 100% (where I last left it via windows). 右声道的音量仍然是100%(我上次通过Windows离开的位置)。

I thought this may be because I was grabbing FirstOrDefault() so I tried grabbing a list instead, which still only results in 1 item. 我以为这可能是因为我在抓取FirstOrDefault(),所以我尝试抓取一个列表,但仍然只产生1个项目。 I must be missing something. 我肯定错过了什么。

This is the code that gets the UnsignedMixerControl: 这是获取UnsignedMixerControl的代码:

    private List<UnsignedMixerControl> _mixerControls;
    public List<UnsignedMixerControl> TryGetVolumeControls()
    {
        return _mixerControls 
            ?? (_mixerControls = waveIn.GetMixerLine().Controls.Where(c => c.ControlType == MixerControlType.Volume)
                                    .Select(c=>c as UnsignedMixerControl).ToList());
    }

Thank you for any ideas you may have. 感谢您提出的任何想法。

Mixer controls can be multi-channel, and the Value setter in NAudio does attempt to set the same value on each channel. 混音器控件可以是多通道,并且NAudio中的“值设置器”会尝试在每个通道上设置相同的值。 If you are able to debug against the NAudio source code you might be able to find out if this is a stereo control and whether the value is being set for each channel correctly. 如果您可以针对NAudio源代码进行调试,则可以找出这是否是立体声控件,以及是否为每个通道正确设置了该值。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM