' Choose the Channel and SoundControl; this will return True if the selection was successful.
' Get or Let the Value; note that ALL values are in %
' For booleans (like Mute) the value 0 means False and 100 means True
' (one hundred percent true, so to say).
'
' Success returns True when the last selection was successful.
' ChannName returns the selected channel name (eg. Speakers).
' CrtlName returns the selected SoundControl name (eg. VolumeControl).
'
'Authors note:
''''''''''''''
' Unfortunately the Mixer Interface is rather complicated - maybe written by a musician (?) *g* -
' so there are quite a few mystic API calls with plenty of params, mixer-constants with
' ugly names, cryptic structure types, and virtual memory address pointers from one structure
' to the next >:-( *grrrhh!*...
'
' And Micro$oft's documentation is slim, to put it polite.
'
Private Declare Function mixerOpen Lib "winmm.dll" (phmx As Long, ByVal uMxId As Long, ByVal dwCallback As Long, ByVal dwInstance As Long, ByVal fdwOpen As Long) As Long
Private Declare Function mixerGetLineInfo Lib "winmm.dll" Alias "mixerGetLineInfoA" (ByVal hmxobj As Long, pmxl As MIXERLINE, ByVal fdwInfo As Long) As Long
Private Declare Function mixerGetLineControls Lib "winmm.dll" Alias "mixerGetLineControlsA" (ByVal hmxobj As Long, pmxlc As MIXERLINECONTROLS, ByVal fdwControls As Long) As Long
Private Declare Function mixerSetControlDetails Lib "winmm.dll" (ByVal hmxobj As Long, pmxcd As MIXERCONTROLDETAILS, ByVal fdwDetails As Long) As Long
Private Declare Function mixerGetControlDetails Lib "winmm.dll" Alias "mixerGetControlDetailsA" (ByVal hmxobj As Long, pmxcd As MIXERCONTROLDETAILS, ByVal fdwDetails As Long) As Long
Private Declare Function mixerClose Lib "winmm.dll" (ByVal hmx As Long) As Long
Private Enum MixerConstants 'this makes them long by default
MMSYSERR_NOERROR = 0
MIXER_CONTROLDETAILSF_VALUE = 0
MIXER_GETLINECONTROLSF_ONEBYTYPE = 2
MIXER_GETLINEINFOF_COMPONENTTYPE = 3
MIXER_SHORT_NAME_CHARS = 16
MIXER_LONG_NAME_CHARS = 64
MAXPNAMELEN = 32
'mixer line constants
MLC_DST_FIRST = 0
MLC_SRC_FIRST = &H1000
'Mixer control constants
MCT_CLASS_FADER = &H50000000
MCT_UNITS_UNSIGNED = &H30000
MCT_FADER = MCT_CLASS_FADER Or MCT_UNITS_UNSIGNED
MCT_CLASS_SWITCH = &H20000000
MCT_UNITS_BOOLEAN = &H10000
MCT_BOOLEAN = MCT_CLASS_SWITCH Or MCT_UNITS_BOOLEAN