Set an audio device

AdvancedProgrammer

You can set which audio device Xenko uses. For example, you can access the Oculus Rift audio device from your custom game constructor.

If you don't specify a device, Xenko uses the default audio advice.

Example code

This code sets the Oculus Rift device at runtime:

  1. namespace OculusRenderer
  2. {
  3. public class OculusGame : Game
  4. {
  5. public OculusGame()
  6. {
  7. var deviceName = OculusOvr.GetAudioDeviceFullName();
  8. var deviceUuid = new AudioDevice { Name = deviceName };
  9. Audio.RequestedAudioDevice = deviceUuid;
  10. }
  11. }
  12. }

See also