mirror of
https://github.com/Ryujinx/Opentk.git
synced 2025-01-11 16:55:26 +00:00
Added AudioCapture.IsRunning property.
Fixed formatting.
This commit is contained in:
parent
f1976edb8b
commit
b19d7bf4c5
|
@ -52,39 +52,7 @@ namespace OpenTK.Audio
|
|||
|
||||
#endregion
|
||||
|
||||
#region Device Name
|
||||
private string device_name;
|
||||
/// <summary>The name of the device associated with this instance.</summary>
|
||||
public string CurrentDeviceName
|
||||
{
|
||||
get
|
||||
{
|
||||
return device_name;
|
||||
}
|
||||
}
|
||||
#endregion Device Name
|
||||
|
||||
#region public static properties
|
||||
/// <summary>Returns a list of strings containing all known recording devices.</summary>
|
||||
public static IList<string> AvailableDevices
|
||||
{
|
||||
get
|
||||
{
|
||||
return AudioDeviceEnumerator.AvailableRecordingDevices;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Returns the name of the device that will be used as recording default.</summary>
|
||||
public static string DefaultDevice
|
||||
{
|
||||
get
|
||||
{
|
||||
return AudioDeviceEnumerator.DefaultRecordingDevice;
|
||||
}
|
||||
}
|
||||
#endregion public static properties
|
||||
|
||||
#region Constructor
|
||||
#region Constructors
|
||||
|
||||
static AudioCapture()
|
||||
{
|
||||
|
@ -111,6 +79,10 @@ namespace OpenTK.Audio
|
|||
{
|
||||
if (!AudioDeviceEnumerator.IsOpenALSupported)
|
||||
throw new DllNotFoundException("openal32.dll");
|
||||
if (frequency <= 0)
|
||||
throw new ArgumentOutOfRangeException("frequency");
|
||||
if (bufferSize <= 0)
|
||||
throw new ArgumentOutOfRangeException("bufferSize");
|
||||
|
||||
// Try to open specified device. If it fails, try to open default device.
|
||||
device_name = deviceName;
|
||||
|
@ -148,41 +120,55 @@ namespace OpenTK.Audio
|
|||
|
||||
#endregion Constructor
|
||||
|
||||
#region IDisposable Members
|
||||
|
||||
~AudioCapture()
|
||||
{
|
||||
Dispose();
|
||||
}
|
||||
|
||||
private bool IsDisposed;
|
||||
|
||||
/// <summary>Closes the device and disposes the instance.</summary>
|
||||
public void Dispose()
|
||||
{
|
||||
this.Dispose(true);
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
private void Dispose(bool manual)
|
||||
{
|
||||
if (!this.IsDisposed)
|
||||
{
|
||||
if (this.Handle != IntPtr.Zero)
|
||||
{
|
||||
if (this._isrecording)
|
||||
this.Stop();
|
||||
|
||||
Alc.CaptureCloseDevice(this.Handle);
|
||||
}
|
||||
this.IsDisposed = true;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Destructor
|
||||
|
||||
#region Public Members
|
||||
|
||||
#region CurrentDevice
|
||||
|
||||
private string device_name;
|
||||
|
||||
/// <summary>
|
||||
/// The name of the device associated with this instance.
|
||||
/// </summary>
|
||||
public string CurrentDevice
|
||||
{
|
||||
get
|
||||
{
|
||||
return device_name;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region AvailableDevices
|
||||
|
||||
/// <summary>
|
||||
/// Returns a list of strings containing all known recording devices.
|
||||
/// </summary>
|
||||
public static IList<string> AvailableDevices
|
||||
{
|
||||
get
|
||||
{
|
||||
return AudioDeviceEnumerator.AvailableRecordingDevices;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region DefaultDevice
|
||||
|
||||
/// <summary>
|
||||
/// Returns the name of the device that will be used as recording default.
|
||||
/// </summary>
|
||||
public static string DefaultDevice
|
||||
{
|
||||
get
|
||||
{
|
||||
return AudioDeviceEnumerator.DefaultRecordingDevice;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region CheckErrors
|
||||
|
||||
/// <summary>
|
||||
|
@ -310,6 +296,18 @@ namespace OpenTK.Audio
|
|||
|
||||
#endregion
|
||||
|
||||
#region IsRunning
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether this instance is currently capturing samples.
|
||||
/// </summary>
|
||||
public bool IsRunning
|
||||
{
|
||||
get { return _isrecording; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region Private Members
|
||||
|
@ -375,5 +373,38 @@ namespace OpenTK.Audio
|
|||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IDisposable Members
|
||||
|
||||
~AudioCapture()
|
||||
{
|
||||
Dispose();
|
||||
}
|
||||
|
||||
private bool IsDisposed;
|
||||
|
||||
/// <summary>Closes the device and disposes the instance.</summary>
|
||||
public void Dispose()
|
||||
{
|
||||
this.Dispose(true);
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
private void Dispose(bool manual)
|
||||
{
|
||||
if (!this.IsDisposed)
|
||||
{
|
||||
if (this.Handle != IntPtr.Zero)
|
||||
{
|
||||
if (this._isrecording)
|
||||
this.Stop();
|
||||
|
||||
Alc.CaptureCloseDevice(this.Handle);
|
||||
}
|
||||
this.IsDisposed = true;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Destructor
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue