Mark Heath
Mark Heath

Reputation: 49492

Setting the record level for the default waveIn device

I am trying to use the mixerGetLineInfo and mixerGetLineControls functions to get access to the the volume control for the default recording device opened with waveIn. I have written C# interop code that can successfully enumerate through all the sources destinations and controls in the system, but working out which is the control associated with the default waveIn device has so far eluded me. Does anyone have some sample code that does this?

Upvotes: 2

Views: 2055

Answers (1)

Han
Han

Reputation: 2037

You could use:

int mixerId = -1;
int inputID = MmeMixerApi.WAVE_MAPPER; // = -1
int result = MmeMixerApi.mixerGetID(inputId, ref mixerId, MIXER_OBJECTFLAG.WAVEIN);

The default input and output devices can be accessed through the wave mapper which has an ID of -1. mixerGetID will return the mixer ID associated with that input. You can then use the mixer ID to iterate over the controls. You would still need to find the correct source line (e.g. microphone, line-in etc.). For this you may want to look for a source line with a particular dwComponentType such as MIXERLINE_COMPONENTTYPE.SRC_MICROPHONE or MIXERLINE_COMPONENTTYPE.SRC_LINE.

Upvotes: 1

Related Questions