marnsa.blogg.se

Improve microphone gain windows 10
Improve microphone gain windows 10










improve microphone gain windows 10

Var mixer = new Mixer(waveInDeviceNumber) įoreach (var destination in mixer.Destinations) VolumeControl = control as UnsignedMixerControl If (control.ControlType = MixerControlType.Volume) Var mixerLine = new MixerLine((IntPtr)waveInDeviceNumber, 0, MixerFlags.WaveIn) įoreach (var control in mixerLine.Controls) Int waveInDeviceNumber = waveIn.DeviceNumber This is what I ended up with (still doesn't work everywhere) private void TryGetVolumeControl() You probably have to end up writing two lots of code, one for XP and one for Vista/Win 7. NET Voice Recorder using NAudio, and found it extremely hard. I tried doing exactly this a while ago when I was writing.

improve microphone gain windows 10

Meanwhile, if I figure it out before I get a response, I'll post my own answer. I admit to not having a good grasp on the mixer API, so that's what I'm looking into now however if anyone has a clue why this would work on W7, but not XP, I'd sure like to hear it. Note, as I said above, this works on W7 (the second attempt is never executed because it doesn't fail using mixerOpen(out mixer, mxid, 0, 0, MIXER_OBJECTF_WAVEIN)). Then, with this second attempt using mixerOpen(out mixer, 0, 0, 0, 0), the code doesn't return a failure but the mic gain is unaffected. This is done because on XP, in the first call to GetVolumeControl (refer to site above for that code), the call to mixerGetLineControlsA() fails with XP systems returning MIXERR_INVALCONTROL.

improve microphone gain windows 10

Note the "second attempt" to call GetVolumeControl(). Throw new Exception("SetMicVolume/SetVolumeControl() failed") Rc = SetVolumeControl(mixer, volCtrl, vVolume) VVolume = ((int)((float)(volCtrl.lMaximum - volCtrl.lMinimum) / 100.0F) * percentage) Throw new Exception("SetMicVolume/GetVolumeControl() failed") Rc = GetVolumeControl(mixer, MIXERLINE_COMPONENTTYPE_SRC_MICROPHONE, type, out volCtrl, out currentVol) Int type = MIXERCONTROL_CONTROLTYPE_VOLUME MixerOpen(out mixer, mxid, 0, 0, MIXER_OBJECTF_WAVEIN) MIXERCONTROL volCtrl = new MIXERCONTROL() public static void SetMicVolume(int mxid, int percentage) The mixer code I started with comes from here:Īnd it works, but is written to adjust speaker volume. So, I managed to find some mixer code that I've also pulled in andĪccess through pInvoke and that allows me to adjust microphone volume, but only on my W7 PC. The problem is that for whatever reason, that API does not allow me to adjust microphone I'm also able to adjust speaker (WaveOut) volume with that API. I have a C# application, with all the pInvoke hooks to talk to the waveXXX API, and I'm able to do capture and play back ofĪudio with that. First, note that I know there are a few questions like this already posted however theyĭon't seem to address the problem adequately.












Improve microphone gain windows 10