You can get the current state (which is to say, the current control values) of all or part of a mixer easily by using the GetMixerState, GetDestState, GetSourceState and GetControlState methods. Don't forget to set MixerNumber, DestNumber, SourceNumber, and ControlNumber as appropriate before doing this:
mixerState = MC.GetMixerState(errorCode) ' Get the state of the currently-selected mixer If mixerState="" Then ' The method failed, the value in errorCode will say why EndIf
destState = MC.GetDestState(errorCode) ' Get the state of the currently-selected destination If destState="" Then ' The method failed, the value in errorCode will say why EndIf
sourceState = MC.GetSourceState(errorCode) ' Get the state of the currently-selected source If sourceState="" Then ' The method failed, the value in errorCode will say why EndIf
controlState = MC.GetControlState(errorCode) ' Get the state of the currently-selected control If controlState="" Then ' The method failed, the value in errorCode will say why EndIf
The state information is a plain text string consisting of a number of lines, each line terminated with carriage return (#13, Chr(13), '\r') and line feed (#10, Chr(10), '\n') characters. It can therefore be stored in any suitable place (text file or registry, for example).
The mixer can be restored to a previously saved state by using the SetMixerState method. Only the controls that were saved will be changed back to their previous values:
errorCode = MC.SetMixerState(mixerState)
If errorCode<>MSSMERR_NOERROR Then ' Handle errors in setting the state here EndIf NOTE that the saved state includes the mixer driver name and version information. If the mixer you restore settings to (using SetMixerState) has a different name or version number to the mixer from which the settings were saved, the SetMixerState method will fail.