def GetControlValue(hmixer, mixerControl): valueDetails = MIXERCONTROLDETAILS_UNSIGNED() mixerControlDetails = MIXERCONTROLDETAILS() mixerControlDetails.cbStruct = sizeof(MIXERCONTROLDETAILS) mixerControlDetails.item = 0 mixerControlDetails.dwControlID = mixerControl.dwControlID mixerControlDetails.cbDetails = sizeof(valueDetails) mixerControlDetails.paDetails = addressof(valueDetails) mixerControlDetails.cChannels = 1 # Get the control value rc = mixerGetControlDetails(hmixer, byref(mixerControlDetails), 0) if rc != MMSYSERR_NOERROR: raise SoundMixerException() return valueDetails.dwValue
def SetControlValue(hmixer, mixerControl, value): """ Sets the volumne from the pointer of the object passed through ' [Note: original source taken from MSDN http://support.microsoft.com/default.aspx?scid=KB;EN-US;Q178456&] This function sets the value for a volume control. Returns True if successful """ valueDetails = MIXERCONTROLDETAILS_UNSIGNED() valueDetails.dwValue = value mixerControlDetails = MIXERCONTROLDETAILS() mixerControlDetails.cbStruct = sizeof(MIXERCONTROLDETAILS) mixerControlDetails.item = 0 mixerControlDetails.dwControlID = mixerControl.dwControlID mixerControlDetails.cbDetails = sizeof(valueDetails) mixerControlDetails.paDetails = addressof(valueDetails) mixerControlDetails.cChannels = 1 # Set the control value rc = mixerSetControlDetails(hmixer, byref(mixerControlDetails), 0) if rc != MMSYSERR_NOERROR: raise SoundMixerException()