상속: IDisposable
예제 #1
0
 /// <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;
     }
 }
예제 #2
0
        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);
        }
예제 #3
0
 /// <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]);
 }
예제 #4
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();
 }
예제 #5
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();
 }
예제 #6
0
 /// <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;
     }
 }
예제 #7
0
 /// <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;
     }
 }
예제 #8
0
 /// <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;
 }
예제 #9
0
        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;
        }