/// <summary> /// Create the default backend for the current operating system /// </summary> /// <param name="options">the settings for this audio engine</param> /// <returns></returns> public static AudioEngine CreateDefault(AudioEngineOptions options) { if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) { return(CreateXAudio(options)); } else { return(CreateOpenAL(options)); } }
/// <summary> /// Creates a new <see cref="AudioEngine"/> using XAudio 2. /// </summary> /// <param name="options">the settings for this audio engine</param> /// <returns>A new <see cref="AudioEngine"/> using the XAudio 2 API.</returns> public static AudioEngine CreateXAudio(AudioEngineOptions options) { try { return(new XA2.XA2Engine(options)); } catch { return(null); } }
/// <summary> /// Creates a new <see cref="AudioEngine"/> using OpenAL. /// </summary> /// <param name="options">the settings for this audio engine</param> /// <returns>A new <see cref="AudioEngine"/> using the openal API. If not possible returns null</returns> public static AudioEngine CreateOpenAL(AudioEngineOptions options) { try { return(new AL.ALEngine(options)); } catch (TypeInitializationException) { return(null); } }
/// <summary> /// Creates a new <see cref="AudioEngine"/> using XAudio 2. /// </summary> /// <param name="options">the settings for this audio engine</param> /// <returns>A new <see cref="AudioEngine"/> using the XAudio 2 API.</returns> public static AudioEngine CreateXAudio(AudioEngineOptions options) { return(new XA2.XA2Engine(options)); }