Table of Contents

Set an audio device

Advanced Programmer

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

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

Example code

This code sets the Oculus Rift device at runtime:

namespace OculusRenderer
{
    public class OculusGame : Game
    {
        public OculusGame()
        {
            var deviceName = OculusOvr.GetAudioDeviceFullName();
            var deviceUuid = new AudioDevice { Name = deviceName };
            Audio.RequestedAudioDevice = deviceUuid;
        }
    }
}

See also