mirror of
https://github.com/Ryujinx/Opentk.git
synced 2025-07-01 11:18:22 +00:00
Re-added MakeCurrent() call. Added better error checking.
This commit is contained in:
parent
14594d9a96
commit
a4efc490b3
|
@ -212,6 +212,8 @@ namespace OpenTK.Audio
|
||||||
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.");
|
||||||
|
|
||||||
|
CheckForAlcErrors();
|
||||||
|
|
||||||
device_name = device;
|
device_name = device;
|
||||||
/*
|
/*
|
||||||
// Build the attribute list
|
// Build the attribute list
|
||||||
|
@ -249,11 +251,11 @@ namespace OpenTK.Audio
|
||||||
throw new AudioContextException("The audio context could not be created with the specified parameters.");
|
throw new AudioContextException("The audio context could not be created with the specified parameters.");
|
||||||
}
|
}
|
||||||
|
|
||||||
//MakeCurrent();
|
CheckForAlcErrors();
|
||||||
|
|
||||||
AlcError err = Alc.GetError(device_handle);
|
MakeCurrent();
|
||||||
if (err != AlcError.NoError)
|
|
||||||
throw new AudioContextException(err.ToString());
|
CheckForAlcErrors();
|
||||||
|
|
||||||
//device_name = Alc.GetString(device_handle, AlcGetString.DeviceSpecifier);
|
//device_name = Alc.GetString(device_handle, AlcGetString.DeviceSpecifier);
|
||||||
//Debug.Print(device_name);
|
//Debug.Print(device_name);
|
||||||
|
@ -265,6 +267,17 @@ namespace OpenTK.Audio
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region void CheckForAlcErrors()
|
||||||
|
|
||||||
|
void CheckForAlcErrors()
|
||||||
|
{
|
||||||
|
AlcError err = Alc.GetError(device_handle);
|
||||||
|
if (err != AlcError.NoError)
|
||||||
|
throw new AudioContextException(err.ToString());
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
#region static void MakeCurrent(AudioContext context)
|
#region static void MakeCurrent(AudioContext context)
|
||||||
|
|
||||||
/// <private />
|
/// <private />
|
||||||
|
@ -278,7 +291,7 @@ namespace OpenTK.Audio
|
||||||
/// </exception>
|
/// </exception>
|
||||||
static void MakeCurrent(AudioContext context)
|
static void MakeCurrent(AudioContext context)
|
||||||
{
|
{
|
||||||
//lock (audio_context_lock)
|
lock (audio_context_lock)
|
||||||
{
|
{
|
||||||
if (!Alc.MakeContextCurrent(context != null ? (IntPtr)context.context_handle : IntPtr.Zero))
|
if (!Alc.MakeContextCurrent(context != null ? (IntPtr)context.context_handle : IntPtr.Zero))
|
||||||
throw new AudioContextException(Alc.GetError(
|
throw new AudioContextException(Alc.GetError(
|
||||||
|
|
Loading…
Reference in a new issue