Re-added MakeCurrent() call. Added better error checking.

This commit is contained in:
the_fiddler 2008-01-20 22:42:49 +00:00
parent 14594d9a96
commit a4efc490b3

View file

@ -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,12 +251,12 @@ 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);
lock (audio_context_lock)
@ -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(