Re-added MakeCurrent() call. Added better error checking.
This commit is contained in:
parent
f3916e3357
commit
bd26796ced
1 changed files with 18 additions and 5 deletions
|
@ -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(
|
||||
|
|
Loading…
Reference in a new issue