# VA [v2.0]

Author: Lexikos Last Modified: 20100313

VA provides Windows Vista-compatible alternatives to some SoundSet/SoundGet subcommands, as well as some additional features that SoundSet/SoundGet do not support.

VA_dB2Scalar(dB, min_dB, max_dB)
VA_EnumSubunits(device, callback, target_name="", target_iid="", callback_param="")
VA_EnumSubunitsEx(part, data_flow, callback, target_name="", target_iid="", callback_param="")
VA_FindSubunit(device, target_desc, target_iid)
VA_FindSubunitCallback(part, interface, prm)
VA_GetAudioEndpointVolume(device_desc="playback")
VA_GetAudioMeter(device_desc="playback")
VA_GetChannelCount(subunit_desc="1", device_desc="playback")
VA_GetDevice(device_desc="playback")
VA_GetDeviceName(device)
VA_GetDevicePeriod(device_desc, ByRef default_period, ByRef minimum_period="")
VA_GetDeviceSubunit(device_desc, subunit_desc, subunit_iid)
VA_GetMasterChannelCount(device_desc="playback")
VA_GetMasterMute(device_desc="playback")
VA_GetMasterVolume(channel="", device_desc="playback")
VA_GetMute(subunit_desc="1", device_desc="playback")
VA_GetVolume(subunit_desc="1", channel="", device_desc="playback")
VA_IAudioAutoGainControl_GetEnabled(this, ByRef Enabled)
VA_IAudioAutoGainControl_SetEnabled(this, Enable, GuidEventContext="")
VA_IAudioEndpointVolume_GetChannelCount(aev, count)
VA_IAudioEndpointVolume_GetChannelVolumeLevel(this, Channel, ByRef LevelDB)
VA_IAudioEndpointVolume_GetChannelVolumeLevelScalar(aev, channel-1, vol)
VA_IAudioEndpointVolume_GetMasterVolumeLevel(this, ByRef LevelDB)
VA_IAudioEndpointVolume_GetMasterVolumeLevelScalar(aev, vol)
VA_IAudioEndpointVolume_GetMute(aev, mute)
VA_IAudioEndpointVolume_GetVolumeRange(this, ByRef MinDB, ByRef MaxDB, ByRef IncrementDB)
VA_IAudioEndpointVolume_GetVolumeStepInfo(this, ByRef Step, ByRef StepCount)
VA_IAudioEndpointVolume_QueryHardwareSupport(this, ByRef HardwareSupportMask)
VA_IAudioEndpointVolume_RegisterControlChangeNotify(this, Notify)
VA_IAudioEndpointVolume_SetChannelVolumeLevel(this, Channel, LevelDB, GuidEventContext="")
VA_IAudioEndpointVolume_SetChannelVolumeLevelScalar(aev, channel-1, vol/100)
VA_IAudioEndpointVolume_SetMasterVolumeLevel(this, LevelDB, GuidEventContext="")
VA_IAudioEndpointVolume_SetMasterVolumeLevelScalar(aev, vol/100)
VA_IAudioEndpointVolume_SetMute(aev, mute)
VA_IAudioEndpointVolume_UnregisterControlChangeNotify(this, Notify)
VA_IAudioEndpointVolume_VolumeStepDown(this, GuidEventContext="")
VA_IAudioEndpointVolume_VolumeStepUp(this, GuidEventContext="")
VA_IAudioMeterInformation_GetChannelsPeakValues(this, ChannelCount, PeakValues)
VA_IAudioMeterInformation_GetMeteringChannelCount(this, ByRef ChannelCount)
VA_IAudioMeterInformation_GetPeakValue(this, ByRef Peak)
VA_IAudioMeterInformation_QueryHardwareSupport(this, ByRef HardwareSupportMask)
VA_IAudioMute_GetMute(amute, muted)
VA_IAudioMute_SetMute(amute, mute)
VA_IConnector_ConnectTo(this, ConnectTo)
VA_IConnector_Disconnect(this)
VA_IConnector_GetConnectedTo(conn, conn_to)
VA_IConnector_GetConnectorIdConnectedTo(this, ByRef ConnectorId)
VA_IConnector_GetDataFlow(conn, data_flow)
VA_IConnector_GetDeviceIdConnectedTo(this, ByRef DeviceId)
VA_IConnector_GetType(this, ByRef Type)
VA_IConnector_IsConnected(this, ByRef Connected)
VA_IDeviceTopology_GetConnector(deviceTopology, 0, conn)
VA_IDeviceTopology_GetConnectorCount(this, ByRef Count)
VA_IDeviceTopology_GetDeviceId(this, ByRef DeviceId)
VA_IDeviceTopology_GetPartById(this, Id, ByRef Part)
VA_IDeviceTopology_GetSignalPath(this, PartFrom, PartTo, RejectMixedPaths, ByRef Parts)
VA_IDeviceTopology_GetSubunit(this, Index, ByRef Subunit)
VA_IDeviceTopology_GetSubunitCount(this, ByRef Count)
VA_IMMDevice_Activate(device, "{C02216F6-8C67-4B5B-9D00-D008E73E0064}", 7, 0, audioMeter)
VA_IMMDevice_GetId(this, ByRef Id)
VA_IMMDevice_GetState(this, ByRef State)
VA_IMMDevice_OpenPropertyStore(device, 0, store)
VA_IPart_Activate(this, ClsContext, iid, ByRef Object)
VA_IPart_EnumPartsIncoming(part, parts)
VA_IPart_EnumPartsOutgoing(part, parts)
VA_IPart_GetControlInterface(this, Index, ByRef InterfaceDesc)
VA_IPart_GetControlInterfaceCount(this, ByRef Count)
VA_IPart_GetGlobalId(this, ByRef GlobalId)
VA_IPart_GetLocalId(this, ByRef Id)
VA_IPart_GetName(part, name)
VA_IPart_GetPartType(part, type)
VA_IPart_GetSubType(this, ByRef SubType)
VA_IPart_GetTopologyObject(this, ByRef Topology)
VA_IPart_RegisterControlChangeCallback(this, iid, Notify)
VA_IPart_UnregisterControlChangeCallback(this, Notify)
VA_IPartsList_GetCount(parts, count)
VA_IPartsList_GetPart(parts, A_Index-1, subpart)
VA_IPerChannelDbLevel_GetChannelCount(avl, channel_count)
VA_IPerChannelDbLevel_GetLevel(avl, A_Index-1, this_vol)
VA_IPerChannelDbLevel_GetLevelRange(avl, A_Index-1, min_dB, max_dB, step_dB)
VA_IPerChannelDbLevel_SetLevel(avl, A_Index-1, this_vol)
VA_IPerChannelDbLevel_SetLevelAllChannels(this, LevelsDB, ChannelCount, GuidEventContext="")
VA_IPerChannelDbLevel_SetLevelUniform(this, LevelDB, GuidEventContext="")
VA_Scalar2dB(s, min_dB, max_dB)
VA_SetMasterMute(mute, device_desc="playback")
VA_SetMasterVolume(vol, channel="", device_desc="playback")
VA_SetMute(mute, subunit_desc="1", device_desc="playback")
VA_SetVolume(vol, subunit_desc="1", channel="", device_desc="playback")
VA_StrGet(pString)

For more details of the functions's parameters and return value, please see it's source code or the document.

#### Remarks

Script Requirements:
* Windows Vista. The script should NOT be run in XP-compatibility mode.
* Sean's Standard Library COM.ahk
Caution:
COM must be initialized prior to calling any VA functions.

For update's details and remarks related to the functions, please see the AutoHotkey Forum: http://www.autohotkey.com/forum/topic23792.html

#### License

The functions is an open source item under the Public Domain license. For details, please see lexikos-license.txt

#### Example

    ; #Include COM.ahk
    ; #Include VA.ahk
    #NoEnv
    SendMode Input
    SetWorkingDir %A_ScriptDir%

    COM_Init()

    ; Get the master volume of the default playback device.
    volume := VA_GetMasterVolume()

    ; Get the volume of the first and second channels.
    volume1 := VA_GetMasterVolume(1)
    volume2 := VA_GetMasterVolume(2)

    ; Get the master volume of a device by name.
    lineout_volume := VA_GetMasterVolume("", "Line Out")

    ; Get the master volume of the default recording device.
    recording_volume := VA_GetMasterVolume("", "capture")

    MsgBox, % "Playback volume:`t" volume
            . "`n  Channel 1:`t" volume1
            . "`n  Channel 2:`t" volume2
            . "`nLine Out volume:`t" lineout_volume
            . "`nRecording volume:`t" recording_volume