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...
Public Types | |
| enum | MaxAuxiliarySends { UseDriverDefault = 0, One = 1, Two = 2, Three = 3, 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. | |
| AudioContext (string device) | |
| Constructs a new AudioContext instance. | |
| AudioContext (string device, int freq) | |
| Constructs a new AudioContext, using the specified audio device and device parameters. | |
| AudioContext (string device, int freq, int refresh) | |
| Constructs a new AudioContext, using the specified audio device and device parameters. | |
| AudioContext (string device, int freq, int refresh, bool sync) | |
| Constructs a new AudioContext, using the specified audio device and device parameters. | |
| AudioContext (string device, int freq, int refresh, bool sync, bool enableEfx) | |
| Creates the audio context using the specified device and device parameters. | |
| AudioContext (string device, int freq, int refresh, bool sync, bool enableEfx, MaxAuxiliarySends efxMaxAuxSends) | |
| Creates the audio context using the specified device and device parameters. | |
| void | CheckErrors () |
| Checks for ALC error conditions. | |
| void | MakeCurrent () |
| Makes the AudioContext current in the calling thread. | |
| void | Process () |
| Processes queued audio events. | |
| void | Suspend () |
| Suspends processing of audio events. | |
| bool | SupportsExtension (string extension) |
| Checks whether the specified OpenAL extension is supported. | |
| void | Dispose () |
| Disposes of the AudioContext, cleaning up all resources consumed by it. | |
| override int | GetHashCode () |
| Calculates the hash code for this instance. | |
| override bool | Equals (object obj) |
| Compares this instance with another. | |
| override string | ToString () |
| Returns a System.String that desrcibes this instance. | |
Properties | |
| AlcError | CurrentError [get] |
| Returns the ALC error code for this instance. | |
| bool | IsProcessing [get, set] |
| Gets a System.Boolean indicating whether the AudioContext is currently processing audio events. | |
| bool | IsSynchronized [get, set] |
| Gets a System.Boolean indicating whether the AudioContext is synchronized. | |
| string | CurrentDevice [get] |
| Gets a System.String with the name of the device used in this context. | |
| static AudioContext | CurrentContext [get] |
| Gets the OpenTK.Audio.AudioContext which is current in the application. | |
| static IList< string > | AvailableDevices [get] |
| Returns a list of strings containing all known playback devices. | |
| static string | DefaultDevice [get] |
| Returns the name of the device that will be used as playback default. | |
Provides methods to instantiate, use and destroy an audio context for playback. Static methods are provided to list available devices known by the driver.
Definition at line 42 of file AudioContext.cs.
May be passed at context construction time to indicate the number of desired auxiliary effect slot sends per source.
| UseDriverDefault |
Will chose a reliably working parameter. |
| One |
One send per source. |
| Two |
Two sends per source. |
| Three |
Three sends per source. |
| Four |
Four sends per source. |
Definition at line 212 of file AudioContext.cs.
| OpenTK.Audio.AudioContext.AudioContext | ( | ) |
Constructs a new AudioContext, using the default audio device.
Definition at line 77 of file AudioContext.cs.
00078 : this(null, 0, 0, false, true, MaxAuxiliarySends.UseDriverDefault) { }
| OpenTK.Audio.AudioContext.AudioContext | ( | string | device | ) |
Constructs a new AudioContext instance.
| device | The device name that will host this instance. |
Definition at line 88 of file AudioContext.cs.
00088 : this(device, 0, 0, false, true, MaxAuxiliarySends.UseDriverDefault) { }
| 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.
Definition at line 101 of file AudioContext.cs.
00101 : this(device, freq, 0, false, true, MaxAuxiliarySends.UseDriverDefault) { }
| 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.
Definition at line 115 of file AudioContext.cs.
00116 : this(device, freq, refresh, false, true, MaxAuxiliarySends.UseDriverDefault) { }
| 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.
Definition at line 131 of file AudioContext.cs.
| 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.
Definition at line 163 of file AudioContext.cs.
00164 { 00165 CreateContext(device, freq, refresh, sync, enableEfx, MaxAuxiliarySends.UseDriverDefault); 00166 }
| 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.
Definition at line 198 of file AudioContext.cs.
| 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. |
Definition at line 434 of file AudioContext.cs.
| void OpenTK.Audio.AudioContext.Dispose | ( | ) |
Disposes of the AudioContext, cleaning up all resources consumed by it.
Definition at line 698 of file AudioContext.cs.
00699 { 00700 this.Dispose(true); 00701 GC.SuppressFinalize(this); 00702 }
| override bool OpenTK.Audio.AudioContext.Equals | ( | object | obj | ) |
Compares this instance with another.
| obj | The instance to compare to. |
Definition at line 753 of file AudioContext.cs.
| override int OpenTK.Audio.AudioContext.GetHashCode | ( | ) |
Calculates the hash code for this instance.
Definition at line 743 of file AudioContext.cs.
| 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.
Definition at line 475 of file AudioContext.cs.
| 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. |
Definition at line 548 of file AudioContext.cs.
00549 { 00550 if (disposed) 00551 throw new ObjectDisposedException(this.GetType().FullName); 00552 00553 Alc.ProcessContext(this.context_handle); 00554 IsProcessing = true; 00555 }
| 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"). |
Definition at line 599 of file AudioContext.cs.
| 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. |
Definition at line 581 of file AudioContext.cs.
00582 { 00583 if (disposed) 00584 throw new ObjectDisposedException(this.GetType().FullName); 00585 00586 Alc.SuspendContext(this.context_handle); 00587 IsProcessing = false; 00588 }
| override string OpenTK.Audio.AudioContext.ToString | ( | ) |
Returns a System.String that desrcibes this instance.
Definition at line 762 of file AudioContext.cs.
IList<string> OpenTK.Audio.AudioContext.AvailableDevices [static, get] |
Returns a list of strings containing all known playback devices.
Definition at line 668 of file AudioContext.cs.
AudioContext OpenTK.Audio.AudioContext.CurrentContext [static, get] |
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.
Definition at line 641 of file AudioContext.cs.
string OpenTK.Audio.AudioContext.CurrentDevice [get] |
Gets a System.String with the name of the device used in this context.
Definition at line 615 of file AudioContext.cs.
AlcError OpenTK.Audio.AudioContext.CurrentError [get] |
Returns the ALC error code for this instance.
Definition at line 450 of file AudioContext.cs.
string OpenTK.Audio.AudioContext.DefaultDevice [static, get] |
Returns the name of the device that will be used as playback default.
Definition at line 682 of file AudioContext.cs.
bool OpenTK.Audio.AudioContext.IsProcessing [get, set] |
Gets a System.Boolean indicating whether the AudioContext is currently processing audio events.
Definition at line 494 of file AudioContext.cs.
bool OpenTK.Audio.AudioContext.IsSynchronized [get, set] |
Gets a System.Boolean indicating whether the AudioContext is synchronized.
Definition at line 515 of file AudioContext.cs.
1.6.1