GodotVR / godot_openxr

(Maintenance mode) OpenXR drivers for the Godot Game Engine v3.x
MIT License
277 stars 43 forks source link

The sound is played on the wrong audio device when launch via Air Link with Oculus SDK #228

Open graynk opened 2 years ago

graynk commented 2 years ago

I'm using Godot 3.4 on Windows 10 with Oculus Quest 2 connected via Air Link.

The Air Link creates a separate audio device for the HMD: Oculus Virtual Audio Device. All of the games using Oculus SDK (Beat Saber, Pavlov, etc) auto-select that device and I can hear the sound from the game without changing the default audio output for my PC. However, when I launch my Godot project with Oculus SDK, the game still plays sound to that default audio output, not to the Oculus one, so no sound is there unless I capture the desktop.

If I launch the game via SteamVR everything works fine.

I can upload the video of the bug in action, if it's necessary

BastiaanOlij commented 2 years ago

OpenXR has no APIs that would inform us of which audio output to use.

SteamVR will change the default audio output to the headset when SteamVR starts. One would assume that Airlink would do the same, this was definitely the behavior of the Rift and Rift S when the Oculus client starts.

Godot indeed by default outputs to the default audio device and has no idea to do otherwise. Code will need to be added that switches this but again, the OpenXR plugin has no influence on this, it would need to be solved in your game (and possibly something we could add to the default startup script).

This can be achieved by changing the audio output to the correct device through the AudioServer: https://docs.godotengine.org/en/stable/classes/class_audioserver.html#class-audioserver-property-device