/// <summary> /// Sets the default openal device if no one is set. /// </summary> /// <param name="device">The OpenALDevice.</param> public static void SetDefaultOpenALDeviceOnStartup(OpenALDevice device) { if (DefaultDevice == null) { DefaultDevice = device; } }
internal static OpenALDevice[] GetOpenALDevices() { var strings = new string[0]; if (IsExtensionPresent("ALC_ENUMERATE_ALL_EXT")) { strings = ReadStringsFromMemory(alcGetString(IntPtr.Zero, (int)DeviceSpecifications.AllDevicesSpecifier)); } else if (IsExtensionPresent("ALC_ENUMERATION_EXT")) { strings = ReadStringsFromMemory(alcGetString(IntPtr.Zero, (int)DeviceSpecifications.DeviceSpecifier)); } var devices = new OpenALDevice[strings.Length]; for (var i = 0; i < devices.Length; i++) { devices[i] = new OpenALDevice(strings[i], i); } return(devices); }
/// <summary> /// Initializes a new OpenALAudioProvider class. /// </summary> public OpenALAudioProvider() { if (OpenALDevice.AvailableDevices.Length == 0) { throw new AudioException("No available audio devices where found."); } OpenALDevice.SetDefaultOpenALDeviceOnStartup(OpenALDevice.AvailableDevices[0]); }
/// <summary> /// Initializes a new OpenALAudioBuffer class. /// </summary> public OpenALAudioBuffer(OpenALAudioFormat format, OpenALDevice device) { Format = format; Owner = device; _locker = new object(); _audioMixer = new AudioMixer(); PlaybackState = PlaybackState.Stopped; _source = Owner.SourcePool.RequestSource(); }
/// <summary> /// Sets the OpenALDevice for this application. /// </summary> /// <param name="device">The OpenALDevice.</param> public static void SetOpenALDeviceIfNeeded(OpenALDevice device) { if (DefaultDevice != null) { if (DefaultDevice.Id != device.Id) { DefaultDevice.Dispose(); DefaultDevice = device; } } else { DefaultDevice = device; } }
/// <summary> /// Sets the default openal device if no one is set. /// </summary> /// <param name="device">The OpenALDevice.</param> public static void SetDefaultOpenALDeviceOnStartup(OpenALDevice device) { if (DefaultDevice == null) DefaultDevice = device; }
internal static OpenALDevice[] GetOpenALDevices() { var strings = new string[0]; if (IsExtensionPresent("ALC_ENUMERATE_ALL_EXT")) { strings = ReadStringsFromMemory(alcGetString(IntPtr.Zero, (int) DeviceSpecifications.AllDevicesSpecifier)); } else if (IsExtensionPresent("ALC_ENUMERATION_EXT")) { strings = ReadStringsFromMemory(alcGetString(IntPtr.Zero, (int) DeviceSpecifications.DeviceSpecifier)); } var devices = new OpenALDevice[strings.Length]; for (var i = 0; i < devices.Length; i++) { devices[i] = new OpenALDevice(strings[i], i); } return devices; }