/// <summary> /// Sets up the hardware resources used by the controller. /// </summary> private OpenALSoundController() { if (AL.NativeLibrary == IntPtr.Zero) { throw new DllNotFoundException("Couldn't initialize OpenAL because the native binaries couldn't be found."); } if (!OpenSoundController()) { throw new NoAudioHardwareException("OpenAL device could not be initialized, see console output for details."); } if (Alc.IsExtensionPresent(_device, "ALC_EXT_CAPTURE")) { Microphone.PopulateCaptureDevices(); } // We have hardware here and it is ready allSourcesArray = new int[MAX_NUMBER_OF_SOURCES]; AL.GenSources(allSourcesArray); ALHelper.CheckError("Failed to generate sources."); Filter = 0; if (Efx.IsInitialized) { Filter = Efx.GenFilter(); } availableSourcesCollection = new List <int>(allSourcesArray); inUseSourcesCollection = new List <int>(); }
/// <summary> /// Sets up the hardware resources used by the controller. /// </summary> private OpenALSoundController() { #if WINDOWS // On Windows, set the DLL search path for correct native binaries NativeHelper.InitDllDirectory(); #endif if (!OpenSoundController()) { throw new NoAudioHardwareException("OpenAL device could not be initialized, see console output for details."); } if (Alc.IsExtensionPresent(_device, "ALC_EXT_CAPTURE")) { Microphone.PopulateCaptureDevices(); } // We have hardware here and it is ready allSourcesArray = new int[MAX_NUMBER_OF_SOURCES]; AL.GenSources(allSourcesArray); ALHelper.CheckError("Failed to generate sources."); Filter = 0; if (Efx.IsInitialized) { Filter = Efx.GenFilter(); } availableSourcesCollection = new List <int>(allSourcesArray); inUseSourcesCollection = new List <int>(); }