Windows 8.1中的WPF应用程序mixerSetControlDetails返回MMSYSERR_ERROR [英] Windows 8.1 WPF application mixerSetControlDetails returns MMSYSERR_ERROR

查看:634
本文介绍了Windows 8.1中的WPF应用程序mixerSetControlDetails返回MMSYSERR_ERROR的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

修改



修改n音讯源代码和一个小的调试后,我发现 mixerSetControlDetails 功能,当我设置了财产被调用时,返回 MMSYSERR_ERROR



有没有一种方法,以获取有关为何 mixerSetControlDetails 失败?



的进一步信息

我也开放给其他的方法来完成对C#同样的事情。



原始



我有一些代码,语音计算能量,并将根据使用n音讯计算的值的麦克风的增益值。我没有问题,阅读的音频采样,但是当我尝试设置麦克风的增益,程序卡住。



我已经检查了问题,在Windows 7,8,和8.1。仅在Windows 8.1时出现问题。有趣的是,当我与Windows 8.1在虚拟机上运行的程序它工作正常。这可能是一个权限问题?



下面是设置的提升值

 <代码code>的foreach(mixerControl mixerControl在MixerLine.Controls)
{如果
(mixerControl.ControlType == MixerControlType.Volume)
{
UnsignedMixerControl volume control还=(UnsignedMixerControl)mixerControl ;

volumeControl.Value =(UINT)值;
}
}



在哪里MixerLine与此代码预先创建。

  MixerLine =新MixerLine((IntPtr的)设备ID,0,MixerFlags.WaveIn); 


解决方案

看来 mixerSetControlDetails 函数返回 MMSYSERR_ERROR 随机(至少我无法找到一个模式)。其实这不设置新的价值,只是忽略异常,或者如果它没有设置再试一次设置的值。该卡的行为是我的计划,不相干的这个错误。


Edit

After modifying the NAudio source code and a little debugging, I found that the mixerSetControlDetails function, which is called when I set the Value property, returns MMSYSERR_ERROR.

Is there a way to get further information about why mixerSetControlDetails failed?

I'm also open to other ways to accomplish same thing on C#.

Original

I have some code that computes energy in voice and sets the microphone boost level according to this computed value using NAudio. I have no problem reading audio samples but when I try to set microphone boost, the program gets stuck.

I have checked the issue on Windows 7, 8, and 8.1. The problem occurs only on Windows 8.1. Interestingly when I run the program on a virtual machine with Windows 8.1 it works as expected. Can this be a permission problem?

Here is the code for setting the boost value

foreach (MixerControl mixerControl in MixerLine.Controls)
{
    if (mixerControl.ControlType == MixerControlType.Volume)
    {
        UnsignedMixerControl volumeControl = (UnsignedMixerControl)mixerControl;

        volumeControl.Value = (uint) value;
    }
}

Where MixerLine is created beforehand with this code.

MixerLine = new MixerLine((IntPtr) deviceID, 0, MixerFlags.WaveIn);

解决方案

It seems the mixerSetControlDetails function returns MMSYSERR_ERROR randomly (at least I couldn't find a pattern). Actually it does set the new value, just ignore the exception, or if it does not set try setting the value again. The stuck behavior was about my program, irrelevant to this error.

这篇关于Windows 8.1中的WPF应用程序mixerSetControlDetails返回MMSYSERR_ERROR的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆