mirror of
https://github.com/Ryujinx/Opentk.git
synced 2024-12-26 05:05:31 +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)
|
||||
throw new AudioDeviceException("The specified audio device does not exist or is tied up by another application.");
|
||||
|
||||
CheckForAlcErrors();
|
||||
|
||||
device_name = device;
|
||||
/*
|
||||
// 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.");
|
||||
}
|
||||
|
||||
//MakeCurrent();
|
||||
CheckForAlcErrors();
|
||||
|
||||
AlcError err = Alc.GetError(device_handle);
|
||||
if (err != AlcError.NoError)
|
||||
throw new AudioContextException(err.ToString());
|
||||
MakeCurrent();
|
||||
|
||||
CheckForAlcErrors();
|
||||
|
||||
//device_name = Alc.GetString(device_handle, AlcGetString.DeviceSpecifier);
|
||||
//Debug.Print(device_name);
|
||||
|
@ -265,6 +267,17 @@ namespace OpenTK.Audio
|
|||
|
||||
#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)
|
||||
|
||||
/// <private />
|
||||
|
@ -278,7 +291,7 @@ namespace OpenTK.Audio
|
|||
/// </exception>
|
||||
static void MakeCurrent(AudioContext context)
|
||||
{
|
||||
//lock (audio_context_lock)
|
||||
lock (audio_context_lock)
|
||||
{
|
||||
if (!Alc.MakeContextCurrent(context != null ? (IntPtr)context.context_handle : IntPtr.Zero))
|
||||
throw new AudioContextException(Alc.GetError(
|
||||
|
|
Loading…
Reference in a new issue