C# Класс 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.
Наследование: IDisposable
Показать файл Открыть проект Примеры использования класса

Private Properties

Свойство Тип Описание
AudioContext System
CreateContext void
Dispose void
MakeCurrent void

Открытые методы

Метод Описание
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.

Приватные методы

Метод Описание
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.

Описание методов

AudioContext() публичный Метод

Constructs a new AudioContext instance.
public AudioContext ( string device ) : System
device string The device name that will host this instance.
Результат System

AudioContext() публичный Метод

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.
Результат System

AudioContext() публичный Метод

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.
Результат System

AudioContext() публичный Метод

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.
Результат System

AudioContext() публичный Метод

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.
Результат System

AudioContext() публичный Метод

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.
Результат System

CheckErrors() публичный Метод

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
Результат void

Dispose() публичный Метод

Disposes of the AudioContext, cleaning up all resources consumed by it.
public Dispose ( ) : void
Результат void

Equals() публичный Метод

Compares this instance with another.
public Equals ( object obj ) : bool
obj object The instance to compare to.
Результат bool

GetHashCode() публичный Метод

Calculates the hash code for this instance.
public GetHashCode ( ) : int
Результат int

MakeCurrent() публичный Метод

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
Результат void

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.

Occurs when this function is called after the AudioContext had been disposed.
public Process ( ) : void
Результат void

SupportsExtension() публичный Метод

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").
Результат bool

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.

Occurs when this function is called after the AudioContext had been disposed.
public Suspend ( ) : void
Результат void

ToString() публичный Метод

Returns a System.String that desrcibes this instance.
public ToString ( ) : string
Результат string