C# Class OpenTK.Audio.AudioContext

Provides methods to instantiate, use and destroy an audio context for playback. Static methods are provided to list available devices known by the driver.
Inheritance: IDisposable
Afficher le fichier Open project: hultqvist/opentk Class Usage Examples

Private Properties

Свойство Type Description
AudioContext System
CreateContext void
Dispose void
MakeCurrent void

Méthodes publiques

Méthode Description
AudioContext ( string device ) : System

Constructs a new AudioContext instance.

AudioContext ( string device, int freq ) : System

Constructs a new AudioContext, using the specified audio device and device parameters.

Use AudioContext.AvailableDevices to obtain a list of all available audio devices. devices.

AudioContext ( string device, int freq, int refresh ) : System

Constructs a new AudioContext, using the specified audio device and device parameters.

Use AudioContext.AvailableDevices to obtain a list of all available audio devices. devices.

AudioContext ( string device, int freq, int refresh, bool sync ) : System

Constructs a new AudioContext, using the specified audio device and device parameters.

Use AudioContext.AvailableDevices to obtain a list of all available audio devices. devices.

AudioContext ( string device, int freq, int refresh, bool sync, bool enableEfx ) : System

Creates the audio context using the specified device and device parameters.

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.

AudioContext ( string device, int freq, int refresh, bool sync, bool enableEfx, MaxAuxiliarySends efxMaxAuxSends ) : System

Creates the audio context using the specified device and device parameters.

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.

CheckErrors ( ) : void

Checks for ALC error conditions.

Dispose ( ) : void

Disposes of the AudioContext, cleaning up all resources consumed by it.

Equals ( object obj ) : bool

Compares this instance with another.

GetHashCode ( ) : int

Calculates the hash code for this instance.

MakeCurrent ( ) : void

Makes the AudioContext current in the calling thread.

Only one AudioContext can be current in the application at any time, regardless of the number of threads.

Process ( ) : void

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.

SupportsExtension ( string extension ) : bool

Checks whether the specified OpenAL extension is supported.

Suspend ( ) : void

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.

ToString ( ) : string

Returns a System.String that desrcibes this instance.

Private Methods

Méthode Description
AudioContext ( ) : System

Runs before the actual class constructor, to load available devices.

CreateContext ( string device, int freq, int refresh, bool sync, bool enableEfx, MaxAuxiliarySends efxAuxiliarySends ) : void

Creates the audio context using the specified device.

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.

Dispose ( bool manual ) : void
MakeCurrent ( AudioContext context ) : void

Makes the specified AudioContext current in the calling thread.

Method Details

AudioContext() public méthode

Constructs a new AudioContext instance.
public AudioContext ( string device ) : System
device string The device name that will host this instance.
Résultat System

AudioContext() public méthode

Constructs a new AudioContext, using the specified audio device and device parameters.
Use AudioContext.AvailableDevices to obtain a list of all available audio devices. devices.
public AudioContext ( string device, int freq ) : System
device string The name of the audio device to use.
freq int Frequency for mixing output buffer, in units of Hz. Pass 0 for driver default.
Résultat System

AudioContext() public méthode

Constructs a new AudioContext, using the specified audio device and device parameters.
Use AudioContext.AvailableDevices to obtain a list of all available audio devices. devices.
public AudioContext ( string device, int freq, int refresh ) : System
device string The name of the audio device to use.
freq int Frequency for mixing output buffer, in units of Hz. Pass 0 for driver default.
refresh int Refresh intervals, in units of Hz. Pass 0 for driver default.
Résultat System

AudioContext() public méthode

Constructs a new AudioContext, using the specified audio device and device parameters.
Use AudioContext.AvailableDevices to obtain a list of all available audio devices. devices.
public AudioContext ( string device, int freq, int refresh, bool sync ) : System
device string The name of the audio device to use.
freq int Frequency for mixing output buffer, in units of Hz. Pass 0 for driver default.
refresh int Refresh intervals, in units of Hz. Pass 0 for driver default.
sync bool Flag, indicating a synchronous context.
Résultat System

AudioContext() public méthode

Creates the audio context using the specified device and device parameters.

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.

Occurs when the device string is invalid. Occurs when a specified parameter is invalid. /// Occurs when the specified device is not available, or is in use by another program. /// /// Occurs when an audio context could not be created with the specified parameters. /// /// Occurs when an AudioContext already exists.
public AudioContext ( string device, int freq, int refresh, bool sync, bool enableEfx ) : System
device string The device descriptor obtained through AudioContext.AvailableDevices.
freq int Frequency for mixing output buffer, in units of Hz. Pass 0 for driver default.
refresh int Refresh intervals, in units of Hz. Pass 0 for driver default.
sync bool Flag, indicating a synchronous context.
enableEfx bool Indicates whether the EFX extension should be initialized, if present.
Résultat System

AudioContext() public méthode

Creates the audio context using the specified device and device parameters.

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.

Occurs when the device string is invalid. Occurs when a specified parameter is invalid. /// Occurs when the specified device is not available, or is in use by another program. /// /// Occurs when an audio context could not be created with the specified parameters. /// /// Occurs when an AudioContext already exists.
public AudioContext ( string device, int freq, int refresh, bool sync, bool enableEfx, MaxAuxiliarySends efxMaxAuxSends ) : System
device string The device descriptor obtained through AudioContext.AvailableDevices.
freq int Frequency for mixing output buffer, in units of Hz. Pass 0 for driver default.
refresh int Refresh intervals, in units of Hz. Pass 0 for driver default.
sync bool Flag, indicating a synchronous context.
enableEfx bool Indicates whether the EFX extension should be initialized, if present.
efxMaxAuxSends MaxAuxiliarySends Requires EFX enabled. The number of desired Auxiliary Sends per source.
Résultat System

CheckErrors() public méthode

Checks for ALC error conditions.
Raised when an out of memory error is detected. Raised when an invalid value is detected. Raised when an invalid device is detected. Raised when an invalid context is detected.
public CheckErrors ( ) : void
Résultat void

Dispose() public méthode

Disposes of the AudioContext, cleaning up all resources consumed by it.
public Dispose ( ) : void
Résultat void

Equals() public méthode

Compares this instance with another.
public Equals ( object obj ) : bool
obj object The instance to compare to.
Résultat bool

GetHashCode() public méthode

Calculates the hash code for this instance.
public GetHashCode ( ) : int
Résultat int

MakeCurrent() public méthode

Makes the AudioContext current in the calling thread.
Only one AudioContext can be current in the application at any time, regardless of the number of threads.
/// Occurs if this function is called after the AudioContext has been disposed. /// /// Occurs when the AudioContext could not be made current. ///
public MakeCurrent ( ) : void
Résultat void

Process() public méthode

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.

Occurs when this function is called after the AudioContext had been disposed.
public Process ( ) : void
Résultat void

SupportsExtension() public méthode

Checks whether the specified OpenAL extension is supported.
public SupportsExtension ( string extension ) : bool
extension string The name of the extension to check (e.g. "ALC_EXT_EFX").
Résultat bool

Suspend() public méthode

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.

Occurs when this function is called after the AudioContext had been disposed.
public Suspend ( ) : void
Résultat void

ToString() public méthode

Returns a System.String that desrcibes this instance.
public ToString ( ) : string
Résultat string