SoundGet
Retrieves various settings from a sound device (master mute, master volume, etc.)
SoundGet, OutputVar , ComponentType, ControlType, DeviceNumber
Parameters
- OutputVar
The name of the variable in which to store the retrieved setting, which is either a floating point number between 0 and 100 (inclusive) or the word ON or OFF (used only for ControlTypes ONOFF, MUTE, MONO, LOUDNESS, STEREOENH, and BASSBOOST). The variable will be made blank if there was a problem retrieving the setting. The format of the floating point number, such as its decimal places, is determined by SetFormat.
- ComponentType
If omitted or blank, it defaults to the word MASTER. Otherwise, it can be one of the following words: MASTER (synonymous with SPEAKERS), DIGITAL, LINE, MICROPHONE, SYNTH, CD, TELEPHONE, PCSPEAKER, WAVE, AUX, ANALOG, HEADPHONES, or N/A. If the sound device lacks the specified ComponentType, ErrorLevel will indicate the problem.
The component labeled Auxiliary in some mixers might be accessible as ANALOG rather than AUX.
If a device has more than one instance of ComponentType (two of type LINE, for example), usually the first contains the playback settings and the second contains the recording settings. To access an instance other than the first, append a colon and a number to this parameter. For example:
Analog:2
is the second instance of the analog component.- ControlType
If omitted or blank, it defaults to VOLUME. Otherwise, it can be one of the following words: VOLUME (or VOL), ONOFF, MUTE, MONO, LOUDNESS, STEREOENH, BASSBOOST, PAN, QSOUNDPAN, BASS, TREBLE, EQUALIZER, or the number of a valid control type (see soundcard analysis script). If the specified ComponentType lacks the specified ControlType, ErrorLevel will indicate the problem.
Note: Sound devices usually support only VOLUME (or VOL) and MUTE, although others may be available depending on Windows and the sound device.
- DeviceNumber
A number between 1 and the total number of supported devices. If this parameter is omitted, it defaults to 1 (the first sound device), or on Windows Vista or above, the system's default device for playback. This parameter can be an expression. The soundcard analysis script may help determine which number to use.
ErrorLevel
[v1.1.04+]: This command is able to throw an exception on failure. For more information, see Runtime Errors.
ErrorLevel is set to 0 if the command succeeded. Otherwise, it is set to one of the following phrases:
- Invalid Control Type or Component Type
- Can't Open Specified Mixer
- Mixer Doesn't Support This Component Type
- Mixer Doesn't Have That Many of That Component Type
- Component Doesn't Support This Control Type
- Can't Get Current Setting
Remarks
Support for Windows Vista and later was added in v1.1.10.
To discover the capabilities of the sound devices (mixers) installed on the system -- such as the available component types and control types -- run the soundcard analysis script.
For more functionality and finer grained control over audio, consider using the VA library.
Use SoundSet to change a setting.
Related
SoundSet, SoundGetWaveVolume, SoundSetWaveVolume, SoundPlay
Examples
SoundGet, master_volume MsgBox, Master volume is %master_volume% percent. SoundGet, master_mute, , mute MsgBox, Master Mute is currently %master_mute%. SoundGet, bass_level, Master, bass if ErrorLevel MsgBox, Error Description: %ErrorLevel% else MsgBox, The BASS level for MASTER is %bass_level% percent. SoundGet, microphone_mute, Microphone, mute if microphone_mute = Off MsgBox, The microphone is not muted.