Esempio n. 1
0
        /// <summary>
        /// Sets up the hardware resources used by the controller.
        /// </summary>
        private ALController()
        {
            if (AL.NativeLibrary == IntPtr.Zero)
            {
                throw new DllNotFoundException(
                          "Couldn't initialize OpenAL because the native binaries couldn't be found.");
            }

            if (!Open())
            {
                throw new AudioHardwareException(
                          "OpenAL device could not be initialized, see console output for details.");
            }

            Efx = new EffectsExtension(Device);

            if (ALC.IsExtensionPresent(Device, "ALC_EXT_CAPTURE"))
            {
                Microphone.PopulateCaptureDevices();
            }

            // We have hardware here and it is ready

            _allSources = new uint[MaxNumberOfSources];
            AL.GenSources(_allSources);
            ALHelper.CheckError("Failed to generate sources.");

            // TODO: allow more effects
            if (Efx.IsAvailable)
            {
                Filter = Efx.GenFilter();
            }

            _availableSources = new Queue <uint>(_allSources);
            _sourcesInUse     = new HashSet <uint>();
        }
Esempio n. 2
0
 /// <summary>
 /// Checks if this extension is present.
 /// </summary>
 /// <param name="device">The device to query.</param>
 /// <returns>Whether the extension was present or not.</returns>
 public static bool IsExtensionPresent(ALDevice device)
 {
     return(ALC.IsExtensionPresent(device, ExtensionName));
 }
Esempio n. 3
0
 /// <summary>
 /// Checks whether the extension is present.
 /// </summary>
 /// <returns>Whether the extension was present or not.</returns>
 public static bool IsExtensionPresent()
 => ALC.IsExtensionPresent(ALDevice.Null, ExtensionName);
Esempio n. 4
0
 /// <summary>
 /// Checks whether the extension is present.
 /// </summary>
 /// <param name="device">The device to be queried.</param>
 /// <returns>Whether the extension was present or not.</returns>
 public static bool IsExtensionPresent(ALDevice device)
 => ALC.IsExtensionPresent(device, ExtensionName);
Esempio n. 5
0
 /// <summary>
 /// Checks whether the extension is present.
 /// </summary>
 /// <returns>Whether the extension was present or not.</returns>
 public static bool IsExtensionPresent()
 {
     return(ALC.IsExtensionPresent(ALDevice.Null, ExtensionName));
 }