# SteamVR headset speaker and microphone switching fails with errors

**URL:** <https://qa.fmod.com/t/steamvr-headset-speaker-and-microphone-switching-fails-with-errors/18962>\
**Category:** FMOD Engine\
**Tags:** unity\
**Created:** [June 30, 2022, 7:53pm UTC](https://qa.fmod.com/t/steamvr-headset-speaker-and-microphone-switching-fails-with-errors/18962 "2022-06-30T19:53:07Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Reification](https://avatars.discourse-cdn.com/v4/letter/r/9f8e36/32.png) [@Reification](https://qa.fmod.com/u/Reification)\
**Post date:** [June 30, 2022, 7:53pm UTC](https://qa.fmod.com/t/steamvr-headset-speaker-and-microphone-switching-fails-with-errors/18962/1 "2022-06-30T19:53:07Z")

</div>

SETUP:

- Alienware m17 laptop
  - ‘Speakers/Headphones (Realtek(R) Audio)’
  - ‘Microphone (Realtek(R) Audio)’

- Index headset
  - ‘Index HMD (NVIDIA High Definition Audio)’
  - ‘Digital Audio Interface (Valve VR Radio & HMD Mic)’

- Windows 10
- Unity 2019.4.36f1
- FMOD (UnityAudio disabled)
- SteamAudio (set to use FMOD)
- SteamVR

Speaker output is controlled using `FMODUnity.RuntimeManager.CoreSystem.setDriver(driverId)`  
Microphone output is controlled using `FMODUnity.RuntimeManager.CoreSystem.recordStart(deviceID, sound, true)` and `FMODUnity.RuntimeManager.CoreSystem.recordStop(_deviceID)`

TEST 1: Just switch between desktop & headset display modes, without changing audio  
Everything is fine.

TEST 2: Switch microphone while speakers are running…  
=\> No FMOD errors reported

TEST 3: Switch speakers while microphone is running…  
=\> FMOD errors and microphone does not work  
[FMOD] OutputWASAPI::recordStart : IMMDeviceEnumerator::GetDevice returned 0x80004003.  
FMOD Result: ERR\_RECORD

NOTE: When using UnityAudio instead of FMOD the microphone can be switched. (Calling this a “workaround” seems like a stretch, but it does cover some use-cases.)

CROSS-POST: This same issue is posted in the SteamVR project issues: [FMOD speaker and microphone switching fails with errors · Issue #1055 · ValveSoftware/steamvr\_unity\_plugin · GitHub](https://github.com/ValveSoftware/steamvr_unity_plugin/issues/1055)

---

<div class="post-metadata">

**Author:** ![Reification](https://avatars.discourse-cdn.com/v4/letter/r/9f8e36/32.png) [@Reification](https://qa.fmod.com/u/Reification)\
**Post date:** [July 1, 2022, 12:00am UTC](https://qa.fmod.com/t/steamvr-headset-speaker-and-microphone-switching-fails-with-errors/18962/3 "2022-07-01T00:00:40Z")

</div>

REQUEST: Additional testing with other hardware configurations.

I do not have equipment to test speaker & microphone switching without using SteamVR… if this bug CANNOT be reproduced on devices that are NOT managed by SteamVR then the issue is entirely with SteamVR.

---

<div class="post-metadata">

**Author:** ![Reification](https://avatars.discourse-cdn.com/v4/letter/r/9f8e36/32.png) [@Reification](https://qa.fmod.com/u/Reification)\
**Post date:** [July 1, 2022, 1:20am UTC](https://qa.fmod.com/t/steamvr-headset-speaker-and-microphone-switching-fails-with-errors/18962/4 "2022-07-01T01:20:28Z")

</div>

OBSERVATION: Stopping the microphone recording, switching the device driver and then restarting the microphone recording works… but ONLY if there is a delay between the call to System::setDriver and System::recordStart.

The magic number (for me) is somewhere between 15 & 30 frames (at 90fps Unity update)… but my guess is that the timing (roughly 1/4 second) is what actually matters.

---

<div class="post-metadata">

**Author:** ![jeff\_fmod](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/jeff_fmod/32/1766_2.png) [@jeff\_fmod](https://qa.fmod.com/u/jeff_fmod)\
**Post date:** [July 8, 2022, 6:37am UTC](https://qa.fmod.com/t/steamvr-headset-speaker-and-microphone-switching-fails-with-errors/18962/5 "2022-07-08T06:37:05Z")

</div>

I have reproduced this as you have described, and this does not seem to be exclusive to SteamVR.  
The recommended way to handle recording device switching can be found in the Core API record\_enumeration example. It’s in C++ but the FMOD API calls are the same and should be fairly straightforward to convert to C#.  
If you intend on doing a lot of input device plugging and unplugging and want it to be handled automatically then you can try implementing a [FMOD\_SYSTEM\_CALLBACK\_DEVICELISTCHANGED](https://fmod.com/docs/2.02/api/core-api-system.html#fmod_system_callback_type) callback, reverting to a different recording device when an existing one is lost.

---

<div class="post-metadata">

**Author:** ![Reification](https://avatars.discourse-cdn.com/v4/letter/r/9f8e36/32.png) [@Reification](https://qa.fmod.com/u/Reification)\
**Post date:** [July 9, 2022, 7:09am UTC](https://qa.fmod.com/t/steamvr-headset-speaker-and-microphone-switching-fails-with-errors/18962/6 "2022-07-09T07:09:28Z")

</div>

@jeff_fmod thank you for checking on this, and thank you for the example references. In light of your assessment I have closed the issue with SteamVR Unity Plugin.

Since you have confirmed that this is an FMOD issue I’m going to mark the work-around as the solution. If I have misunderstood and there _is_ a way to switch the output device without an arbitrary pause on the input device _please_ let me know.

P.S. To clarify: I am not plugging in or unplugging any devices. I have a laptop with speakers and a microphone, and a VR headset with speakers and microphone. My goal is to switch audio input and output between the headset and the laptop.

---

<div class="post-metadata">

**Author:** ![jeff\_fmod](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/jeff_fmod/32/1766_2.png) [@jeff\_fmod](https://qa.fmod.com/u/jeff_fmod)\
**Post date:** [July 13, 2022, 12:16am UTC](https://qa.fmod.com/t/steamvr-headset-speaker-and-microphone-switching-fails-with-errors/18962/7 "2022-07-13T00:16:23Z")

</div>

> [@Reification](#):
>
> P.S. To clarify: I am not plugging in or unplugging any devices. I have a laptop with speakers and a microphone, and a VR headset with speakers and microphone. My goal is to switch audio input and output between the headset and the laptop.

Thank you for clarifying, it seems I have misunderstood the original issue here. It seems that the recording device is not available until some time after a device change occurs. I have passed this onto the Dev team to investigate in more detail, thank you for bringing this to our attention!
