The Open Toolkit library
1.0
|
Provides methods to instantiate, use and destroy an audio context for playback. Static methods are provided to list available devices known by the driver. More...
Inherits IDisposable.
Public Types | |
enum | MaxAuxiliarySends : int { MaxAuxiliarySends.UseDriverDefault = 0, MaxAuxiliarySends.One = 1, MaxAuxiliarySends.Two = 2, MaxAuxiliarySends.Three = 3, MaxAuxiliarySends.Four = 4 } |
May be passed at context construction time to indicate the number of desired auxiliary effect slot sends per source. More... | |
Public Member Functions | |
AudioContext () | |
Constructs a new AudioContext, using the default audio device. More... | |
AudioContext (string device) | |
Constructs a new AudioContext instance. More... | |
AudioContext (string device, int freq) | |
Constructs a new AudioContext, using the specified audio device and device parameters. More... | |
AudioContext (string device, int freq, int refresh) | |
Constructs a new AudioContext, using the specified audio device and device parameters. More... | |
AudioContext (string device, int freq, int refresh, bool sync) | |
Constructs a new AudioContext, using the specified audio device and device parameters. More... | |
AudioContext (string device, int freq, int refresh, bool sync, bool enableEfx) | |
Creates the audio context using the specified device and device parameters. More... | |
AudioContext (string device, int freq, int refresh, bool sync, bool enableEfx, MaxAuxiliarySends efxMaxAuxSends) | |
Creates the audio context using the specified device and device parameters. More... | |
void | CheckErrors () |
Checks for ALC error conditions. More... | |
void | MakeCurrent () |
Makes the AudioContext current in the calling thread. More... | |
void | Process () |
Processes queued audio events. More... | |
void | Suspend () |
Suspends processing of audio events. More... | |
bool | SupportsExtension (string extension) |
Checks whether the specified OpenAL extension is supported. More... | |
void | Dispose () |
Disposes of the AudioContext, cleaning up all resources consumed by it. More... | |
override int | GetHashCode () |
Calculates the hash code for this instance. More... | |
override bool | Equals (object obj) |
Compares this instance with another. More... | |
override string | ToString () |
Returns a System.String that desrcibes this instance. More... | |
Properties | |
AlcError | CurrentError [get] |
Returns the ALC error code for this instance. More... | |
bool | IsProcessing [get, set] |
Gets a System.Boolean indicating whether the AudioContext is currently processing audio events. More... | |
bool | IsSynchronized [get, set] |
Gets a System.Boolean indicating whether the AudioContext is synchronized. More... | |
string | CurrentDevice [get] |
Gets a System.String with the name of the device used in this context. More... | |
static AudioContext | CurrentContext [get] |
Gets the OpenTK.Audio.AudioContext which is current in the application. More... | |
static IList< string > | AvailableDevices [get] |
Returns a list of strings containing all known playback devices. More... | |
static string | DefaultDevice [get] |
Returns the name of the device that will be used as playback default. More... | |
Provides methods to instantiate, use and destroy an audio context for playback. Static methods are provided to list available devices known by the driver.
enum OpenTK.Audio.AudioContext.MaxAuxiliarySends : int |
OpenTK.Audio.AudioContext.AudioContext | ( | ) |
Constructs a new AudioContext, using the default audio device.
OpenTK.Audio.AudioContext.AudioContext | ( | string | device | ) |
Constructs a new AudioContext instance.
device | The device name that will host this instance. |
OpenTK.Audio.AudioContext.AudioContext | ( | string | device, |
int | freq | ||
) |
Constructs a new AudioContext, using the specified audio device and device parameters.
device | The name of the audio device to use. |
freq | Frequency for mixing output buffer, in units of Hz. Pass 0 for driver default. |
Use AudioContext.AvailableDevices to obtain a list of all available audio devices. devices.
OpenTK.Audio.AudioContext.AudioContext | ( | string | device, |
int | freq, | ||
int | refresh | ||
) |
Constructs a new AudioContext, using the specified audio device and device parameters.
device | The name of the audio device to use. |
freq | Frequency for mixing output buffer, in units of Hz. Pass 0 for driver default. |
refresh | Refresh intervals, in units of Hz. Pass 0 for driver default. |
Use AudioContext.AvailableDevices to obtain a list of all available audio devices. devices.
OpenTK.Audio.AudioContext.AudioContext | ( | string | device, |
int | freq, | ||
int | refresh, | ||
bool | sync | ||
) |
Constructs a new AudioContext, using the specified audio device and device parameters.
device | The name of the audio device to use. |
freq | Frequency for mixing output buffer, in units of Hz. Pass 0 for driver default. |
refresh | Refresh intervals, in units of Hz. Pass 0 for driver default. |
sync | Flag, indicating a synchronous context. |
Use AudioContext.AvailableDevices to obtain a list of all available audio devices. devices.
OpenTK.Audio.AudioContext.AudioContext | ( | string | device, |
int | freq, | ||
int | refresh, | ||
bool | sync, | ||
bool | enableEfx | ||
) |
Creates the audio context using the specified device and device parameters.
device | The device descriptor obtained through AudioContext.AvailableDevices. |
freq | Frequency for mixing output buffer, in units of Hz. Pass 0 for driver default. |
refresh | Refresh intervals, in units of Hz. Pass 0 for driver default. |
sync | Flag, indicating a synchronous context. |
enableEfx | Indicates whether the EFX extension should be initialized, if present. |
ArgumentNullException | Occurs when the device string is invalid. |
ArgumentOutOfRangeException | Occurs when a specified parameter is invalid. |
AudioDeviceException | Occurs when the specified device is not available, or is in use by another program. |
AudioContextException | Occurs when an audio context could not be created with the specified parameters. |
NotSupportedException | Occurs when an AudioContext already exists. |
For maximum compatibility, you are strongly recommended to use the default constructor.
Multiple AudioContexts are not supported at this point.
The number of auxilliary EFX sends depends on the audio hardware and drivers. Most Realtek devices, as well as the Creative SB Live!, support 1 auxilliary send. Creative's Audigy and X-Fi series support 4 sends. Values higher than supported will be clamped by the driver.
OpenTK.Audio.AudioContext.AudioContext | ( | string | device, |
int | freq, | ||
int | refresh, | ||
bool | sync, | ||
bool | enableEfx, | ||
MaxAuxiliarySends | efxMaxAuxSends | ||
) |
Creates the audio context using the specified device and device parameters.
device | The device descriptor obtained through AudioContext.AvailableDevices. |
freq | Frequency for mixing output buffer, in units of Hz. Pass 0 for driver default. |
refresh | Refresh intervals, in units of Hz. Pass 0 for driver default. |
sync | Flag, indicating a synchronous context. |
enableEfx | Indicates whether the EFX extension should be initialized, if present. |
efxMaxAuxSends | Requires EFX enabled. The number of desired Auxiliary Sends per source. |
ArgumentNullException | Occurs when the device string is invalid. |
ArgumentOutOfRangeException | Occurs when a specified parameter is invalid. |
AudioDeviceException | Occurs when the specified device is not available, or is in use by another program. |
AudioContextException | Occurs when an audio context could not be created with the specified parameters. |
NotSupportedException | Occurs when an AudioContext already exists. |
For maximum compatibility, you are strongly recommended to use the default constructor.
Multiple AudioContexts are not supported at this point.
The number of auxilliary EFX sends depends on the audio hardware and drivers. Most Realtek devices, as well as the Creative SB Live!, support 1 auxilliary send. Creative's Audigy and X-Fi series support 4 sends. Values higher than supported will be clamped by the driver.
void OpenTK.Audio.AudioContext.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.AudioContext.Dispose | ( | ) |
Disposes of the AudioContext, cleaning up all resources consumed by it.
override bool OpenTK.Audio.AudioContext.Equals | ( | object | obj | ) |
Compares this instance with another.
obj | The instance to compare to. |
override int OpenTK.Audio.AudioContext.GetHashCode | ( | ) |
Calculates the hash code for this instance.
void OpenTK.Audio.AudioContext.MakeCurrent | ( | ) |
Makes the AudioContext current in the calling thread.
ObjectDisposedException | Occurs if this function is called after the AudioContext has been disposed. |
AudioContextException | Occurs when the AudioContext could not be made current. |
Only one AudioContext can be current in the application at any time, regardless of the number of threads.
void OpenTK.Audio.AudioContext.Process | ( | ) |
Processes queued audio events.
If AudioContext.IsSynchronized is true, this function will resume the internal audio processing thread. If AudioContext.IsSynchronized is false, you will need to call this function multiple times per second to process audio events.
In some implementations this function may have no effect.
ObjectDisposedException | Occurs when this function is called after the AudioContext had been disposed. |
bool OpenTK.Audio.AudioContext.SupportsExtension | ( | string | extension | ) |
Checks whether the specified OpenAL extension is supported.
extension | The name of the extension to check (e.g. "ALC_EXT_EFX"). |
void OpenTK.Audio.AudioContext.Suspend | ( | ) |
Suspends processing of audio events.
To avoid audio artifacts when calling this function, set audio gain to zero before suspending an AudioContext.
In some implementations, it can be faster to suspend processing before changing AudioContext state.
In some implementations this function may have no effect.
ObjectDisposedException | Occurs when this function is called after the AudioContext had been disposed. |
override string OpenTK.Audio.AudioContext.ToString | ( | ) |
Returns a System.String that desrcibes this instance.
|
staticget |
Returns a list of strings containing all known playback devices.
|
staticget |
Gets the OpenTK.Audio.AudioContext which is current in the application.
Only one AudioContext can be current in the application at any time, regardless of the number of threads.
|
get |
Gets a System.String with the name of the device used in this context.
|
get |
Returns the ALC error code for this instance.
|
staticget |
Returns the name of the device that will be used as playback default.
|
getset |
Gets a System.Boolean indicating whether the AudioContext is currently processing audio events.
|
getset |
Gets a System.Boolean indicating whether the AudioContext is synchronized.