Removed CurrentAlcError property.
Fixed handling of ObjectDisposedExceptions.
This commit is contained in:
parent
3222b976b3
commit
a1fc3fc13c
1 changed files with 68 additions and 37 deletions
|
@ -430,6 +430,9 @@ namespace OpenTK.Audio
|
||||||
/// <exception cref="AudioContextException">Raised when an invalid context is detected.</exception>
|
/// <exception cref="AudioContextException">Raised when an invalid context is detected.</exception>
|
||||||
public void CheckErrors()
|
public void CheckErrors()
|
||||||
{
|
{
|
||||||
|
if (disposed)
|
||||||
|
throw new ObjectDisposedException(this.GetType().FullName);
|
||||||
|
|
||||||
new AudioDeviceErrorChecker(device_handle).Dispose();
|
new AudioDeviceErrorChecker(device_handle).Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -437,18 +440,23 @@ namespace OpenTK.Audio
|
||||||
|
|
||||||
#region CurrentError
|
#region CurrentError
|
||||||
|
|
||||||
/// <summary>Returns the ALC error code for this device.</summary>
|
/// <summary>
|
||||||
|
/// Returns the ALC error code for this instance.
|
||||||
|
/// </summary>
|
||||||
public AlcError CurrentError
|
public AlcError CurrentError
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
|
if (disposed)
|
||||||
|
throw new ObjectDisposedException(this.GetType().FullName);
|
||||||
|
|
||||||
return Alc.GetError(device_handle);
|
return Alc.GetError(device_handle);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region public void MakeCurrent()
|
#region MakeCurrent
|
||||||
|
|
||||||
/// <summary>Makes the AudioContext current in the calling thread.</summary>
|
/// <summary>Makes the AudioContext current in the calling thread.</summary>
|
||||||
/// <exception cref="ObjectDisposedException">
|
/// <exception cref="ObjectDisposedException">
|
||||||
|
@ -463,12 +471,15 @@ namespace OpenTK.Audio
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
public void MakeCurrent()
|
public void MakeCurrent()
|
||||||
{
|
{
|
||||||
|
if (disposed)
|
||||||
|
throw new ObjectDisposedException(this.GetType().FullName);
|
||||||
|
|
||||||
AudioContext.MakeCurrent(this);
|
AudioContext.MakeCurrent(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region public bool IsProcessing
|
#region IsProcessing
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets a System.Boolean indicating whether the AudioContext is
|
/// Gets a System.Boolean indicating whether the AudioContext is
|
||||||
|
@ -478,13 +489,19 @@ namespace OpenTK.Audio
|
||||||
/// <seealso cref="Suspend"/>
|
/// <seealso cref="Suspend"/>
|
||||||
public bool IsProcessing
|
public bool IsProcessing
|
||||||
{
|
{
|
||||||
get { return is_processing; }
|
get
|
||||||
|
{
|
||||||
|
if (disposed)
|
||||||
|
throw new ObjectDisposedException(this.GetType().FullName);
|
||||||
|
|
||||||
|
return is_processing;
|
||||||
|
}
|
||||||
private set { is_processing = value; }
|
private set { is_processing = value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region public bool IsProcessing
|
#region IsSynchronized
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets a System.Boolean indicating whether the AudioContext is
|
/// Gets a System.Boolean indicating whether the AudioContext is
|
||||||
|
@ -493,7 +510,13 @@ namespace OpenTK.Audio
|
||||||
/// <seealso cref="Process"/>
|
/// <seealso cref="Process"/>
|
||||||
public bool IsSynchronized
|
public bool IsSynchronized
|
||||||
{
|
{
|
||||||
get { return is_synchronized; }
|
get
|
||||||
|
{
|
||||||
|
if (disposed)
|
||||||
|
throw new ObjectDisposedException(this.GetType().FullName);
|
||||||
|
|
||||||
|
return is_synchronized;
|
||||||
|
}
|
||||||
private set { is_synchronized = value; }
|
private set { is_synchronized = value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -521,7 +544,9 @@ namespace OpenTK.Audio
|
||||||
/// <seealso cref="IsSynchronized"/>
|
/// <seealso cref="IsSynchronized"/>
|
||||||
public void Process()
|
public void Process()
|
||||||
{
|
{
|
||||||
if (disposed) throw new ObjectDisposedException(this.ToString());
|
if (disposed)
|
||||||
|
throw new ObjectDisposedException(this.GetType().FullName);
|
||||||
|
|
||||||
Alc.ProcessContext(this.context_handle);
|
Alc.ProcessContext(this.context_handle);
|
||||||
IsProcessing = true;
|
IsProcessing = true;
|
||||||
}
|
}
|
||||||
|
@ -552,7 +577,9 @@ namespace OpenTK.Audio
|
||||||
/// <seealso cref="IsSynchronized"/>
|
/// <seealso cref="IsSynchronized"/>
|
||||||
public void Suspend()
|
public void Suspend()
|
||||||
{
|
{
|
||||||
if (disposed) throw new ObjectDisposedException(this.ToString());
|
if (disposed)
|
||||||
|
throw new ObjectDisposedException(this.GetType().FullName);
|
||||||
|
|
||||||
Alc.SuspendContext(this.context_handle);
|
Alc.SuspendContext(this.context_handle);
|
||||||
IsProcessing = false;
|
IsProcessing = false;
|
||||||
}
|
}
|
||||||
|
@ -568,12 +595,36 @@ namespace OpenTK.Audio
|
||||||
/// <returns>true if the extension is supported; false otherwise.</returns>
|
/// <returns>true if the extension is supported; false otherwise.</returns>
|
||||||
public bool SupportsExtension(string extension)
|
public bool SupportsExtension(string extension)
|
||||||
{
|
{
|
||||||
if (disposed) throw new ObjectDisposedException(this.GetType().FullName);
|
if (disposed)
|
||||||
|
throw new ObjectDisposedException(this.GetType().FullName);
|
||||||
|
|
||||||
return Alc.IsExtensionPresent(this.Device, extension);
|
return Alc.IsExtensionPresent(this.Device, extension);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region CurrentDevice
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets a System.String with the name of the device used in this context.
|
||||||
|
/// </summary>
|
||||||
|
public string CurrentDevice
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (disposed)
|
||||||
|
throw new ObjectDisposedException(this.GetType().FullName);
|
||||||
|
|
||||||
|
return device_name;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#endregion --- Public Members ---
|
||||||
|
|
||||||
|
#region --- Static Members ---
|
||||||
|
|
||||||
#region public static AudioContext CurrentContext
|
#region public static AudioContext CurrentContext
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -606,7 +657,10 @@ namespace OpenTK.Audio
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region AvailableDevices
|
#region AvailableDevices
|
||||||
/// <summary>Returns a list of strings containing all known playback devices.</summary>
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns a list of strings containing all known playback devices.
|
||||||
|
/// </summary>
|
||||||
public static IList<string> AvailableDevices
|
public static IList<string> AvailableDevices
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
|
@ -618,7 +672,9 @@ namespace OpenTK.Audio
|
||||||
|
|
||||||
#region DefaultDevice
|
#region DefaultDevice
|
||||||
|
|
||||||
/// <summary>Returns the name of the device that will be used as playback default.</summary>
|
/// <summary>
|
||||||
|
/// Returns the name of the device that will be used as playback default.
|
||||||
|
/// </summary>
|
||||||
public static string DefaultDevice
|
public static string DefaultDevice
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
|
@ -629,32 +685,7 @@ namespace OpenTK.Audio
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region public string CurrentDeviceName
|
#endregion
|
||||||
/// <summary>Returns the name of the used device for the current context.</summary>
|
|
||||||
public string CurrentDeviceName
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return device_name;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endregion public string CurrentDeviceName
|
|
||||||
|
|
||||||
#region public AlcError CurrentAlcError
|
|
||||||
/// <summary>Returns the first encountered error by Alc for this device.</summary>
|
|
||||||
public AlcError CurrentAlcError
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
if (disposed)
|
|
||||||
throw new ObjectDisposedException(this.ToString());
|
|
||||||
|
|
||||||
return Alc.GetError(this.device_handle);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endregion public AlcError CurrentAlcError
|
|
||||||
|
|
||||||
#endregion --- Public Members ---
|
|
||||||
|
|
||||||
#region --- IDisposable Members ---
|
#region --- IDisposable Members ---
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue