mirror of
https://github.com/Ryujinx/Opentk.git
synced 2025-03-29 18:17:05 +00:00
Disabled multiple AudioContext under linux.
Moved AudioContext.LoadAvailableDevices() call outside the static constructor.
This commit is contained in:
parent
0b10d4f16b
commit
baf59abb6e
|
@ -52,13 +52,13 @@ namespace Examples
|
||||||
context.MakeCurrent();
|
context.MakeCurrent();
|
||||||
Trace.Assert(context.IsCurrent);
|
Trace.Assert(context.IsCurrent);
|
||||||
|
|
||||||
Trace.WriteLine("IsCurrent = false...");
|
//Trace.WriteLine("IsCurrent = false...");
|
||||||
context.IsCurrent = false;
|
//context.IsCurrent = false;
|
||||||
Trace.Assert(!context.IsCurrent);
|
//Trace.Assert(!context.IsCurrent);
|
||||||
|
|
||||||
Trace.WriteLine("IsCurrent = true...");
|
//Trace.WriteLine("IsCurrent = true...");
|
||||||
context.IsCurrent = true;
|
//context.IsCurrent = true;
|
||||||
Trace.Assert(context.IsCurrent);
|
//Trace.Assert(context.IsCurrent);
|
||||||
|
|
||||||
Trace.WriteLine("AudioContext.CurrentContext...");
|
Trace.WriteLine("AudioContext.CurrentContext...");
|
||||||
Trace.Assert(AudioContext.CurrentContext == context);
|
Trace.Assert(AudioContext.CurrentContext == context);
|
||||||
|
|
|
@ -41,10 +41,10 @@ namespace OpenTK.Audio
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Runs before the actual class constructor, to load available devices.
|
/// Runs before the actual class constructor, to load available devices.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
static AudioContext()
|
//static AudioContext()
|
||||||
{
|
//{
|
||||||
LoadAvailableDevices();
|
// LoadAvailableDevices();
|
||||||
}
|
//}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
@ -208,6 +208,13 @@ namespace OpenTK.Audio
|
||||||
if (maxEfxSends < 0) throw new ArgumentOutOfRangeException("maxEfxSends", maxEfxSends, "Should be greater than zero.");
|
if (maxEfxSends < 0) throw new ArgumentOutOfRangeException("maxEfxSends", maxEfxSends, "Should be greater than zero.");
|
||||||
//if (available_devices.Count == 0) throw new NotSupportedException("No audio hardware is available.");
|
//if (available_devices.Count == 0) throw new NotSupportedException("No audio hardware is available.");
|
||||||
|
|
||||||
|
if (available_devices.Count == 0)
|
||||||
|
LoadAvailableDevices();
|
||||||
|
|
||||||
|
// HACK: Do not allow multiple contexts under linux (crashes under Ubuntu 7.04 and 7.10)
|
||||||
|
if (available_contexts.Count > 0)
|
||||||
|
throw new NotSupportedException("Multiple AudioContexts are not supported under Linux.");
|
||||||
|
|
||||||
device_handle = Alc.OpenDevice(device);
|
device_handle = Alc.OpenDevice(device);
|
||||||
if (device_handle == IntPtr.Zero)
|
if (device_handle == IntPtr.Zero)
|
||||||
throw new AudioDeviceException("The specified audio device does not exist or is tied up by another application.");
|
throw new AudioDeviceException("The specified audio device does not exist or is tied up by another application.");
|
||||||
|
@ -215,7 +222,7 @@ namespace OpenTK.Audio
|
||||||
CheckForAlcErrors();
|
CheckForAlcErrors();
|
||||||
|
|
||||||
device_name = device;
|
device_name = device;
|
||||||
/*
|
|
||||||
// Build the attribute list
|
// Build the attribute list
|
||||||
List<int> attributes = new List<int>();
|
List<int> attributes = new List<int>();
|
||||||
|
|
||||||
|
@ -243,8 +250,7 @@ namespace OpenTK.Audio
|
||||||
}
|
}
|
||||||
|
|
||||||
context_handle = Alc.CreateContext(device_handle, attributes.ToArray());
|
context_handle = Alc.CreateContext(device_handle, attributes.ToArray());
|
||||||
*/
|
|
||||||
context_handle = Alc.CreateContext(device_handle, (int[])null);
|
|
||||||
if (context_handle == IntPtr.Zero)
|
if (context_handle == IntPtr.Zero)
|
||||||
{
|
{
|
||||||
Alc.CloseDevice(device_handle);
|
Alc.CloseDevice(device_handle);
|
||||||
|
@ -318,6 +324,8 @@ namespace OpenTK.Audio
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
|
if (available_devices.Count == 0)
|
||||||
|
LoadAvailableDevices();
|
||||||
return available_devices.ToArray();
|
return available_devices.ToArray();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue