Author Topic: Read default audio device?  (Read 2865 times)

arkemiffo

  • Guest
Read default audio device?
« on: December 10, 2016, 01:30:34 PM »
Hi all

Is it possible to read the default audio device in VA?

I want to easily switch between my normal headset and the Oculus Rift with both playback and recording. However, I would like to have it as one command, i.e. "Change audio device" or similar, and have VA check which one it is and change to the other.

Kind regards
/Henrik

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4747
  • RTFM
Re: Read default audio device?
« Reply #1 on: December 10, 2016, 04:01:03 PM »
Sure, there are tokens to do so:
Quote from: VoiceAttackHelp.pdf
{STATE_DEFAULTPLAYBACK} - This returns the device name of the default audio playback device as indicated by Windows.  Note that there is a very minor memory leak when accessing the multimedia device property store, so this will be reflected in VoiceAttack (using this token sparingly will not present a problem...  running it over and over in a loop will chew up memory... the search for a better way continues).

{STATE_DEFAULTRECORDING} -This works just like {STATE_DEFAULTPLAYBACK},except the default recording device name will be returned.

You'd use a condition to determine which device to switch to:
Code: [Select]
Begin Text Compare : [{STATE_DEFAULTPLAYBACK}] Equals 'Headset'
    Change playback device to: 'Oculus Rift'
Else
    Change playback device to: 'Headset'
End Condition