The Open Toolkit library
1.0
|
Provides methods to instantiate, use and destroy an audio device for recording. Static methods are provided to list available devices known by the driver. More...
Inherits IDisposable.
Public Member Functions | |
AudioCapture () | |
Opens the default device for audio recording. Implicitly set parameters are: 22050Hz, 16Bit Mono, 4096 samples ringbuffer. More... | |
AudioCapture (string deviceName, int frequency, ALFormat sampleFormat, int bufferSize) | |
Opens a device for audio recording. More... | |
void | CheckErrors () |
Checks for ALC error conditions. More... | |
void | Start () |
Start recording samples. The number of available samples can be obtained through the AvailableSamples property. The data can be queried with any ReadSamples(IntPtr, int) method. More... | |
void | Stop () |
Stop recording samples. This will not clear previously recorded samples. More... | |
void | ReadSamples (IntPtr buffer, int sampleCount) |
Fills the specified buffer with samples from the internal capture ring-buffer. This method does not block: it is an error to specify a sampleCount larger than AvailableSamples. More... | |
void | ReadSamples< TBuffer > (TBuffer[] buffer, int sampleCount) |
Fills the specified buffer with samples from the internal capture ring-buffer. This method does not block: it is an error to specify a sampleCount larger than AvailableSamples. More... | |
void | Dispose () |
Closes the device and disposes the instance. More... | |
Properties | |
string | CurrentDevice [get] |
The name of the device associated with this instance. More... | |
static IList< string > | AvailableDevices [get] |
Returns a list of strings containing all known recording devices. More... | |
static string | DefaultDevice [get] |
Returns the name of the device that will be used as recording default. More... | |
AlcError | CurrentError [get] |
Returns the ALC error code for this device. More... | |
int | AvailableSamples [get] |
Returns the number of available samples for capture. More... | |
ALFormat | SampleFormat [get, set] |
Gets the OpenTK.Audio.ALFormat for this instance. More... | |
int | SampleFrequency [get, set] |
Gets the sampling rate for this instance. More... | |
bool | IsRunning [get] |
Gets a value indicating whether this instance is currently capturing samples. More... | |
Provides methods to instantiate, use and destroy an audio device for recording. Static methods are provided to list available devices known by the driver.
OpenTK.Audio.AudioCapture.AudioCapture | ( | ) |
Opens the default device for audio recording. Implicitly set parameters are: 22050Hz, 16Bit Mono, 4096 samples ringbuffer.
OpenTK.Audio.AudioCapture.AudioCapture | ( | string | deviceName, |
int | frequency, | ||
ALFormat | sampleFormat, | ||
int | bufferSize | ||
) |
Opens a device for audio recording.
deviceName | The device name. |
frequency | The frequency that the data should be captured at. |
sampleFormat | The requested capture buffer format. |
bufferSize | The size of OpenAL's capture internal ring-buffer. This value expects number of samples, not bytes. |
void OpenTK.Audio.AudioCapture.CheckErrors | ( | ) |
Checks for ALC error conditions.
OutOfMemoryException | Raised when an out of memory error is detected. |
AudioValueException | Raised when an invalid value is detected. |
AudioDeviceException | Raised when an invalid device is detected. |
AudioContextException | Raised when an invalid context is detected. |
void OpenTK.Audio.AudioCapture.Dispose | ( | ) |
Closes the device and disposes the instance.
void OpenTK.Audio.AudioCapture.ReadSamples | ( | IntPtr | buffer, |
int | sampleCount | ||
) |
Fills the specified buffer with samples from the internal capture ring-buffer. This method does not block: it is an error to specify a sampleCount larger than AvailableSamples.
buffer | A pointer to a previously initialized and pinned array. |
sampleCount | The number of samples to be written to the buffer. |
void OpenTK.Audio.AudioCapture.ReadSamples< TBuffer > | ( | TBuffer[] | buffer, |
int | sampleCount | ||
) |
Fills the specified buffer with samples from the internal capture ring-buffer. This method does not block: it is an error to specify a sampleCount larger than AvailableSamples.
buffer | The buffer to fill. |
sampleCount | The number of samples to be written to the buffer. |
System.ArgumentNullException | Raised when buffer is null. |
System.ArgumentOutOfRangeException | Raised when sampleCount is larger than the buffer. |
TBuffer | : | struct |
void OpenTK.Audio.AudioCapture.Start | ( | ) |
Start recording samples. The number of available samples can be obtained through the AvailableSamples property. The data can be queried with any ReadSamples(IntPtr, int) method.
void OpenTK.Audio.AudioCapture.Stop | ( | ) |
Stop recording samples. This will not clear previously recorded samples.
|
staticget |
Returns a list of strings containing all known recording devices.
|
get |
Returns the number of available samples for capture.
|
get |
The name of the device associated with this instance.
|
get |
Returns the ALC error code for this device.
|
staticget |
Returns the name of the device that will be used as recording default.
|
get |
Gets a value indicating whether this instance is currently capturing samples.
|
getset |
Gets the OpenTK.Audio.ALFormat for this instance.
|
getset |
Gets the sampling rate for this instance.