def GetDeviceLines(deviceId=0): deviceId = GetDeviceId(deviceId) mixercaps = MIXERCAPS() mixerline = MIXERLINE() hmixer = HMIXER() # Obtain the hmixer struct rc = mixerOpen(byref(hmixer), deviceId, 0, 0, 0) if rc != MMSYSERR_NOERROR: raise SoundMixerException() if mixerGetDevCaps(deviceId, byref(mixercaps), sizeof(MIXERCAPS)): raise SoundMixerException() for destinationNum in range(mixercaps.cDestinations): mixerline.cbStruct = sizeof(MIXERLINE) mixerline.dwDestination = destinationNum if mixerGetLineInfo(hmixer, byref(mixerline), MIXER_GETLINEINFOF_DESTINATION): continue print "Destination:", destinationNum, mixerline.szName for name in GetControls(hmixer, mixerline): print " Control:", name for sourceNum in range(mixerline.cConnections): mixerline.cbStruct = sizeof(MIXERLINE) mixerline.dwDestination = destinationNum mixerline.dwSource = sourceNum if mixerGetLineInfo(hmixer, byref(mixerline), MIXER_GETLINEINFOF_SOURCE): continue print " Source:", sourceNum, mixerline.szName for name in GetControls(hmixer, mixerline): print " Control:", name
def GetDeviceLines(self, deviceId=0): mixercaps = MIXERCAPS() mixerline = MIXERLINE() result = [] hmixer = self.GetMixer(deviceId) if mixerGetDevCaps(hmixer, byref(mixercaps), sizeof(MIXERCAPS)): raise SoundMixerException() for i in range(mixercaps.cDestinations): mixerline.cbStruct = sizeof(MIXERLINE) mixerline.dwDestination = i if mixerGetLineInfo(hmixer, byref(mixerline), MIXER_GETLINEINFOF_DESTINATION): continue destination = mixerline.szName for control in self.GetControls(hmixer, mixerline): result.append((control[0], destination, None, control[1], control[2], control[3])) for n in range(mixerline.cConnections): mixerline.cbStruct = sizeof(MIXERLINE) mixerline.dwDestination = i mixerline.dwSource = n if mixerGetLineInfo(hmixer, byref(mixerline), MIXER_GETLINEINFOF_SOURCE): continue source = mixerline.szName for control in self.GetControls(hmixer, mixerline): result.append((control[0], destination, source, control[1], control[2], control[3])) return result
def FillTree(self): root = self.AddRoot("Sound Card") mixercaps = MIXERCAPS() mixerline = MIXERLINE() self.mixerHandle = mixerHandle = HMIXER() # Obtain the hmixer struct rc = mixerOpen(byref(mixerHandle), self.deviceId, 0, 0, 0) if rc != MMSYSERR_NOERROR: raise SoundMixerException() if mixerGetDevCaps(mixerHandle, byref(mixercaps), sizeof(MIXERCAPS)): raise SoundMixerException() for i in range(mixercaps.cDestinations): mixerline.cbStruct = sizeof(MIXERLINE) mixerline.dwDestination = i if mixerGetLineInfo(mixerHandle, byref(mixerline), MIXER_GETLINEINFOF_DESTINATION): continue destItem = self.AppendItem( root, mixerline.szName + ": %i" % mixerline.cChannels) self.AddControls(destItem, mixerline) for n in range(mixerline.cConnections): mixerline.cbStruct = sizeof(MIXERLINE) mixerline.dwDestination = i mixerline.dwSource = n if mixerGetLineInfo(mixerHandle, byref(mixerline), MIXER_GETLINEINFOF_SOURCE): continue sourceItem = self.AppendItem( destItem, mixerline.szName + ": %i" % mixerline.cChannels) self.AddControls(sourceItem, mixerline)
def FillTree(self): root = self.AddRoot("Sound Card") mixercaps = MIXERCAPS() mixerline = MIXERLINE() self.mixerHandle = mixerHandle = HMIXER() # Obtain the hmixer struct rc = mixerOpen(byref(mixerHandle), self.deviceId, 0, 0, 0) if rc != MMSYSERR_NOERROR: raise SoundMixerException() if mixerGetDevCaps(mixerHandle, byref(mixercaps), sizeof(MIXERCAPS)): raise SoundMixerException() for i in range(mixercaps.cDestinations): mixerline.cbStruct = sizeof(MIXERLINE) mixerline.dwDestination = i if mixerGetLineInfo( mixerHandle, byref(mixerline), MIXER_GETLINEINFOF_DESTINATION ): continue destItem = self.AppendItem( root, mixerline.szName + ": %i" % mixerline.cChannels ) self.AddControls(destItem, mixerline) for n in range(mixerline.cConnections): mixerline.cbStruct = sizeof(MIXERLINE) mixerline.dwDestination = i mixerline.dwSource = n if mixerGetLineInfo( mixerHandle, byref(mixerline), MIXER_GETLINEINFOF_SOURCE ): continue sourceItem = self.AppendItem( destItem, mixerline.szName + ": %i" % mixerline.cChannels ) self.AddControls(sourceItem, mixerline)