SoundSetWaveVolume - Syntax & Usage | AutoHotkey

AutoHotkey

SoundSetWaveVolume

Changes the wave output volume for a sound device.

SoundSetWaveVolume, Percent , DeviceNumber

Parameters

Percent

Percentage number between -100 and 100 inclusive (it can be a floating point number or an expression). If the number begins with a plus or minus sign, the current volume level will be adjusted up or down by the indicated amount. Otherwise, the volume will be set explicitly to the level indicated by Percent.

DeviceNumber

If this parameter is omitted, it defaults to 1 (the first sound device), which is usually the system's default device for recording and playback. Specify a number higher than 1 to operate upon a different sound device.

ErrorLevel

[v1.1.04+]: This command is able to throw an exception on failure. For more information, see Runtime Errors.

ErrorLevel is set to 1 if there was a problem or 0 otherwise.

Remarks

The current wave output volume level can be retrieved via SoundGetWaveVolume. Settings such as Master Volume, Synth, Microphone, Mute, Treble, and Bass can be set and retrieved using SoundSet and SoundGet.

[v1.1.10+]: On Windows Vista and later, this command is equivalent to SoundSet with ComponentType set to Wave and ControlType set to Volume. Both commands attempt to preserve the existing balance between channels.

Windows 2000/XP/2003: Unlike SoundSet, this command attempts to preserve the existing balance between channels (e.g. left and right) when changing the volume level.

Related

SoundGetWaveVolume, SoundSet, SoundGet, SoundPlay

Examples

SoundSetWaveVolume, 50  ; Set the volume to its half-way point.
SoundSetWaveVolume, -10  ; Decrease the current  level by 10 (e.g. 80 would become 70).
SoundSetWaveVolume, +20  ; Increase the current level by 20.