Merged openal-next branch (rev. 1969) to trunk. Tested with Audio-Info and Parrot examples and works as expected.

This commit is contained in:
Chrisbrandtner 2009-07-16 12:49:24 +00:00
parent 2a96551355
commit c41c81613d
7 changed files with 283 additions and 246 deletions

View file

@ -16,7 +16,8 @@ using OpenTK.Audio;
namespace OpenTK.Audio namespace OpenTK.Audio
{ {
/// <summary> /// <summary>
/// Provides methods to create and use an audio context. /// Provides methods to instantiate, use and destroy an audio context for playback.
/// Static methods are provided to list available devices known by the driver.
/// </summary> /// </summary>
public sealed class AudioContext : IDisposable public sealed class AudioContext : IDisposable
{ {
@ -30,16 +31,7 @@ namespace OpenTK.Audio
string device_name; string device_name;
static object audio_context_lock = new object(); static object audio_context_lock = new object();
static List<string> available_devices = new List<string>();
static Dictionary<ContextHandle, AudioContext> available_contexts = new Dictionary<ContextHandle, AudioContext>(); static Dictionary<ContextHandle, AudioContext> available_contexts = new Dictionary<ContextHandle, AudioContext>();
static bool openal_supported = true;
static Version version;
private enum Version
{
OpenAL10,
OpenAL11
}
#endregion #endregion
@ -54,28 +46,23 @@ namespace OpenTK.Audio
/// </summary> /// </summary>
static AudioContext() static AudioContext()
{ {
LoadAvailableDevices(); if (AudioDeviceEnumerator.IsOpenALSupported) // forces enumeration
{ }
} }
#endregion #endregion static AudioContext()
#region public AudioContext() #region public AudioContext()
/// <summary>Constructs a new AudioContext, using the default audio device.</summary> /// <summary>Constructs a new AudioContext, using the default audio device.</summary>
public AudioContext() public AudioContext()
: this(null, 0, 0, false, true) { } : this(null, 0, 0, false, true, MaxAuxiliarySends.UseDriverDefault) { }
#endregion #endregion
#region public AudioContext(string device) #region public AudioContext(string device)
/// <summary>Constructs a new AudioContext, using the specified audio device.</summary> public AudioContext(string device) : this(device, 0, 0, false, true, MaxAuxiliarySends.UseDriverDefault) { }
/// <param name="device">The name of the audio device to use.</param>
/// <remarks>
/// Use AudioContext.AvailableDevices to obtain a list of all available audio devices.
/// devices.
/// </remarks>
public AudioContext(string device) : this(device, 0, 0, false, true) { }
#endregion #endregion
@ -88,7 +75,7 @@ namespace OpenTK.Audio
/// Use AudioContext.AvailableDevices to obtain a list of all available audio devices. /// Use AudioContext.AvailableDevices to obtain a list of all available audio devices.
/// devices. /// devices.
/// </remarks> /// </remarks>
public AudioContext(string device, int freq) : this(device, freq, 0, false, true) { } public AudioContext(string device, int freq) : this(device, freq, 0, false, true, MaxAuxiliarySends.UseDriverDefault) { }
#endregion #endregion
@ -103,11 +90,11 @@ namespace OpenTK.Audio
/// devices. /// devices.
/// </remarks> /// </remarks>
public AudioContext(string device, int freq, int refresh) public AudioContext(string device, int freq, int refresh)
: this(device, freq, refresh, false, true) { } : this(device, freq, refresh, false, true, MaxAuxiliarySends.UseDriverDefault) { }
#endregion #endregion
#region public AudioContext(string device) #region public AudioContext(string device, int freq, int refresh, bool sync)
/// <summary>Constructs a new AudioContext, using the specified audio device and device parameters.</summary> /// <summary>Constructs a new AudioContext, using the specified audio device and device parameters.</summary>
/// <param name="device">The name of the audio device to use.</param> /// <param name="device">The name of the audio device to use.</param>
@ -119,7 +106,7 @@ namespace OpenTK.Audio
/// devices. /// devices.
/// </remarks> /// </remarks>
public AudioContext(string device, int freq, int refresh, bool sync) public AudioContext(string device, int freq, int refresh, bool sync)
: this(available_devices[0], freq, refresh, sync, true) { } : this(AudioDeviceEnumerator.AvailablePlaybackDevices[0], freq, refresh, sync, true) { }
#endregion #endregion
@ -152,75 +139,22 @@ namespace OpenTK.Audio
/// </remarks> /// </remarks>
public AudioContext(string device, int freq, int refresh, bool sync, bool enableEfx) public AudioContext(string device, int freq, int refresh, bool sync, bool enableEfx)
{ {
CreateContext(device, freq, refresh, sync, enableEfx); CreateContext(device, freq, refresh, sync, enableEfx, MaxAuxiliarySends.UseDriverDefault);
} }
#endregion #endregion
#endregion #region public AudioContext(string device, int freq, int refresh, bool sync, bool enableEfx, MaxAuxiliarySends efxMaxAuxSends)
#region --- Private Methods --- /// <summary>Creates the audio context using the specified device and device parameters.</summary>
/// <param name="device">The device descriptor obtained through AudioContext.AvailableDevices.</param>
#region static void LoadAvailableDevices()
/// <private />
/// <static />
/// <summary>
/// Loads all available audio devices into the available_devices array.
/// </summary>
/// <remarks>
/// Only called by the static AudioContext constructor.
/// </remarks>
static void LoadAvailableDevices()
{
lock (audio_context_lock)
{
if (available_devices.Count == 0)
{
try
{
Debug.WriteLine("Enumerating audio devices.");
Debug.Indent();
if (Alc.IsExtensionPresent(IntPtr.Zero, "ALC_ENUMERATION_EXT"))
{
version = Version.OpenAL11;
available_devices.AddRange(Alc.GetString(IntPtr.Zero, AlcGetStringList.DeviceSpecifier));
}
else
{
version = Version.OpenAL10;
Debug.Print("Device enumeration extension not available. Failed to enumerate devices.");
}
foreach (string s in available_devices)
Debug.WriteLine(s);
}
catch (DllNotFoundException e)
{
Debug.WriteLine(e.ToString());
openal_supported = false;
}
finally
{
Debug.Unindent();
}
}
}
}
#endregion
#region CreateContext
/// <private />
/// <summary>Creates the audio context using the specified device.</summary>
/// <param name="device">The device descriptor obtained through AudioContext.AvailableDevices, or null for the default device.</param>
/// <param name="freq">Frequency for mixing output buffer, in units of Hz. Pass 0 for driver default.</param> /// <param name="freq">Frequency for mixing output buffer, in units of Hz. Pass 0 for driver default.</param>
/// <param name="refresh">Refresh intervals, in units of Hz. Pass 0 for driver default.</param> /// <param name="refresh">Refresh intervals, in units of Hz. Pass 0 for driver default.</param>
/// <param name="sync">Flag, indicating a synchronous context.</param> /// <param name="sync">Flag, indicating a synchronous context.</param>
/// <param name="enableEfx">Indicates whether the EFX extension should be initialized, if present.</param> /// <param name="enableEfx">Indicates whether the EFX extension should be initialized, if present.</param>
/// /// <exception cref="ArgumentOutOfRangeException">Occurs when a specified parameter is invalid.</exception> /// <param name="efxMaxAuxSends">Requires EFX enabled. The number of desired Auxiliary Sends per source.</param>
/// <exception cref="ArgumentNullException">Occurs when the device string is invalid.</exception>
/// <exception cref="ArgumentOutOfRangeException">Occurs when a specified parameter is invalid.</exception>
/// <exception cref="AudioDeviceException"> /// <exception cref="AudioDeviceException">
/// Occurs when the specified device is not available, or is in use by another program. /// Occurs when the specified device is not available, or is in use by another program.
/// </exception> /// </exception>
@ -238,28 +172,93 @@ namespace OpenTK.Audio
/// Values higher than supported will be clamped by the driver. /// Values higher than supported will be clamped by the driver.
/// </para> /// </para>
/// </remarks> /// </remarks>
void CreateContext(string device, int freq, int refresh, bool sync, bool enableEfx) public AudioContext(string device, int freq, int refresh, bool sync, bool enableEfx, MaxAuxiliarySends efxMaxAuxSends)
{ {
if (!openal_supported) CreateContext(device, freq, refresh, sync, enableEfx, efxMaxAuxSends);
}
#endregion
#endregion --- Constructors ---
#region --- Private Methods ---
#region CreateContext
/// <summary>May be passed at context construction time to indicate the number of desired auxiliary effect slot sends per source.</summary>
public enum MaxAuxiliarySends:int
{
/// <summary>Will chose a reliably working parameter.</summary>
UseDriverDefault = 0,
/// <summary>One send per source.</summary>
One = 1,
/// <summary>Two sends per source.</summary>
Two = 2,
/// <summary>Three sends per source.</summary>
Three = 3,
/// <summary>Four sends per source.</summary>
Four = 4,
}
/// <private />
/// <summary>Creates the audio context using the specified device.</summary>
/// <param name="device">The device descriptor obtained through AudioContext.AvailableDevices, or null for the default device.</param>
/// <param name="freq">Frequency for mixing output buffer, in units of Hz. Pass 0 for driver default.</param>
/// <param name="refresh">Refresh intervals, in units of Hz. Pass 0 for driver default.</param>
/// <param name="sync">Flag, indicating a synchronous context.</param>
/// <param name="enableEfx">Indicates whether the EFX extension should be initialized, if present.</param>
/// <param name="efxAuxiliarySends">Requires EFX enabled. The number of desired Auxiliary Sends per source.</param>
/// <exception cref="ArgumentOutOfRangeException">Occurs when a specified parameter is invalid.</exception>
/// <exception cref="AudioDeviceException">
/// Occurs when the specified device is not available, or is in use by another program.
/// </exception>
/// <exception cref="AudioContextException">
/// Occurs when an audio context could not be created with the specified parameters.
/// </exception>
/// <exception cref="NotSupportedException">
/// Occurs when an AudioContext already exists.</exception>
/// <remarks>
/// <para>For maximum compatibility, you are strongly recommended to use the default constructor.</para>
/// <para>Multiple AudioContexts are not supported at this point.</para>
/// <para>
/// 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.
/// </para>
/// </remarks>
void CreateContext(string device, int freq, int refresh, bool sync, bool enableEfx, MaxAuxiliarySends efxAuxiliarySends)
{
if (!AudioDeviceEnumerator.IsOpenALSupported)
throw new DllNotFoundException("openal32.dll"); throw new DllNotFoundException("openal32.dll");
if (version == Version.OpenAL11 && available_devices.Count == 0) // Version.OpenAL10 does not support device enumeration. if (AudioDeviceEnumerator.Version == AudioDeviceEnumerator.AlcVersion.Alc1_1 && AudioDeviceEnumerator.AvailablePlaybackDevices.Count == 0) // Alc 1.0 does not support device enumeration.
throw new NotSupportedException("No audio hardware is available."); throw new NotSupportedException("No audio hardware is available.");
if (context_exists) throw new NotSupportedException("Multiple AudioContexts are not supported."); if (context_exists) throw new NotSupportedException("Multiple AudioContexts are not supported.");
if (freq < 0) throw new ArgumentOutOfRangeException("freq", freq, "Should be greater than zero."); if (freq < 0) throw new ArgumentOutOfRangeException("freq", freq, "Should be greater than zero.");
if (refresh < 0) throw new ArgumentOutOfRangeException("refresh", refresh, "Should be greater than zero."); if (refresh < 0) throw new ArgumentOutOfRangeException("refresh", refresh, "Should be greater than zero.");
if (!String.IsNullOrEmpty(device)) if (!String.IsNullOrEmpty(device))
device_handle = Alc.OpenDevice(device); {
device_name = device;
device_handle = Alc.OpenDevice(device); // try to open device by name
}
if (device_handle == IntPtr.Zero) if (device_handle == IntPtr.Zero)
device_handle = Alc.OpenDevice(null); {
device_name = "IntPtr.Zero (null string)";
device_handle = Alc.OpenDevice(null); // try to open unnamed default device
}
if (device_handle == IntPtr.Zero) if (device_handle == IntPtr.Zero)
Alc.OpenDevice(Alc.GetString(IntPtr.Zero, AlcGetString.DefaultDeviceSpecifier)); {
if (device_handle == IntPtr.Zero && available_devices.Count > 0) device_name = AudioContext.Default;
device_handle = Alc.OpenDevice(available_devices[0]); device_handle = Alc.OpenDevice(AudioContext.Default); // try to open named default device
}
if (device_handle == IntPtr.Zero) if (device_handle == IntPtr.Zero)
{
device_name = "None";
throw new AudioDeviceException(String.Format("Audio device '{0}' does not exist or is tied up by another application.", throw new AudioDeviceException(String.Format("Audio device '{0}' does not exist or is tied up by another application.",
String.IsNullOrEmpty(device) ? "default" : device)); String.IsNullOrEmpty(device) ? "default" : device));
}
CheckForAlcErrors(); CheckForAlcErrors();
@ -284,7 +283,20 @@ namespace OpenTK.Audio
if (enableEfx && Alc.IsExtensionPresent(device_handle, "ALC_EXT_EFX")) if (enableEfx && Alc.IsExtensionPresent(device_handle, "ALC_EXT_EFX"))
{ {
int num_slots; int num_slots;
Alc.GetInteger(device_handle, AlcGetInteger.EfxMaxAuxiliarySends, 1, out num_slots); switch (efxAuxiliarySends)
{
case MaxAuxiliarySends.One:
case MaxAuxiliarySends.Two:
case MaxAuxiliarySends.Three:
case MaxAuxiliarySends.Four:
num_slots = (int)efxAuxiliarySends;
break;
default:
case MaxAuxiliarySends.UseDriverDefault:
Alc.GetInteger(device_handle, AlcGetInteger.EfxMaxAuxiliarySends, 1, out num_slots);
break;
}
attributes.Add((int)AlcContextAttributes.EfxMaxAuxiliarySends); attributes.Add((int)AlcContextAttributes.EfxMaxAuxiliarySends);
attributes.Add(num_slots); attributes.Add(num_slots);
} }
@ -303,7 +315,7 @@ namespace OpenTK.Audio
// HACK: OpenAL SI on Linux/ALSA crashes on MakeCurrent. This hack avoids calling MakeCurrent when // HACK: OpenAL SI on Linux/ALSA crashes on MakeCurrent. This hack avoids calling MakeCurrent when
// an old OpenAL version is detect - it may affect outdated OpenAL versions different than OpenAL SI, // an old OpenAL version is detect - it may affect outdated OpenAL versions different than OpenAL SI,
// but it looks like a good compromise for now. // but it looks like a good compromise for now.
if (available_devices.Count > 0) if (AudioDeviceEnumerator.AvailablePlaybackDevices.Count > 0)
MakeCurrent(); MakeCurrent();
CheckForAlcErrors(); CheckForAlcErrors();
@ -331,7 +343,7 @@ namespace OpenTK.Audio
} }
} }
#endregion #endregion --- Private Methods ---
#region void CheckForAlcErrors() #region void CheckForAlcErrors()
@ -339,7 +351,7 @@ namespace OpenTK.Audio
{ {
AlcError err = Alc.GetError(device_handle); AlcError err = Alc.GetError(device_handle);
if (err != AlcError.NoError) if (err != AlcError.NoError)
throw new AudioContextException(err.ToString()); throw new AudioContextException("Device (" + device_handle + ") " + err.ToString());
} }
#endregion #endregion
@ -411,7 +423,7 @@ namespace OpenTK.Audio
#region --- Public Members --- #region --- Public Members ---
#region internal void MakeCurrent() #region public void MakeCurrent()
/// <summary>Makes the AudioContext current in the calling thread.</summary> /// <summary>Makes the AudioContext current in the calling thread.</summary>
/// <exception cref="ObjectDisposedException"> /// <exception cref="ObjectDisposedException">
@ -568,25 +580,54 @@ namespace OpenTK.Audio
#endregion #endregion
#region public static string[] AvailableDevices #region public static IList<string> AvailableDevices
/// <summary>Returns a list of strings containing all known playback devices.</summary>
/// <summary> public static IList<string> AvailableDevices
/// Gets a System.String array containing all available audio devices.
/// </summary>
/// <remarks>This property allocates memory.</remarks>
public static string[] AvailableDevices
{ {
get get
{ {
if (available_devices.Count == 0) return AudioDeviceEnumerator.AvailablePlaybackDevices;
LoadAvailableDevices();
return available_devices.ToArray();
} }
} }
#endregion public static IList<string> AvailablePlaybackDevices
#endregion #region public static string Default
/// <summary>Returns the name of the device that will be used as playback default.</summary>
public static string Default
{
get
{
return AudioDeviceEnumerator.DefaultPlaybackDevice;
}
}
#endregion public static string DefaultPlaybackDevice
#endregion #region public string CurrentDeviceName
/// <summary>Returns the name of the used device for the current context.</summary>
public string CurrentDeviceName
{
get
{
return device_name;
}
}
#endregion public string CurrentDeviceName
#region public AlcError CurrentAlcError
/// <summary>Returns the first encountered error by Alc for this device.</summary>
public AlcError CurrentAlcError
{
get
{
if (disposed)
throw new ObjectDisposedException(this.ToString());
return Alc.GetError(this.device_handle);
}
}
#endregion public AlcError CurrentAlcError
#endregion --- Public Members ---
#region --- IDisposable Members --- #region --- IDisposable Members ---

View file

@ -13,7 +13,7 @@ using System.Text;
namespace OpenTK.Audio namespace OpenTK.Audio
{ {
/// <summary>Represents exceptions related to an OpenTK.Audio.AudioContext.</summary> /// <summary>Represents exceptions related to an OpenTK.Audio.AudioContext.</summary>
public class AudioContextException : Exception public class AudioContextException : AudioException
{ {
/// <summary>Constructs a new AudioContextException.</summary> /// <summary>Constructs a new AudioContextException.</summary>
public AudioContextException() : base() { } public AudioContextException() : base() { }

View file

@ -11,6 +11,7 @@ using System;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using System.Security; using System.Security;
using OpenTK;
/* Type Mapping /* Type Mapping
// 8-bit boolean // 8-bit boolean
@ -64,15 +65,13 @@ typedef void ALvoid;
namespace OpenTK.Audio namespace OpenTK.Audio
{ {
/// <summary>
/// Provides access to the OpenAL flat API.
/// </summary>
public static partial class AL public static partial class AL
{ {
#region Constants #region Constants
internal const string Lib = "openal32.dll"; public const string Lib = "openal32.dll";
const CallingConvention Style = CallingConvention.Cdecl; private const CallingConvention Style = CallingConvention.Cdecl;
#endregion Constants #endregion Constants

View file

@ -216,17 +216,98 @@ namespace OpenTK.Audio
///<summary>Sound samples: Format specifier.</summary> ///<summary>Sound samples: Format specifier.</summary>
public enum ALFormat : int public enum ALFormat : int
{ {
///<summary>1 Channel, 8 Bits.</summary> ///<summary>1 Channel, 8 Bits per sample.</summary>
Mono8 = 0x1100, Mono8 = 0x1100,
///<summary>1 Channel, 16 Bits.</summary> ///<summary>1 Channel, 16 Bits per sample.</summary>
Mono16 = 0x1101, Mono16 = 0x1101,
///<summary>2 Channels, 8 Bits each.</summary> ///<summary>2 Channels, 8 Bits per sample each.</summary>
Stereo8 = 0x1102, Stereo8 = 0x1102,
///<summary>2 Channels, 16 Bits each.</summary> ///<summary>2 Channels, 16 Bits per sample each.</summary>
Stereo16 = 0x1103, Stereo16 = 0x1103,
/// <summary>1 Channel, A-law encoded data. Requires Extension: AL_EXT_ALAW</summary>
MonoALawExt = 0x10016,
/// <summary>2 Channels, A-law encoded data. Requires Extension: AL_EXT_ALAW</summary>
StereoALawExt = 0x10017,
/// <summary>1 Channel, µ-law encoded data. Requires Extension: AL_EXT_MULAW</summary>
MonoMuLawExt = 0x10014,
/// <summary>2 Channels, µ-law encoded data. Requires Extension: AL_EXT_MULAW</summary>
StereoMuLawExt = 0x10015,
/// <summary>Ogg Vorbis encoded data. Requires Extension: AL_EXT_vorbis</summary>
VorbisExt = 0x10003,
/// <summary>MP3 encoded data. Requires Extension: AL_EXT_mp3</summary>
Mp3Ext = 0x10020,
/// <summary>1 Channel, IMA4 ADPCM encoded data. Requires Extension: AL_EXT_IMA4</summary>
MonoIma4Ext = 0x1300,
/// <summary>2 Channels, IMA4 ADPCM encoded data. Requires Extension: AL_EXT_IMA4</summary>
StereoIma4Ext = 0x1301,
/// <summary>1 Channel, single-precision floating-point data. Requires Extension: AL_EXT_float32</summary>
MonoFloat32Ext = 0x10010,
/// <summary>2 Channels, single-precision floating-point data. Requires Extension: AL_EXT_float32</summary>
StereoFloat32Ext = 0x10011,
/// <summary>1 Channel, double-precision floating-point data. Requires Extension: AL_EXT_double</summary>
MonoDoubleExt = 0x10012,
/// <summary>2 Channels, double-precision floating-point data. Requires Extension: AL_EXT_double</summary>
StereoDoubleExt = 0x10013,
/// <summary>Multichannel 5.1, 16 Bits data. Requires Extension: AL_EXT_MCFORMATS</summary>
Multi51Chn16Ext = 0x120B,
/// <summary>Multichannel 5.1, 32 Bits data. Requires Extension: AL_EXT_MCFORMATS</summary>
Multi51Chn32Ext = 0x120C,
/// <summary>Multichannel 5.1, 8 Bits data. Requires Extension: AL_EXT_MCFORMATS</summary>
Multi51Chn8Ext = 0x120A,
/// <summary>Multichannel 6.1, 16 Bits data. Requires Extension: AL_EXT_MCFORMATS</summary>
Multi61Chn16Ext = 0x120E,
/// <summary>Multichannel 6.1, 32 Bits data. Requires Extension: AL_EXT_MCFORMATS</summary>
Multi61Chn32Ext = 0x120F,
/// <summary>Multichannel 6.1, 8 Bits data. Requires Extension: AL_EXT_MCFORMATS</summary>
Multi61Chn8Ext = 0x120D,
/// <summary>Multichannel 7.1, 16 Bits data. Requires Extension: AL_EXT_MCFORMATS</summary>
Multi71Chn16Ext = 0x1211,
/// <summary>Multichannel 7.1, 32 Bits data. Requires Extension: AL_EXT_MCFORMATS</summary>
Multi71Chn32Ext = 0x1212,
/// <summary>Multichannel 7.1, 8 Bits data. Requires Extension: AL_EXT_MCFORMATS</summary>
Multi71Chn8Ext = 0x1210,
/// <summary>Multichannel 4.0, 16 Bits data. Requires Extension: AL_EXT_MCFORMATS</summary>
MultiQuad16Ext = 0x1205,
/// <summary>Multichannel 4.0, 32 Bits data. Requires Extension: AL_EXT_MCFORMATS</summary>
MultiQuad32Ext = 0x1206,
/// <summary>Multichannel 4.0, 8 Bits data. Requires Extension: AL_EXT_MCFORMATS</summary>
MultiQuad8Ext = 0x1204,
/// <summary>1 Channel rear speaker, 16 Bits data. See Quadrophonic setups. Requires Extension: AL_EXT_MCFORMATS</summary>
MultiRear16Ext = 0x1208,
/// <summary>1 Channel rear speaker, 32 Bits data. See Quadrophonic setups. Requires Extension: AL_EXT_MCFORMATS</summary>
MultiRear32Ext = 0x1209,
/// <summary>1 Channel rear speaker, 8 Bits data. See Quadrophonic setups. Requires Extension: AL_EXT_MCFORMATS</summary>
MultiRear8Ext = 0x1207,
} }
///<summary>A list of valid Int32 GetBuffer parameters</summary> ///<summary>A list of valid Int32 GetBuffer parameters</summary>

View file

@ -226,125 +226,35 @@ namespace OpenTK.Audio
///<summary>Vocal morpher effect parameters. If both parameters are set to the same phoneme, that determines the filtering effect that will be heard. If these two parameters are set to different phonemes, the filtering effect will morph between the two settings at a rate specified by EfxEffectf.VocalMorpherRate.</summary> ///<summary>Vocal morpher effect parameters. If both parameters are set to the same phoneme, that determines the filtering effect that will be heard. If these two parameters are set to different phonemes, the filtering effect will morph between the two settings at a rate specified by EfxEffectf.VocalMorpherRate.</summary>
public enum EfxFormantFilterSettings : int public enum EfxFormantFilterSettings : int
{ {
/// <summary>
/// Phoneme A of the vocal morpher.
/// </summary>
VocalMorpherPhonemeA = 0, VocalMorpherPhonemeA = 0,
/// <summary>
/// Phoneme E of the vocal morpher.
/// </summary>
VocalMorpherPhonemeE = 1, VocalMorpherPhonemeE = 1,
/// <summary>
/// Phoneme I of the vocal morpher.
/// </summary>
VocalMorpherPhonemeI = 2, VocalMorpherPhonemeI = 2,
/// <summary>
/// Phoneme O of the vocal morpher.
/// </summary>
VocalMorpherPhonemeO = 3, VocalMorpherPhonemeO = 3,
/// <summary>
/// Phoneme U of the vocal morpher.
/// </summary>
VocalMorpherPhonemeU = 4, VocalMorpherPhonemeU = 4,
/// <summary>
/// Phoneme AA of the vocal morpher.
/// </summary>
VocalMorpherPhonemeAA = 5, VocalMorpherPhonemeAA = 5,
/// <summary>
/// Phoneme AE of the vocal morpher.
/// </summary>
VocalMorpherPhonemeAE = 6, VocalMorpherPhonemeAE = 6,
/// <summary>
/// Phoneme AH of the vocal morpher.
/// </summary>
VocalMorpherPhonemeAH = 7, VocalMorpherPhonemeAH = 7,
/// <summary>
/// Phoneme AO of the vocal morpher.
/// </summary>
VocalMorpherPhonemeAO = 8, VocalMorpherPhonemeAO = 8,
/// <summary>
/// Phoneme EH of the vocal morpher.
/// </summary>
VocalMorpherPhonemeEH = 9, VocalMorpherPhonemeEH = 9,
/// <summary>
/// Phoneme ER of the vocal morpher.
/// </summary>
VocalMorpherPhonemeER = 10, VocalMorpherPhonemeER = 10,
/// <summary>
/// Phoneme IH of the vocal morpher.
/// </summary>
VocalMorpherPhonemeIH = 11, VocalMorpherPhonemeIH = 11,
/// <summary>
/// Phoneme IY of the vocal morpher.
/// </summary>
VocalMorpherPhonemeIY = 12, VocalMorpherPhonemeIY = 12,
/// <summary>
/// Phoneme UH of the vocal morpher.
/// </summary>
VocalMorpherPhonemeUH = 13, VocalMorpherPhonemeUH = 13,
/// <summary>
/// Phoneme UW of the vocal morpher.
/// </summary>
VocalMorpherPhonemeUW = 14, VocalMorpherPhonemeUW = 14,
/// <summary>
/// Phoneme B of the vocal morpher.
/// </summary>
VocalMorpherPhonemeB = 15, VocalMorpherPhonemeB = 15,
/// <summary>
/// Phoneme D of the vocal morpher.
/// </summary>
VocalMorpherPhonemeD = 16, VocalMorpherPhonemeD = 16,
/// <summary>
/// Phoneme F of the vocal morpher.
/// </summary>
VocalMorpherPhonemeF = 17, VocalMorpherPhonemeF = 17,
/// <summary>
/// Phoneme G of the vocal morpher.
/// </summary>
VocalMorpherPhonemeG = 18, VocalMorpherPhonemeG = 18,
/// <summary>
/// Phoneme J of the vocal morpher.
/// </summary>
VocalMorpherPhonemeJ = 19, VocalMorpherPhonemeJ = 19,
/// <summary>
/// Phoneme K of the vocal morpher.
/// </summary>
VocalMorpherPhonemeK = 20, VocalMorpherPhonemeK = 20,
/// <summary>
/// Phoneme L of the vocal morpher.
/// </summary>
VocalMorpherPhonemeL = 21, VocalMorpherPhonemeL = 21,
/// <summary>
/// Phoneme M of the vocal morpher.
/// </summary>
VocalMorpherPhonemeM = 22, VocalMorpherPhonemeM = 22,
/// <summary>
/// Phoneme N of the vocal morpher.
/// </summary>
VocalMorpherPhonemeN = 23, VocalMorpherPhonemeN = 23,
/// <summary>
/// Phoneme P of the vocal morpher.
/// </summary>
VocalMorpherPhonemeP = 24, VocalMorpherPhonemeP = 24,
/// <summary>
/// Phoneme R of the vocal morpher.
/// </summary>
VocalMorpherPhonemeR = 25, VocalMorpherPhonemeR = 25,
/// <summary>
/// Phoneme S of the vocal morpher.
/// </summary>
VocalMorpherPhonemeS = 26, VocalMorpherPhonemeS = 26,
/// <summary>
/// Phoneme T of the vocal morpher.
/// </summary>
VocalMorpherPhonemeT = 27, VocalMorpherPhonemeT = 27,
/// <summary>
/// Phoneme V of the vocal morpher.
/// </summary>
VocalMorpherPhonemeV = 28, VocalMorpherPhonemeV = 28,
/// <summary>
/// Phoneme Z of the vocal morpher.
/// </summary>
VocalMorpherPhonemeZ = 29, VocalMorpherPhonemeZ = 29,
} }

View file

@ -101,15 +101,21 @@ namespace OpenTK.Audio
#region Public Methods #region Public Methods
/// <summary>Query total amount of X-RAM in bytes.</summary> /// <summary>Query total amount of X-RAM in bytes.</summary>
public int GetRamSize() public int GetRamSize
{ {
return AL.Get((ALGetInteger)AL_EAX_RAM_SIZE); get
{
return AL.Get((ALGetInteger)AL_EAX_RAM_SIZE);
}
} }
/// <summary>Query free X-RAM available in bytes.</summary> /// <summary>Query free X-RAM available in bytes.</summary>
public int GetRamFree() public int GetRamFree
{ {
return AL.Get((ALGetInteger)AL_EAX_RAM_FREE); get
{
return AL.Get((ALGetInteger)AL_EAX_RAM_FREE);
}
} }
/// <summary>This enum is used to abstract the need of using AL.GetEnumValue() with the Extension. The values do NOT correspond to AL_STORAGE_* tokens!</summary> /// <summary>This enum is used to abstract the need of using AL.GetEnumValue() with the Extension. The values do NOT correspond to AL_STORAGE_* tokens!</summary>

View file

@ -277,10 +277,10 @@ namespace OpenTK.Audio
#region Capture functions #region Capture functions
/// <summary>This function opens a capture device by name. </summary> /// <summary>This function opens a capture device by name. </summary>
/// <param name="devicename">a pointer to a device name string</param> /// <param name="devicename">a pointer to a device name string.</param>
/// <param name="frequency">the frequency that the buffer should be captured at</param> /// <param name="frequency">the frequency that the buffer should be captured at.</param>
/// <param name="format">the requested capture buffer format</param> /// <param name="format">the requested capture buffer format.</param>
/// <param name="buffersize">the size of the capture buffer in bytes</param> /// <param name="buffersize">the size of the capture buffer in samples, not bytes.</param>
/// <returns>Returns the capture device pointer, or NULL on failure.</returns> /// <returns>Returns the capture device pointer, or NULL on failure.</returns>
[CLSCompliant(false), DllImport(Alc.Lib, EntryPoint = "alcCaptureOpenDevice", ExactSpelling = true, CallingConvention = Alc.Style, CharSet = CharSet.Ansi), SuppressUnmanagedCodeSecurity()] [CLSCompliant(false), DllImport(Alc.Lib, EntryPoint = "alcCaptureOpenDevice", ExactSpelling = true, CallingConvention = Alc.Style, CharSet = CharSet.Ansi), SuppressUnmanagedCodeSecurity()]
public static extern IntPtr CaptureOpenDevice(string devicename, uint frequency, ALFormat format, int buffersize); public static extern IntPtr CaptureOpenDevice(string devicename, uint frequency, ALFormat format, int buffersize);