Search Unity

Audio How to detect when Windows default Audio device changes?

Discussion in 'Audio & Video' started by dalinut, Sep 17, 2017.

  1. dalinut

    dalinut

    Joined:
    Aug 31, 2017
    Posts:
    3
    Hi,
    I'm trying to detect when the user (through Windows menus) changes the default audio device. I tried this:

    AudioSettings.OnAudioConfigurationChanged += myAudioChangeHandler;

    But "myAudioChangeHandler()" is not called when I change the windows audio default device from headphones to speakers (or vice versa).

    To verify that my change handler was registered correctly, in my Unity project I called manually called AudioSettings.Reset() and indeed the handler executed. However, again, when I externally changed the audio output source, my handler was not invoked.

    Any pointers on what I am doing wrong are much appreciated.

    Thanks,
    Davison

    PS. Running Windows 10 and Unity 2017.1.1f1.
     
  2. PaterFrog

    PaterFrog

    Joined:
    Apr 7, 2013
    Posts:
    1
    Hey, have you made any progress on this? I'm trying to write a script (probably powershell or autoit) that detects when the default device is changed (due to USB device being plugged in for example) and resets this to what I manually assigned previously.