mirror of
https://github.com/Ryujinx/Opentk.git
synced 2025-01-12 20:55:37 +00:00
Merged with OpenAL branch.
This commit is contained in:
parent
3a786679af
commit
1f3288a50c
File diff suppressed because it is too large
Load diff
|
@ -3,269 +3,284 @@
|
|||
* C header: \OpenAL 1.1 SDK\include\Al.h
|
||||
* Spec: http://www.openal.org/openal_webstf/specs/OpenAL11Specification.pdf
|
||||
* Copyright (c) 2008 Christoph Brandtner and Stefanos Apostolopoulos
|
||||
* See license.txt for license details (MIT)
|
||||
* http://www.OpenTK.net
|
||||
*/
|
||||
|
||||
/* Version History:
|
||||
* 0.1
|
||||
* - Tokens AL_TRUE and AL_FALSE removed, created new type. see Al.Bool
|
||||
*
|
||||
*
|
||||
*/
|
||||
* See license.txt for license details
|
||||
* http://www.OpenTK.net */
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
|
||||
namespace OpenTK.OpenAL
|
||||
namespace OpenTK.OpenAL.Enums
|
||||
{
|
||||
public partial class Enums
|
||||
|
||||
public enum ALCapability : int
|
||||
{
|
||||
public enum AlCapability : int
|
||||
{
|
||||
///<summary>Currently no state toggles exist for vanilla OpenAL.</summary>
|
||||
Invalid = -1,
|
||||
}
|
||||
|
||||
public enum AlListenerf : int
|
||||
{
|
||||
///<summary>Indicate the gain (volume amplification) applied. Type: float. Range: [0.0f - ? ] A value of 1.0 means un-attenuated/unchanged. Each division by 2 equals an attenuation of -6dB. Each multiplicaton with 2 equals an amplification of +6dB. A value of 0.0f is meaningless with respect to a logarithmic scale; it is interpreted as zero volume - the channel is effectively disabled.</summary>
|
||||
Gain = 0x100A,
|
||||
}
|
||||
|
||||
public enum AlListener3f : int
|
||||
{
|
||||
///<summary>Specify the current location in three dimensional space. OpenAL, like OpenGL, uses a right handed coordinate system, where in a frontal default view X (thumb) points right, Y points up (index finger), and Z points towards the viewer/camera (middle finger). To switch from a left handed coordinate system, flip the sign on the Z coordinate. Listener position is always in the world coordinate system.</summary>
|
||||
Position = 0x1004,
|
||||
|
||||
///<summary>Specify the current velocity in three dimensional space.</summary>
|
||||
Velocity = 0x1006,
|
||||
}
|
||||
|
||||
public enum AlListenerfv : int
|
||||
{
|
||||
///<summary>Indicate Listener orientation. (at/up)</summary>
|
||||
Orientation = 0x100F,
|
||||
}
|
||||
|
||||
public enum AlSourcef : int
|
||||
{
|
||||
///<summary>Source specific reference distance. Type: float Range: [0.0f - float.PositiveInfinity] At 0.0f, no distance attenuation occurs. Default is 1.0.</summary>
|
||||
ReferenceDistance = 0x1020,
|
||||
|
||||
///<summary>Indicate distance above which Sources are not attenuated using the inverse clamped distance model. Default: float.PositiveInfinity Type: ALfloat Range: [0.0f - float.PositiveInfinity]</summary>
|
||||
MaxDistance = 0x1023,
|
||||
|
||||
///<summary>Source specific rolloff factor. Type: float Range: [0.0f - float.PositiveInfinity]</summary>
|
||||
RolloffFactor = 0x1021,
|
||||
|
||||
///<summary>Specify the pitch to be applied, either at Source, or on mixer results, at Listener. Range: [0.5f - 2.0f] Default: 1.0f</summary>
|
||||
Pitch = 0x1003,
|
||||
|
||||
///<summary>Indicate the gain (volume amplification) applied. Type: float. Range: [0.0f - ? ] A value of 1.0 means un-attenuated/unchanged. Each division by 2 equals an attenuation of -6dB. Each multiplicaton with 2 equals an amplification of +6dB. A value of 0.0f is meaningless with respect to a logarithmic scale; it is interpreted as zero volume - the channel is effectively disabled.</summary>
|
||||
Gain = 0x100A,
|
||||
|
||||
///<summary>Indicate minimum Source attenuation. Type: float Range: [0.0f - 1.0f] (Logarthmic)</summary>
|
||||
MinGain = 0x100D,
|
||||
|
||||
///<summary>Indicate maximum Source attenuation. Type: float Range: [0.0f - 1.0f] (Logarthmic)</summary>
|
||||
MaxGain = 0x100E,
|
||||
|
||||
///<summary>Directional Source, inner cone angle, in degrees. Range: [0-360] Default: 360</summary>
|
||||
ConeInnerAngle = 0x1001,
|
||||
|
||||
///<summary>Directional Source, outer cone angle, in degrees. Range: [0-360] Default: 360</summary>
|
||||
ConeOuterAngle = 0x1002,
|
||||
|
||||
///<summary>Directional Source, outer cone gain. Default: 0.0f Range: [0.0f - 1.0] (Logarithmic)</summary>
|
||||
ConeOuterGain = 0x1022,
|
||||
}
|
||||
|
||||
public enum AlSource3f : int
|
||||
{
|
||||
///<summary>Specify the current location in three dimensional space. OpenAL, like OpenGL, uses a right handed coordinate system, where in a frontal default view X (thumb) points right, Y points up (index finger), and Z points towards the viewer/camera (middle finger). To switch from a left handed coordinate system, flip the sign on the Z coordinate. Listener position is always in the world coordinate system.</summary>
|
||||
Position = 0x1004,
|
||||
|
||||
///<summary>Specify the current velocity in three dimensional space.</summary>
|
||||
Velocity = 0x1006,
|
||||
|
||||
///<summary>Specify the current direction.</summary>
|
||||
Direction = 0x1005,
|
||||
}
|
||||
|
||||
public enum AlSourcei : int
|
||||
{
|
||||
// Source Buffer position information
|
||||
MiliSecOffset = 0x1024, // AL_EXT_OFFSET extension.
|
||||
ByteOffset = 0x1026, // AL_EXT_OFFSET extension.
|
||||
SampleOffset = 0x1025, // AL_EXT_OFFSET extension.
|
||||
|
||||
///<summary>Indicate the Buffer to provide sound samples. Type: uint Range: any valid Buffer id.</summary>
|
||||
Buffer = 0x1009,
|
||||
}
|
||||
|
||||
public enum AlSourceBool : int
|
||||
{
|
||||
///<summary>Indicate Source has relative coordinates.</summary>
|
||||
SourceRelative = 0x202,
|
||||
|
||||
///<summary>Indicate whether Source is looping. Type: Alboolean Range: [True, False] Default: False.</summary>
|
||||
Looping = 0x1007,
|
||||
}
|
||||
|
||||
public enum AlSourceiGet : int
|
||||
{
|
||||
// Source Buffer position information
|
||||
MiliSecOffset = 0x1024, // AL_EXT_OFFSET extension.
|
||||
ByteOffset = 0x1026, // AL_EXT_OFFSET extension.
|
||||
SampleOffset = 0x1025, // AL_EXT_OFFSET extension.
|
||||
|
||||
///<summary>Indicate the Buffer to provide sound samples. Type: uint Range: any valid Buffer id.</summary>
|
||||
Buffer = 0x1009,
|
||||
|
||||
SourceState = 0x1010,
|
||||
BuffersQueued = 0x1015,
|
||||
BuffersProcessed = 0x1016,
|
||||
}
|
||||
|
||||
|
||||
public enum AlSourceParameterszzzzzzzzzzzzzzzzzz : int
|
||||
{
|
||||
|
||||
///<summary>Specify the channel mask. (Creative) Type: uint Range: [0 - 255]</summary>
|
||||
ChannelMask = 0x3000,
|
||||
}
|
||||
|
||||
///<summary>Source state information.</summary>
|
||||
public enum AlSourcestate : int
|
||||
{
|
||||
Initial = 0x1011,
|
||||
Playing = 0x1012,
|
||||
Paused = 0x1013,
|
||||
Stopped = 0x1014,
|
||||
}
|
||||
|
||||
// AL_EXT_OFFSET extension.
|
||||
public enum AlSourceBufferPos : int
|
||||
{
|
||||
|
||||
///<summary>Source type (Static, Streaming or undetermined)</summary>
|
||||
SourceType = 0x1027,
|
||||
}
|
||||
|
||||
///<summary>Source type (Static, Streaming or undetermined)</summary>
|
||||
public enum AlSourceType : int
|
||||
{
|
||||
///<summary>Source is Static if a Buffer has been attached using AL_Buffer</summary>
|
||||
Static = 0x1028,
|
||||
///<summary>Source is Streaming if one or more Buffers have been attached using alSourceQueueBuffers</summary>
|
||||
Streaming = 0x1029,
|
||||
///<summary>Source is undetermined when it has the NULL Buffer attached</summary>
|
||||
Undetermined = 0x1030,
|
||||
}
|
||||
|
||||
///<summary>Sound samples: Format specifier.</summary>
|
||||
public enum AlFormat : int
|
||||
{
|
||||
///<summary>1 Channel, 8 Bit.</summary>
|
||||
FormatMono8 = 0x1100,
|
||||
|
||||
///<summary>1 Channel, 16 Bit.</summary>
|
||||
FormatMono16 = 0x1101,
|
||||
|
||||
///<summary>2 Channels, 8 Bit each.</summary>
|
||||
FormatStereo8 = 0x1102,
|
||||
|
||||
///<summary>2 Channels, 16 Bit each.</summary>
|
||||
FormatStereo16 = 0x1103,
|
||||
}
|
||||
|
||||
public enum AlBufferAttribute : int
|
||||
{
|
||||
///<summary>Sound samples: frequency, in units of Hertz [Hz]. This is the number of samples per second. Half of the sample frequency marks the maximum significant frequency component.</summary>
|
||||
Frequency = 0x2001,
|
||||
Bits = 0x2002,
|
||||
Channels = 0x2003,
|
||||
Size = 0x2004,
|
||||
}
|
||||
|
||||
///<summary>Buffer state. Not supported for public use (yet).</summary>
|
||||
public enum AlBufferState : int
|
||||
{
|
||||
///<summary>Buffer state. Not supported for public use (yet).</summary>
|
||||
Unused = 0x2010,
|
||||
///<summary>Buffer state. Not supported for public use (yet).</summary>
|
||||
Pending = 0x2011,
|
||||
///<summary>Buffer state. Not supported for public use (yet).</summary>
|
||||
Processed = 0x2012,
|
||||
}
|
||||
|
||||
public enum AlError : int // alGetString
|
||||
{
|
||||
///<summary>No OpenAL Error.</summary>
|
||||
NoError = 0,
|
||||
|
||||
///<summary>Invalid Name paramater passed to OpenAL call.</summary>
|
||||
InvalidName = 0xA001,
|
||||
|
||||
///<summary>Invalid parameter passed to OpenAL call.</summary>
|
||||
IllegalEnum = 0xA002,
|
||||
///<summary>Invalid parameter passed to OpenAL call.</summary>
|
||||
InvalidEnum = 0xA002,
|
||||
|
||||
///<summary>Invalid OpenAL enum parameter value.</summary>
|
||||
InvalidValue = 0xA003,
|
||||
|
||||
///<summary>Illegal OpenAL call.</summary>
|
||||
IllegalCommand = 0xA004,
|
||||
///<summary>Illegal OpenAL call.</summary>
|
||||
InvalidOperation = 0xA004,
|
||||
|
||||
///<summary>No mojo. No OpenAL Memory left.</summary>
|
||||
OutOfMemory = 0xA005,
|
||||
}
|
||||
|
||||
public enum AlContextString : int // alGetString
|
||||
{// Context strings: Vendor Name.
|
||||
Vendor = 0xB001,
|
||||
Version = 0xB002,
|
||||
Renderer = 0xB003,
|
||||
Extensions = 0xB004,
|
||||
}
|
||||
|
||||
public enum AlGlobalTweakage : int // alGetBool/Int/Float/Double
|
||||
{// Global tweakage.
|
||||
///<summary>Doppler scale. Default 1.0</summary>
|
||||
DopplerFactor = 0xC000,
|
||||
|
||||
///<summary>Tweaks speed of propagation.</summary>
|
||||
DopplerVelocity = 0xC001, // TODO : Verify!
|
||||
|
||||
///<summary>Speed of Sound in units per second. default value 343.3f</summary>
|
||||
SpeedOfSound = 0xC003,
|
||||
|
||||
/// <see cref="AlDistanceModels"/>
|
||||
DistanceModel = 0xD000,
|
||||
}
|
||||
|
||||
// ALenum distanceModel
|
||||
public enum AlDistanceModels : int// used in conjunction with DistanceModel
|
||||
{
|
||||
///<summary>bypasses all distance attenuation calculation for all sources.</summary>
|
||||
None = 0,
|
||||
|
||||
///<summary>InverseDistance is equivalent to the IASIG I3DL2 model with the exception that AL_REFERENCE_DISTANCE does not imply any clamping.</summary>
|
||||
InverseDistance = 0xD001,
|
||||
///<summary>InverseDistanceClamped is the IASIG I3DL2 model, with AL_REFERENCE_DISTANCE indicating both the reference distance and the distance below which gain will be clamped.</summary>
|
||||
InverseDistanceClamped = 0xD002,
|
||||
///<summary></summary>
|
||||
LinearDistance = 0xD003, // AL_EXT_LINEAR_DISTANCE extension.
|
||||
///<summary></summary>
|
||||
LinearDistanceClamped = 0xD004, // AL_EXT_LINEAR_DISTANCE extension.
|
||||
///<summary></summary>
|
||||
ExponentDistance = 0xD005, // AL_EXT_EXPONENT_DISTANCE extension.
|
||||
///<summary></summary>
|
||||
ExponentDistanceClamped = 0xD006, // AL_EXT_EXPONENT_DISTANCE extension.
|
||||
}
|
||||
///<summary>Currently no state toggles exist for vanilla OpenAL.</summary>
|
||||
Invalid = -1,
|
||||
}
|
||||
|
||||
public enum ALListenerf : int
|
||||
{
|
||||
///<summary>Indicate the gain (volume amplification) applied. Type: float. Range: [0.0f - ? ] A value of 1.0 means un-attenuated/unchanged. Each division by 2 equals an attenuation of -6dB. Each multiplicaton with 2 equals an amplification of +6dB. A value of 0.0f is meaningless with respect to a logarithmic scale; it is interpreted as zero volume - the channel is effectively disabled.</summary>
|
||||
Gain = 0x100A,
|
||||
}
|
||||
|
||||
public enum ALListener3f : int
|
||||
{
|
||||
///<summary>Specify the current location in three dimensional space. OpenAL, like OpenGL, uses a right handed coordinate system, where in a frontal default view X (thumb) points right, Y points up (index finger), and Z points towards the viewer/camera (middle finger). To switch from a left handed coordinate system, flip the sign on the Z coordinate. Listener position is always in the world coordinate system.</summary>
|
||||
Position = 0x1004,
|
||||
|
||||
///<summary>Specify the current velocity in three dimensional space.</summary>
|
||||
Velocity = 0x1006,
|
||||
}
|
||||
|
||||
public enum ALListenerfv : int
|
||||
{
|
||||
///<summary>Indicate Listener orientation. (at/up)</summary>
|
||||
Orientation = 0x100F,
|
||||
}
|
||||
|
||||
public enum ALSourcef : int
|
||||
{
|
||||
///<summary>Source specific reference distance. Type: float Range: [0.0f - float.PositiveInfinity] At 0.0f, no distance attenuation occurs. Default is 1.0.</summary>
|
||||
ReferenceDistance = 0x1020,
|
||||
|
||||
///<summary>Indicate distance above which Sources are not attenuated using the inverse clamped distance model. Default: float.PositiveInfinity Type: ALfloat Range: [0.0f - float.PositiveInfinity]</summary>
|
||||
MaxDistance = 0x1023,
|
||||
|
||||
///<summary>Source specific rolloff factor. Type: float Range: [0.0f - float.PositiveInfinity]</summary>
|
||||
RolloffFactor = 0x1021,
|
||||
|
||||
///<summary>Specify the pitch to be applied, either at Source, or on mixer results, at Listener. Range: [0.5f - 2.0f] Default: 1.0f</summary>
|
||||
Pitch = 0x1003,
|
||||
|
||||
///<summary>Indicate the gain (volume amplification) applied. Type: float. Range: [0.0f - ? ] A value of 1.0 means un-attenuated/unchanged. Each division by 2 equals an attenuation of -6dB. Each multiplicaton with 2 equals an amplification of +6dB. A value of 0.0f is meaningless with respect to a logarithmic scale; it is interpreted as zero volume - the channel is effectively disabled.</summary>
|
||||
Gain = 0x100A,
|
||||
|
||||
///<summary>Indicate minimum Source attenuation. Type: float Range: [0.0f - 1.0f] (Logarthmic)</summary>
|
||||
MinGain = 0x100D,
|
||||
|
||||
///<summary>Indicate maximum Source attenuation. Type: float Range: [0.0f - 1.0f] (Logarthmic)</summary>
|
||||
MaxGain = 0x100E,
|
||||
|
||||
///<summary>Directional Source, inner cone angle, in degrees. Range: [0-360] Default: 360</summary>
|
||||
ConeInnerAngle = 0x1001,
|
||||
|
||||
///<summary>Directional Source, outer cone angle, in degrees. Range: [0-360] Default: 360</summary>
|
||||
ConeOuterAngle = 0x1002,
|
||||
|
||||
///<summary>Directional Source, outer cone gain. Default: 0.0f Range: [0.0f - 1.0] (Logarithmic)</summary>
|
||||
ConeOuterGain = 0x1022,
|
||||
|
||||
/// <summary>The playback position, expressed in seconds.</summary>
|
||||
SecOffset = 0x1024, // AL_EXT_OFFSET extension.
|
||||
}
|
||||
|
||||
public enum ALSource3f : int
|
||||
{
|
||||
///<summary>Specify the current location in three dimensional space. OpenAL, like OpenGL, uses a right handed coordinate system, where in a frontal default view X (thumb) points right, Y points up (index finger), and Z points towards the viewer/camera (middle finger). To switch from a left handed coordinate system, flip the sign on the Z coordinate. Listener position is always in the world coordinate system.</summary>
|
||||
Position = 0x1004,
|
||||
|
||||
///<summary>Specify the current velocity in three dimensional space.</summary>
|
||||
Velocity = 0x1006,
|
||||
|
||||
///<summary>Specify the current direction vector.</summary>
|
||||
Direction = 0x1005,
|
||||
}
|
||||
|
||||
public enum ALSourceb : int
|
||||
{
|
||||
///<summary>Indicate Source has relative coordinates.</summary>
|
||||
SourceRelative = 0x202,
|
||||
|
||||
///<summary>Indicate whether Source is looping. Type: Al.Bool Range: [True, False] Default: False.</summary>
|
||||
Looping = 0x1007,
|
||||
}
|
||||
|
||||
public enum ALSourcei : int
|
||||
{
|
||||
///<summary>The playback position, expressed in bytes.</summary>
|
||||
ByteOffset = 0x1026, // AL_EXT_OFFSET extension.
|
||||
|
||||
///<summary>The playback position, expressed in samples.</summary>
|
||||
SampleOffset = 0x1025, // AL_EXT_OFFSET extension.
|
||||
|
||||
///<summary>Indicate the Buffer to provide sound samples. Type: uint Range: any valid Buffer id.</summary>
|
||||
Buffer = 0x1009,
|
||||
|
||||
///<summary>Source type (Static, Streaming or undetermined). Use enum AlSourceType for comparison</summary>
|
||||
SourceType = 0x1027,
|
||||
}
|
||||
|
||||
public enum ALSourceiGet : int
|
||||
{
|
||||
///<summary>The playback position, expressed in bytes.</summary>
|
||||
ByteOffset = 0x1026, // AL_EXT_OFFSET extension.
|
||||
|
||||
///<summary>The playback position, expressed in samples.</summary>
|
||||
SampleOffset = 0x1025, // AL_EXT_OFFSET extension.
|
||||
|
||||
///<summary>Indicate the Buffer to provide sound samples. Type: uint Range: any valid Buffer id.</summary>
|
||||
Buffer = 0x1009,
|
||||
|
||||
/// <summary>The state of the source (Stopped, Playing, etc.) Use the enum AlSourceState for comparison.</summary>
|
||||
SourceState = 0x1010,
|
||||
|
||||
/// <summary>The number of buffers queued on this source.</summary>
|
||||
BuffersQueued = 0x1015,
|
||||
|
||||
/// <summary>The number of buffers in the queue that have been processed.</summary>
|
||||
BuffersProcessed = 0x1016,
|
||||
|
||||
///<summary>Source type (Static, Streaming or undetermined). Use enum AlSourceType for comparison.</summary>
|
||||
SourceType = 0x1027,
|
||||
}
|
||||
|
||||
public enum ALDeprecated : int
|
||||
{
|
||||
///<summary>Deprecated. Specify the channel mask. (Creative) Type: uint Range: [0 - 255]</summary>
|
||||
ChannelMask = 0x3000,
|
||||
}
|
||||
|
||||
///<summary>Source state information.</summary>
|
||||
public enum ALSourceState : int
|
||||
{
|
||||
///<summary>Default State when loaded, can be manually set with Al.SourceRewind().</summary>
|
||||
Initial = 0x1011,
|
||||
///<summary>The source is currently playing.</summary>
|
||||
Playing = 0x1012,
|
||||
///<summary>The source has paused playback.</summary>
|
||||
Paused = 0x1013,
|
||||
///<summary>The source is not playing.</summary>
|
||||
Stopped = 0x1014,
|
||||
}
|
||||
|
||||
///<summary>Source type (Static, Streaming or undetermined)</summary>
|
||||
public enum ALSourceType : int
|
||||
{
|
||||
///<summary>Source is Static if a Buffer has been attached using AL_Buffer</summary>
|
||||
Static = 0x1028,
|
||||
///<summary>Source is Streaming if one or more Buffers have been attached using alSourceQueueBuffers</summary>
|
||||
Streaming = 0x1029,
|
||||
///<summary>Source is undetermined when it has the NULL Buffer attached</summary>
|
||||
Undetermined = 0x1030,
|
||||
}
|
||||
|
||||
///<summary>Sound samples: Format specifier.</summary>
|
||||
public enum ALFormat : int
|
||||
{
|
||||
///<summary>1 Channel, 8 Bit.</summary>
|
||||
FormatMono8 = 0x1100,
|
||||
|
||||
///<summary>1 Channel, 16 Bit.</summary>
|
||||
FormatMono16 = 0x1101,
|
||||
|
||||
///<summary>2 Channels, 8 Bit each.</summary>
|
||||
FormatStereo8 = 0x1102,
|
||||
|
||||
///<summary>2 Channels, 16 Bit each.</summary>
|
||||
FormatStereo16 = 0x1103,
|
||||
}
|
||||
|
||||
public enum ALGetBufferi : int
|
||||
{
|
||||
///<summary>Sound sample's frequency, in units of Hertz [Hz]. This is the number of samples per second. Half of the sample frequency marks the maximum significant frequency component.</summary>
|
||||
Frequency = 0x2001,
|
||||
/// <summary>Bit depth of buffer. Should be 8 or 16.</summary>
|
||||
Bits = 0x2002,
|
||||
/// <summary>Number of channels in buffer. > 1 is valid, but buffer won’t be positioned when played. 1 for Mono, 2 for Stereo.</summary>
|
||||
Channels = 0x2003,
|
||||
/// <summary>size of buffer in bytes</summary>
|
||||
Size = 0x2004,
|
||||
|
||||
// From Manual, not in header: AL_DATA ( i, iv ) original location where data was copied from generally useless, as was probably freed after buffer creation
|
||||
}
|
||||
|
||||
///<summary>Buffer state. Not supported for public use (yet).</summary>
|
||||
public enum ALBufferState : int
|
||||
{
|
||||
///<summary>Buffer state. Not supported for public use (yet).</summary>
|
||||
Unused = 0x2010,
|
||||
///<summary>Buffer state. Not supported for public use (yet).</summary>
|
||||
Pending = 0x2011,
|
||||
///<summary>Buffer state. Not supported for public use (yet).</summary>
|
||||
Processed = 0x2012,
|
||||
}
|
||||
|
||||
public enum ALError : int // alGetString
|
||||
{
|
||||
///<summary>No OpenAL Error.</summary>
|
||||
NoError = 0,
|
||||
|
||||
///<summary>Invalid Name paramater passed to OpenAL call.</summary>
|
||||
InvalidName = 0xA001,
|
||||
|
||||
///<summary>Invalid parameter passed to OpenAL call.</summary>
|
||||
IllegalEnum = 0xA002,
|
||||
///<summary>Invalid parameter passed to OpenAL call.</summary>
|
||||
InvalidEnum = 0xA002,
|
||||
|
||||
///<summary>Invalid OpenAL enum parameter value.</summary>
|
||||
InvalidValue = 0xA003,
|
||||
|
||||
///<summary>Illegal OpenAL call.</summary>
|
||||
IllegalCommand = 0xA004,
|
||||
///<summary>Illegal OpenAL call.</summary>
|
||||
InvalidOperation = 0xA004,
|
||||
|
||||
///<summary>No mojo. No OpenAL Memory left.</summary>
|
||||
OutOfMemory = 0xA005,
|
||||
}
|
||||
|
||||
public enum ALGetString : int // alGetString
|
||||
{
|
||||
/// <summary>Gets the Vendor name.</summary>
|
||||
Vendor = 0xB001,
|
||||
|
||||
/// <summary>Gets the driver version.</summary>
|
||||
Version = 0xB002,
|
||||
|
||||
/// <summary>Gets the renderer mode.</summary>
|
||||
Renderer = 0xB003,
|
||||
|
||||
/// <summary>Gets a list of all available Extensions, separated with spaces.</summary>
|
||||
Extensions = 0xB004,
|
||||
}
|
||||
|
||||
public enum ALGetFloat : int
|
||||
{
|
||||
///<summary>Doppler scale. Default 1.0f</summary>
|
||||
DopplerFactor = 0xC000,
|
||||
|
||||
///<summary>Tweaks speed of propagation. This functionality is deprecated.</summary>
|
||||
DopplerVelocity = 0xC001,
|
||||
|
||||
///<summary>Speed of Sound in units per second. default value 343.3f</summary>
|
||||
SpeedOfSound = 0xC003,
|
||||
}
|
||||
|
||||
public enum ALGetInteger : int
|
||||
{
|
||||
///<summary>See enum AlDistanceModel.</summary><see cref="AlDistanceModels"/>
|
||||
DistanceModel = 0xD000,
|
||||
}
|
||||
|
||||
public enum ALDistanceModel : int // used in conjunction with Al.DistanceModel
|
||||
{
|
||||
///<summary>bypasses all distance attenuation calculation for all sources.</summary>
|
||||
None = 0,
|
||||
|
||||
///<summary>InverseDistance is equivalent to the IASIG I3DL2 model with the exception that AL_REFERENCE_DISTANCE does not imply any clamping.</summary>
|
||||
InverseDistance = 0xD001,
|
||||
///<summary>InverseDistanceClamped is the IASIG I3DL2 model, with AL_REFERENCE_DISTANCE indicating both the reference distance and the distance below which gain will be clamped.</summary>
|
||||
InverseDistanceClamped = 0xD002,
|
||||
///<summary></summary>
|
||||
LinearDistance = 0xD003, // AL_EXT_LINEAR_DISTANCE extension.
|
||||
///<summary></summary>
|
||||
LinearDistanceClamped = 0xD004, // AL_EXT_LINEAR_DISTANCE extension.
|
||||
///<summary></summary>
|
||||
ExponentDistance = 0xD005, // AL_EXT_EXPONENT_DISTANCE extension.
|
||||
///<summary></summary>
|
||||
ExponentDistanceClamped = 0xD006, // AL_EXT_EXPONENT_DISTANCE extension.
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -3,19 +3,12 @@
|
|||
* C header: \OpenAL 1.1 SDK\include\Alc.h
|
||||
* Spec: http://www.openal.org/openal_webstf/specs/OpenAL11Specification.pdf
|
||||
* Copyright (c) 2008 Christoph Brandtner and Stefanos Apostolopoulos
|
||||
* See license.txt for license details (MIT)
|
||||
* http://www.OpenTK.net
|
||||
*/
|
||||
|
||||
/* Version History:
|
||||
* 0.1
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
* See license.txt for license details
|
||||
* http://www.OpenTK.net */
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Security;
|
||||
|
||||
|
@ -72,147 +65,227 @@ typedef void ALCvoid;
|
|||
* ALCcontext *context
|
||||
* IntPtr
|
||||
*/
|
||||
|
||||
|
||||
namespace OpenTK.OpenAL
|
||||
{
|
||||
/// <summary>Alc = Audio Library Context</summary>
|
||||
|
||||
/// <summary>Alc = Audio Library Context</summary>
|
||||
public static class Alc
|
||||
{
|
||||
#region Constants
|
||||
private const string Lib = Al.Lib;
|
||||
|
||||
private const string Lib = AL.Lib;
|
||||
private const CallingConvention Style = CallingConvention.Cdecl;
|
||||
|
||||
#endregion Constants
|
||||
|
||||
#region Context Management
|
||||
|
||||
/// <summary>This function creates a context using a specified device.</summary>
|
||||
/// <param name="device">a pointer to a device</param>
|
||||
/// <param name="attrlist">a pointer to a set of attributes: ALC_FREQUENCY, ALC_MONO_SOURCES, ALC_REFRESH, ALC_STEREO_SOURCES, ALC_SYNC</param>
|
||||
/// <returns>Returns a pointer to the new context (NULL on failure). The attribute list can be NULL, or a zero terminated list of integer pairs composed of valid ALC attribute tokens and requested values.</returns>
|
||||
[DllImport(Alc.Lib, EntryPoint = "alcCreateContext", ExactSpelling = true, CallingConvention = Alc.Style), SuppressUnmanagedCodeSecurity()]
|
||||
public static extern IntPtr CreateContext([In] IntPtr device, [In] IntPtr attrlist);
|
||||
// ALC_API ALCcontext * ALC_APIENTRY alcCreateContext( ALCdevice *device, const ALCint* attrlist );
|
||||
[DllImport( Alc.Lib, EntryPoint = "alcCreateContext", ExactSpelling = true, CallingConvention = Alc.Style ), SuppressUnmanagedCodeSecurity( )]
|
||||
internal static extern IntPtr CreateContext( [In] IntPtr device, [In] IntPtr attrlist );
|
||||
|
||||
/// <summary>This function makes a specified context the current context.</summary>
|
||||
/// <param name="context">A pointer to the new context.</param>
|
||||
/// <returns>Returns True on success, or False on failure.</returns>
|
||||
[DllImport(Alc.Lib, EntryPoint = "alcMakeContextCurrent", ExactSpelling = true, CallingConvention = Alc.Style), SuppressUnmanagedCodeSecurity()]
|
||||
public static extern AL.Bool MakeContextCurrent([In] IntPtr context);
|
||||
// ALC_API ALCboolean ALC_APIENTRY alcMakeContextCurrent( ALCcontext *context );
|
||||
[DllImport( Alc.Lib, EntryPoint = "alcMakeContextCurrent", ExactSpelling = true, CallingConvention = Alc.Style ), SuppressUnmanagedCodeSecurity( )]
|
||||
internal static extern Al.Bool MakeContextCurrent( [In] IntPtr context );
|
||||
|
||||
/// <summary>This function tells a context to begin processing. When a context is suspended, changes in OpenAL state will be accepted but will not be processed. alcSuspendContext can be used to suspend a context, and then all the OpenAL state changes can be applied at once, followed by a call to alcProcessContext to apply all the state changes immediately. In some cases, this procedure may be more efficient than application of properties in a non-suspended state. In some implementations, process and suspend calls are each a NOP.</summary>
|
||||
/// <param name="context">a pointer to the new context</param>
|
||||
[DllImport(Alc.Lib, EntryPoint = "alcProcessContext", ExactSpelling = true, CallingConvention = Alc.Style), SuppressUnmanagedCodeSecurity()]
|
||||
public static extern void ProcessContext([In] IntPtr context);
|
||||
// ALC_API void ALC_APIENTRY alcProcessContext( ALCcontext *context );
|
||||
[DllImport( Alc.Lib, EntryPoint = "alcProcessContext", ExactSpelling = true, CallingConvention = Alc.Style ), SuppressUnmanagedCodeSecurity( )]
|
||||
internal static extern void ProcessContext( [In] IntPtr context );
|
||||
|
||||
/// <summary>This function suspends processing on a specified context. When a context is suspended, changes in OpenAL state will be accepted but will not be processed. A typical use of alcSuspendContext would be to suspend a context, apply all the OpenAL state changes at once, and then call alcProcessContext to apply all the state changes at once. In some cases, this procedure may be more efficient than application of properties in a non-suspended state. In some implementations, process and suspend calls are each a NOP.</summary>
|
||||
/// <param name="context">a pointer to the context to be suspended.</param>
|
||||
[DllImport(Alc.Lib, EntryPoint = "alcSuspendContext", ExactSpelling = true, CallingConvention = Alc.Style), SuppressUnmanagedCodeSecurity()]
|
||||
public static extern void SuspendContext([In] IntPtr context);
|
||||
// ALC_API void ALC_APIENTRY alcSuspendContext( ALCcontext *context );
|
||||
[DllImport( Alc.Lib, EntryPoint = "alcSuspendContext", ExactSpelling = true, CallingConvention = Alc.Style ), SuppressUnmanagedCodeSecurity( )]
|
||||
internal static extern void SuspendContext( [In] IntPtr context );
|
||||
|
||||
|
||||
/// <summary>This function destroys a context.</summary>
|
||||
/// <param name="context">a pointer to the new context.</param>
|
||||
[DllImport(Alc.Lib, EntryPoint = "alcDestroyContext", ExactSpelling = true, CallingConvention = Alc.Style), SuppressUnmanagedCodeSecurity()]
|
||||
public static extern void DestroyContext([In] IntPtr context);
|
||||
// ALC_API void ALC_APIENTRY alcDestroyContext( ALCcontext *context );
|
||||
[DllImport( Alc.Lib, EntryPoint = "alcDestroyContext", ExactSpelling = true, CallingConvention = Alc.Style ), SuppressUnmanagedCodeSecurity( )]
|
||||
internal static extern void DestroyContext( [In] IntPtr context );
|
||||
|
||||
/// <summary>This function retrieves the current context.</summary>
|
||||
/// <returns>Returns a pointer to the current context.</returns>
|
||||
[DllImport(Alc.Lib, EntryPoint = "alcGetCurrentContext", ExactSpelling = true, CallingConvention = Alc.Style), SuppressUnmanagedCodeSecurity()]
|
||||
public static extern IntPtr GetCurrentContext();
|
||||
// ALC_API ALCcontext * ALC_APIENTRY alcGetCurrentContext( void );
|
||||
[DllImport( Alc.Lib, EntryPoint = "alcGetCurrentContext", ExactSpelling = true, CallingConvention = Alc.Style ), SuppressUnmanagedCodeSecurity( )]
|
||||
internal static extern IntPtr GetCurrentContext( );
|
||||
|
||||
/// <summary>This function retrieves a context's device pointer.</summary>
|
||||
/// <param name="context">a pointer to a context.</param>
|
||||
/// <returns>Returns a pointer to the specified context's device.</returns>
|
||||
[DllImport(Alc.Lib, EntryPoint = "alcGetContextsDevice", ExactSpelling = true, CallingConvention = Alc.Style), SuppressUnmanagedCodeSecurity()]
|
||||
public static extern IntPtr GetContextsDevice([In] IntPtr context);
|
||||
// ALC_API ALCdevice* ALC_APIENTRY alcGetContextsDevice( ALCcontext *context );
|
||||
[DllImport( Alc.Lib, EntryPoint = "alcGetContextsDevice", ExactSpelling = true, CallingConvention = Alc.Style ), SuppressUnmanagedCodeSecurity( )]
|
||||
internal static extern IntPtr GetContextsDevice( [In] IntPtr context );
|
||||
|
||||
#endregion Context Management
|
||||
|
||||
#region Device Management
|
||||
// ALC_API ALCdevice * ALC_APIENTRY alcOpenDevice( const ALCchar *devicename );
|
||||
[DllImport( Alc.Lib, EntryPoint = "alcOpenDevice", ExactSpelling = true, CallingConvention = Alc.Style, CharSet = CharSet.Ansi ), SuppressUnmanagedCodeSecurity( )]
|
||||
internal static extern IntPtr OpenDevice( [In] string devicename );
|
||||
|
||||
/// <summary>This function opens a device by name.</summary>
|
||||
/// <param name="devicename">a null-terminated string describing a device.</param>
|
||||
/// <returns>Returns a pointer to the opened device. The return value will be NULL if there is an error.</returns>
|
||||
[DllImport(Alc.Lib, EntryPoint = "alcOpenDevice", ExactSpelling = true, CallingConvention = Alc.Style, CharSet = CharSet.Ansi), SuppressUnmanagedCodeSecurity()]
|
||||
public static extern IntPtr OpenDevice([In] string devicename);
|
||||
// ALC_API ALCdevice * ALC_APIENTRY alcOpenDevice( const ALCchar *devicename );
|
||||
|
||||
/// <summary>This function closes a device by name.</summary>
|
||||
/// <param name="device">a pointer to an opened device</param>
|
||||
/// <returns>True will be returned on success or False on failure. Closing a device will fail if the device contains any contexts or buffers.</returns>
|
||||
[DllImport(Alc.Lib, EntryPoint = "alcCloseDevice", ExactSpelling = true, CallingConvention = Alc.Style), SuppressUnmanagedCodeSecurity()]
|
||||
public static extern AL.Bool CloseDevice([In] IntPtr device);
|
||||
// ALC_API ALCboolean ALC_APIENTRY alcCloseDevice( ALCdevice *device );
|
||||
[DllImport( Alc.Lib, EntryPoint = "alcCloseDevice", ExactSpelling = true, CallingConvention = Alc.Style ), SuppressUnmanagedCodeSecurity( )]
|
||||
internal static extern Al.Bool CloseDevice( [In] IntPtr device );
|
||||
|
||||
#endregion Device Management
|
||||
|
||||
#region Error support.
|
||||
// Obtain the most recent Context error
|
||||
|
||||
/// <summary>This function retrieves the current context error state.</summary>
|
||||
/// <param name="device">a pointer to the device to retrieve the error state from</param>
|
||||
/// <returns>Errorcode Int32.</returns>
|
||||
[DllImport(Alc.Lib, EntryPoint = "alcGetError", ExactSpelling = true, CallingConvention = Alc.Style), SuppressUnmanagedCodeSecurity()]
|
||||
public static extern Enums.AlcError GetError([In] IntPtr device);
|
||||
// ALC_API ALCenum ALC_APIENTRY alcGetError( ALCdevice *device );
|
||||
[DllImport( Alc.Lib, EntryPoint = "alcGetError", ExactSpelling = true, CallingConvention = Alc.Style ), SuppressUnmanagedCodeSecurity( )]
|
||||
internal static extern Enums.AlcError GetError( [In] IntPtr device );
|
||||
|
||||
#endregion Error support.
|
||||
|
||||
#region Extension support.
|
||||
// Query for the presence of an extension, and obtain any appropriate function pointers and enum values.
|
||||
|
||||
/// <summary>This function queries if a specified context extension is available.</summary>
|
||||
/// <param name="device">a pointer to the device to be queried for an extension.</param>
|
||||
/// <param name="extname">a null-terminated string describing the extension.</param>
|
||||
/// <returns>Returns True if the extension is available, False if the extension is not available.</returns>
|
||||
[DllImport(Alc.Lib, EntryPoint = "alcIsExtensionPresent", ExactSpelling = true, CallingConvention = Alc.Style, CharSet = CharSet.Ansi), SuppressUnmanagedCodeSecurity()]
|
||||
public static extern AL.Bool IsExtensionPresent([In] IntPtr device, [In] string extname);
|
||||
// ALC_API ALCboolean ALC_APIENTRY alcIsExtensionPresent( ALCdevice *device, const ALCchar *extname );
|
||||
[DllImport( Alc.Lib, EntryPoint = "alcIsExtensionPresent", ExactSpelling = true, CallingConvention = Alc.Style, CharSet = CharSet.Ansi ), SuppressUnmanagedCodeSecurity( )]
|
||||
internal static extern Al.Bool IsExtensionPresent( [In] IntPtr device, [In] string extname );
|
||||
|
||||
/// <summary>This function retrieves the address of a specified context extension function.</summary>
|
||||
/// <param name="device">a pointer to the device to be queried for the function.</param>
|
||||
/// <param name="funcname">a null-terminated string describing the function.</param>
|
||||
/// <returns>Returns the address of the function, or NULL if it is not found.</returns>
|
||||
[DllImport(Alc.Lib, EntryPoint = "alcGetProcAddress", ExactSpelling = true, CallingConvention = Alc.Style, CharSet = CharSet.Ansi), SuppressUnmanagedCodeSecurity()]
|
||||
public static extern IntPtr GetProcAddress([In] IntPtr device, [In] string funcname);
|
||||
// ALC_API void * ALC_APIENTRY alcGetProcAddress( ALCdevice *device, const ALCchar *funcname );
|
||||
[DllImport( Alc.Lib, EntryPoint = "alcGetProcAddress", ExactSpelling = true, CallingConvention = Alc.Style, CharSet = CharSet.Ansi ), SuppressUnmanagedCodeSecurity( )]
|
||||
internal static extern IntPtr GetProcAddress( [In] IntPtr device, [In] string funcname );
|
||||
|
||||
/// <summary>This function retrieves the enum value for a specified enumeration name.</summary>
|
||||
/// <param name="device">a pointer to the device to be queried.</param>
|
||||
/// <param name="enumname">a null terminated string describing the enum value.</param>
|
||||
/// <returns>Returns the enum value described by the enumName string. This is most often used for querying an enum value for an ALC extension.</returns>
|
||||
[DllImport(Alc.Lib, EntryPoint = "alcGetEnumValue", ExactSpelling = true, CallingConvention = Alc.Style, CharSet = CharSet.Ansi), SuppressUnmanagedCodeSecurity()]
|
||||
public static extern int GetEnumValue([In] IntPtr device, [In] string enumname);
|
||||
// ALC_API ALCenum ALC_APIENTRY alcGetEnumValue( ALCdevice *device, const ALCchar *enumname );
|
||||
[DllImport( Alc.Lib, EntryPoint = "alcGetEnumValue", ExactSpelling = true, CallingConvention = Alc.Style, CharSet = CharSet.Ansi ), SuppressUnmanagedCodeSecurity( )]
|
||||
internal static extern int GetEnumValue( [In] IntPtr device, [In] string enumname );
|
||||
|
||||
#endregion Extension support.
|
||||
|
||||
#region Query functions
|
||||
|
||||
[DllImport(Alc.Lib, EntryPoint = "alcGetString", ExactSpelling = true, CallingConvention = Alc.Style, CharSet = CharSet.Ansi), SuppressUnmanagedCodeSecurity()]
|
||||
private static extern IntPtr GetStringPrivate([In] IntPtr device, Enums.AlcGetString param);
|
||||
// ALC_API const ALCchar * ALC_APIENTRY alcGetString( ALCdevice *device, ALCenum param );
|
||||
[DllImport( Alc.Lib, EntryPoint = "alcGetString", ExactSpelling = true, CallingConvention = Alc.Style, CharSet = CharSet.Ansi ), SuppressUnmanagedCodeSecurity( )]
|
||||
private static extern IntPtr GetStringInternal( [In] IntPtr device, Enums.AlcGetString param );
|
||||
|
||||
internal static string GetString( IntPtr device, Enums.AlcGetString param )
|
||||
|
||||
/// <summary>This function returns pointers to strings related to the context.</summary>
|
||||
/// <remarks>
|
||||
/// ALC_DEFAULT_DEVICE_SPECIFIER will return the name of the default output device.
|
||||
/// ALC_CAPTURE_DEFAULT_DEVICE_SPECIFIER will return the name of the default capture device.
|
||||
/// ALC_DEVICE_SPECIFIER will return the name of the specified output device if a pointer is supplied, or will return a list of all available devices if a NULL device pointer is supplied. A list is a pointer to a series of strings separated by NULL characters, with the list terminated by two NULL characters. See Enumeration Extension for more details.
|
||||
/// ALC_CAPTURE_DEVICE_SPECIFIER will return the name of the specified capture device if a pointer is supplied, or will return a list of all available devices if a NULL device pointer is supplied.
|
||||
/// ALC_EXTENSIONS returns a list of available context extensions, with each extension separated by a space and the list terminated by a NULL character.
|
||||
/// </remarks>
|
||||
/// <param name="device">a pointer to the device to be queried.</param>
|
||||
/// <param name="param">an attribute to be retrieved: ALC_DEFAULT_DEVICE_SPECIFIER, ALC_CAPTURE_DEFAULT_DEVICE_SPECIFIER, ALC_DEVICE_SPECIFIER, ALC_CAPTURE_DEVICE_SPECIFIER, ALC_EXTENSIONS</param>
|
||||
/// <returns></returns>
|
||||
public static string GetString(IntPtr device, Enums.AlcGetString param)
|
||||
{
|
||||
return Marshal.PtrToStringAnsi( GetStringInternal( device, param ) );
|
||||
return Marshal.PtrToStringAnsi(GetStringPrivate(device, param));
|
||||
}
|
||||
|
||||
internal static string GetStringDevices( )
|
||||
public static List<string> GetString(IntPtr device, Enums.AlcGetStringList param)
|
||||
{
|
||||
return Marshal.PtrToStringBSTR( GetStringInternal( Al.Null, Enums.AlcGetString.DeviceSpecifier ));
|
||||
List<string> result = new List<string>();
|
||||
IntPtr t = GetStringPrivate(AL.Null, (Enums.AlcGetString)Enums.AlcGetStringList.DeviceSpecifier);
|
||||
System.Text.StringBuilder sb = new System.Text.StringBuilder();
|
||||
byte b;
|
||||
int offset = 0;
|
||||
do
|
||||
{
|
||||
b = Marshal.ReadByte(t, offset++);
|
||||
if (b != 0) sb.Append((char)b);
|
||||
else
|
||||
{
|
||||
if (Marshal.ReadByte(t, offset + 1) == 0)
|
||||
break;
|
||||
else
|
||||
{
|
||||
if (sb.Length > 1) result.Add(sb.ToString());
|
||||
sb.Remove(0, sb.Length);
|
||||
}
|
||||
}
|
||||
} while (true);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>This function returns integers related to the context.</summary>
|
||||
/// <param name="device">a pointer to the device to be queried.</param>
|
||||
/// <param name="param">an attribute to be retrieved: ALC_MAJOR_VERSION, ALC_MINOR_VERSION, ALC_ATTRIBUTES_SIZE, ALC_ALL_ATTRIBUTES</param>
|
||||
/// <param name="size">the size of the destination buffer provided. In bytes.</param>
|
||||
/// <param name="data">a pointer to the data to be returned</param>
|
||||
[DllImport(Alc.Lib, EntryPoint = "alcGetIntegerv", ExactSpelling = true, CallingConvention = Alc.Style, CharSet = CharSet.Ansi), SuppressUnmanagedCodeSecurity()]
|
||||
public static extern void GetInteger([In] IntPtr device, Enums.AlcGetInteger param, int size, [Out] out int data);
|
||||
// ALC_API void ALC_APIENTRY alcGetIntegerv( ALCdevice *device, ALCenum param, ALCsizei size, ALCint *data );
|
||||
[DllImport( Alc.Lib, EntryPoint = "alcGetIntegerv", ExactSpelling = true, CallingConvention = Alc.Style, CharSet = CharSet.Ansi ), SuppressUnmanagedCodeSecurity( )]
|
||||
internal static extern void GetInteger( [In] IntPtr device, Enums.AlcGetInteger param, int sizeofdatainbytes, [Out] out int data );
|
||||
|
||||
#endregion Query functions
|
||||
|
||||
#region Capture functions
|
||||
|
||||
/// <summary>This function opens a capture device by name. </summary>
|
||||
/// <param name="devicename">a pointer to a device name string</param>
|
||||
/// <param name="frequency">the frequency that the data should be captured at</param>
|
||||
/// <param name="format">the requested capture buffer format</param>
|
||||
/// <param name="buffersize">the size of the capture buffer in bytes</param>
|
||||
/// <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()]
|
||||
public static extern IntPtr CaptureOpenDevice(string devicename, uint frequency, Enums.ALFormat format, int buffersize);
|
||||
// ALC_API ALCdevice* ALC_APIENTRY alcCaptureOpenDevice( const ALCchar *devicename, ALCuint frequency, ALCenum format, ALCsizei buffersize );
|
||||
[DllImport( Alc.Lib, EntryPoint = "alcCaptureOpenDevice", ExactSpelling = true, CallingConvention = Alc.Style, CharSet = CharSet.Ansi ), SuppressUnmanagedCodeSecurity( )]
|
||||
internal static extern IntPtr CaptureOpenDevice( string devicename, uint frequency, Enums.AlFormat format, int buffersize );
|
||||
|
||||
/// <summary>This function closes the specified capture device.</summary>
|
||||
/// <param name="device">a pointer to a capture device.</param>
|
||||
/// <returns>Returns True if the close operation was successful, False on failure.</returns>
|
||||
[DllImport(Alc.Lib, EntryPoint = "alcCaptureCloseDevice", ExactSpelling = true, CallingConvention = Alc.Style), SuppressUnmanagedCodeSecurity()]
|
||||
public static extern AL.Bool CaptureCloseDevice([In] IntPtr device);
|
||||
// ALC_API ALCboolean ALC_APIENTRY alcCaptureCloseDevice( ALCdevice *device );
|
||||
[DllImport( Alc.Lib, EntryPoint = "alcCaptureCloseDevice", ExactSpelling = true, CallingConvention = Alc.Style ), SuppressUnmanagedCodeSecurity( )]
|
||||
internal static extern Al.Bool CaptureCloseDevice( [In] IntPtr device );
|
||||
|
||||
/// <summary>This function begins a capture operation.</summary>
|
||||
/// <remarks>alcCaptureStart will begin recording to an internal ring buffer of the size specified when opening the capture device. The application can then retrieve the number of samples currently available using the ALC_CAPTURE_SAPMPLES token with alcGetIntegerv. When the application determines that enough samples are available for processing, then it can obtain them with a call to alcCaptureSamples.</remarks>
|
||||
/// <param name="device">a pointer to a capture device.</param>
|
||||
[DllImport(Alc.Lib, EntryPoint = "alcCaptureStart", ExactSpelling = true, CallingConvention = Alc.Style), SuppressUnmanagedCodeSecurity()]
|
||||
public static extern void CaptureStart([In] IntPtr device);
|
||||
// ALC_API void ALC_APIENTRY alcCaptureStart( ALCdevice *device );
|
||||
[DllImport( Alc.Lib, EntryPoint = "alcCaptureStart", ExactSpelling = true, CallingConvention = Alc.Style ), SuppressUnmanagedCodeSecurity( )]
|
||||
internal static extern void CaptureStart( [In] IntPtr device );
|
||||
|
||||
/// <summary>This function stops a capture operation.</summary>
|
||||
/// <param name="device">a pointer to a capture device.</param>
|
||||
[DllImport(Alc.Lib, EntryPoint = "alcCaptureStop", ExactSpelling = true, CallingConvention = Alc.Style), SuppressUnmanagedCodeSecurity()]
|
||||
public static extern void CaptureStop([In] IntPtr device);
|
||||
// ALC_API void ALC_APIENTRY alcCaptureStop( ALCdevice *device );
|
||||
[DllImport( Alc.Lib, EntryPoint = "alcCaptureStop", ExactSpelling = true, CallingConvention = Alc.Style ), SuppressUnmanagedCodeSecurity( )]
|
||||
internal static extern void CaptureStop( [In] IntPtr device );
|
||||
|
||||
/// <summary>This function completes a capture operation, and does not block.</summary>
|
||||
/// <param name="device">a pointer to a capture device.</param>
|
||||
/// <param name="buffer">a pointer to a data buffer, which must be large enough to accommodate samples number of samples.</param>
|
||||
/// <param name="samples">the number of samples to be retrieved.</param>
|
||||
[DllImport(Alc.Lib, EntryPoint = "alcCaptureSamples", ExactSpelling = true, CallingConvention = Alc.Style), SuppressUnmanagedCodeSecurity()]
|
||||
public static extern void CaptureSamples([In] IntPtr device, [Out] out IntPtr buffer, [Out] out int samples);
|
||||
// ALC_API void ALC_APIENTRY alcCaptureSamples( ALCdevice *device, ALCvoid *buffer, ALCsizei samples );
|
||||
[DllImport( Alc.Lib, EntryPoint = "alcCaptureSamples", ExactSpelling = true, CallingConvention = Alc.Style ), SuppressUnmanagedCodeSecurity( )]
|
||||
internal static extern void CaptureSamples( [In] IntPtr device, [Out] out IntPtr buffer, [Out] out int samples );
|
||||
|
||||
#endregion Capture functions
|
||||
|
||||
/* delegates
|
||||
// Pointer-to-function types, useful for dynamically getting ALC entry points.
|
||||
|
||||
typedef ALCcontext * (ALC_APIENTRY *LPALCCREATECONTEXT) (ALCdevice *device, const ALCint *attrlist);
|
||||
typedef ALCboolean (ALC_APIENTRY *LPALCMAKECONTEXTCURRENT)( ALCcontext *context );
|
||||
typedef void (ALC_APIENTRY *LPALCPROCESSCONTEXT)( ALCcontext *context );
|
||||
typedef void (ALC_APIENTRY *LPALCSUSPENDCONTEXT)( ALCcontext *context );
|
||||
typedef void (ALC_APIENTRY *LPALCDESTROYCONTEXT)( ALCcontext *context );
|
||||
typedef ALCcontext * (ALC_APIENTRY *LPALCGETCURRENTCONTEXT)( void );
|
||||
typedef ALCdevice * (ALC_APIENTRY *LPALCGETCONTEXTSDEVICE)( ALCcontext *context );
|
||||
typedef ALCdevice * (ALC_APIENTRY *LPALCOPENDEVICE)( const ALCchar *devicename );
|
||||
typedef ALCboolean (ALC_APIENTRY *LPALCCLOSEDEVICE)( ALCdevice *device );
|
||||
typedef ALCenum (ALC_APIENTRY *LPALCGETERROR)( ALCdevice *device );
|
||||
typedef ALCboolean (ALC_APIENTRY *LPALCISEXTENSIONPRESENT)( ALCdevice *device, const ALCchar *extname );
|
||||
typedef void * (ALC_APIENTRY *LPALCGETPROCADDRESS)(ALCdevice *device, const ALCchar *funcname );
|
||||
typedef ALCenum (ALC_APIENTRY *LPALCGETENUMVALUE)(ALCdevice *device, const ALCchar *enumname );
|
||||
typedef const ALCchar* (ALC_APIENTRY *LPALCGETSTRING)( ALCdevice *device, ALCenum param );
|
||||
typedef void (ALC_APIENTRY *LPALCGETINTEGERV)( ALCdevice *device, ALCenum param, ALCsizei size, ALCint *dest );
|
||||
typedef ALCdevice * (ALC_APIENTRY *LPALCCAPTUREOPENDEVICE)( const ALCchar *devicename, ALCuint frequency, ALCenum format, ALCsizei Buffersize );
|
||||
typedef ALCboolean (ALC_APIENTRY *LPALCCAPTURECLOSEDEVICE)( ALCdevice *device );
|
||||
typedef void (ALC_APIENTRY *LPALCCAPTURESTART)( ALCdevice *device );
|
||||
typedef void (ALC_APIENTRY *LPALCCAPTURESTOP)( ALCdevice *device );
|
||||
typedef void (ALC_APIENTRY *LPALCCAPTURESAMPLES)( ALCdevice *device, ALCvoid *Buffer, ALCsizei samples );
|
||||
*/
|
||||
}
|
||||
}
|
||||
}
|
|
@ -3,102 +3,101 @@
|
|||
* C header: \OpenAL 1.1 SDK\include\Alc.h
|
||||
* Spec: http://www.openal.org/openal_webstf/specs/OpenAL11Specification.pdf
|
||||
* Copyright (c) 2008 Christoph Brandtner and Stefanos Apostolopoulos
|
||||
* See license.txt for license details (MIT)
|
||||
* http://www.OpenTK.net
|
||||
*/
|
||||
|
||||
/* Version History:
|
||||
* 0.1
|
||||
* - Tokens ALC_TRUE and ALC_FALSE removed, created new type. see Al.Bool
|
||||
*
|
||||
*
|
||||
*/
|
||||
* See license.txt for license details
|
||||
* http://www.OpenTK.net */
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
|
||||
namespace OpenTK.OpenAL
|
||||
namespace OpenTK.OpenAL.Enums
|
||||
{
|
||||
public partial class Enums
|
||||
|
||||
public enum AlcContextAttributes : int
|
||||
{
|
||||
public enum AlcContextAttributes : int
|
||||
{
|
||||
///<summary>followed by <int> Hz</summary>
|
||||
Frequency = 0x1007,
|
||||
///<summary>followed by <int> Hz</summary>
|
||||
Frequency = 0x1007,
|
||||
|
||||
///<summary>followed by <int> Hz</summary>
|
||||
Refresh = 0x1008,
|
||||
///<summary>followed by <int> Hz</summary>
|
||||
Refresh = 0x1008,
|
||||
|
||||
///<summary>followed by AlBoolean.True, or AlBoolean.False</summary>
|
||||
Sync = 0x1009,
|
||||
///<summary>followed by AlBoolean.True, or AlBoolean.False</summary>
|
||||
Sync = 0x1009,
|
||||
|
||||
///<summary>followed by <int> Num of requested Mono (3D) Sources</summary>
|
||||
MonoSources = 0x1010,
|
||||
///<summary>followed by <int> Num of requested Mono (3D) Sources</summary>
|
||||
MonoSources = 0x1010,
|
||||
|
||||
///<summary>followed by <int> Num of requested Stereo Sources</summary>
|
||||
StereoSources = 0x1011,
|
||||
}
|
||||
|
||||
public enum AlcError : int // errors
|
||||
{
|
||||
///<summary>There is no current error.</summary>
|
||||
NoError = 0,
|
||||
|
||||
///<summary>No Device. The device handle or specifier names an inaccessible driver/server.</summary>
|
||||
InvalidDevice = 0xA001,
|
||||
|
||||
///<summary>Invalid context ID. The Context argument does not name a valid context.</summary>
|
||||
InvalidContext = 0xA002,
|
||||
|
||||
///<summary>Bad enum. A token used is not valid, or not applicable.</summary>
|
||||
InvalidEnum = 0xA003,
|
||||
|
||||
///<summary>Bad value. A value (e.g. Attribute) is not valid, or not applicable.</summary>
|
||||
InvalidValue = 0xA004,
|
||||
|
||||
///<summary>Out of memory. Unable to allocate memory.</summary>
|
||||
OutOfMemory = 0xA005,
|
||||
}
|
||||
|
||||
public enum AlcGetString : int
|
||||
{
|
||||
///<summary>The specifier string for the default device</summary>
|
||||
DefaultDeviceSpecifier = 0x1004,
|
||||
|
||||
///<summary>The specifier string for the device</summary>
|
||||
DeviceSpecifier = 0x1005,
|
||||
|
||||
///<summary>A list of available context extensions separated by spaces.</summary>
|
||||
Extensions = 0x1006,
|
||||
|
||||
///<summary>The name of the default capture device</summary>
|
||||
CaptureDefaultDeviceSpecifier = 0x311, // ALC_EXT_CAPTURE extension.
|
||||
|
||||
///<summary>The name of the specified capture device, or a list of all available capture devices if no capture device is specified.</summary>
|
||||
CaptureDeviceSpecifier = 0x310, // ALC_EXT_CAPTURE extension.
|
||||
}
|
||||
|
||||
public enum AlcGetInteger : int
|
||||
{
|
||||
///<summary>The specification revision for this implementation (major version). NULL is an acceptable device.</summary>
|
||||
MajorVersion = 0x1000,
|
||||
///<summary>The specification revision for this implementation (minor version). NULL is an acceptable device.</summary>
|
||||
MinorVersion = 0x1001,
|
||||
|
||||
///<summary>The size (number of ALCint values) required for a zero-terminated attributes list, for the current context. NULL is an invalid device.</summary>
|
||||
AttributesSize = 0x1002,
|
||||
///<summary>Expects a destination of ALC_ATTRIBUTES_SIZE, and provides an attribute list for the current context of the specified device. NULL is an invalid device.</summary>
|
||||
AllAttributes = 0x1003,
|
||||
|
||||
///<summary>The number of capture samples available. NULL is an invalid device.</summary>
|
||||
CaptureSamples = 0x312,
|
||||
}
|
||||
|
||||
// ALC_ENUMERATE_ALL_EXT token
|
||||
public enum AlcEnumerateAll : int
|
||||
{
|
||||
DefaultAllDevicesSpecifier = 0x1012,
|
||||
AllDevicesSpecifier = 0x1013,
|
||||
}
|
||||
///<summary>followed by <int> Num of requested Stereo Sources</summary>
|
||||
StereoSources = 0x1011,
|
||||
}
|
||||
|
||||
public enum AlcError : int
|
||||
{
|
||||
///<summary>There is no current error.</summary>
|
||||
NoError = 0,
|
||||
|
||||
///<summary>No Device. The device handle or specifier names an inaccessible driver/server.</summary>
|
||||
InvalidDevice = 0xA001,
|
||||
|
||||
///<summary>Invalid context ID. The Context argument does not name a valid context.</summary>
|
||||
InvalidContext = 0xA002,
|
||||
|
||||
///<summary>Bad enum. A token used is not valid, or not applicable.</summary>
|
||||
InvalidEnum = 0xA003,
|
||||
|
||||
///<summary>Bad value. A value (e.g. Attribute) is not valid, or not applicable.</summary>
|
||||
InvalidValue = 0xA004,
|
||||
|
||||
///<summary>Out of memory. Unable to allocate memory.</summary>
|
||||
OutOfMemory = 0xA005,
|
||||
}
|
||||
|
||||
public enum AlcGetString : int
|
||||
{
|
||||
///<summary>The specifier string for the default device.</summary>
|
||||
DefaultDeviceSpecifier = 0x1004,
|
||||
|
||||
///<summary>The specifier strings for all available devices.</summary>
|
||||
DeviceSpecifier = 0x1005,
|
||||
|
||||
///<summary>A list of available context extensions separated by spaces.</summary>
|
||||
Extensions = 0x1006,
|
||||
|
||||
///<summary>The name of the default capture device</summary>
|
||||
CaptureDefaultDeviceSpecifier = 0x311, // ALC_EXT_CAPTURE extension.
|
||||
|
||||
/// <summary>a list of the default devices.</summary>
|
||||
DefaultAllDevicesSpecifier = 0x1012,
|
||||
}
|
||||
|
||||
public enum AlcGetStringList : int
|
||||
{
|
||||
///<summary>The name of the specified capture device, or a list of all available capture devices if no capture device is specified.</summary>
|
||||
CaptureDeviceSpecifier = 0x310, // ALC_EXT_CAPTURE extension.
|
||||
|
||||
///<summary>The specifier string for the device.</summary>
|
||||
DeviceSpecifier = 0x1005,
|
||||
|
||||
/// <summary>A list of all available devices.</summary>
|
||||
AllDevicesSpecifier = 0x1013,
|
||||
}
|
||||
|
||||
public enum AlcGetInteger : int
|
||||
{
|
||||
///<summary>The specification revision for this implementation (major version). NULL is an acceptable device.</summary>
|
||||
MajorVersion = 0x1000,
|
||||
|
||||
///<summary>The specification revision for this implementation (minor version). NULL is an acceptable device.</summary>
|
||||
MinorVersion = 0x1001,
|
||||
|
||||
///<summary>The size (number of ALCint values) required for a zero-terminated attributes list, for the current context. NULL is an invalid device.</summary>
|
||||
AttributesSize = 0x1002,
|
||||
|
||||
///<summary>Expects a destination of ALC_ATTRIBUTES_SIZE, and provides an attribute list for the current context of the specified device. NULL is an invalid device.</summary>
|
||||
AllAttributes = 0x1003,
|
||||
|
||||
///<summary>The number of capture samples available. NULL is an invalid device.</summary>
|
||||
CaptureSamples = 0x312,
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -3,18 +3,8 @@
|
|||
* C header: \freealut-1.1.0-src\include\AL\Alut.h
|
||||
* Spec: http://www.openal.org/openal_webstf/specs/alut.html
|
||||
* Copyright (c) 2008 Christoph Brandtner and Stefanos Apostolopoulos
|
||||
* See license.txt for license details (MIT)
|
||||
* http://www.OpenTK.net
|
||||
*/
|
||||
|
||||
/* Version History:
|
||||
* 0.1
|
||||
* - The following functions are not bound/imported. Issue of undoing C malloc to prevent memory leaks.
|
||||
* "alutLoadMemoryFromFile, alutLoadMemoryFromFileImage, alutLoadMemoryHelloWorld, alutLoadMemoryWaveform"
|
||||
* Please use Alut.CreateBuffer* functions instead, which have similar functionality and return a Buffer Handle instead.
|
||||
*
|
||||
*
|
||||
*/
|
||||
* See license.txt for license details
|
||||
* http://www.OpenTK.net */
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
|
@ -23,91 +13,101 @@ using System.Security;
|
|||
|
||||
namespace OpenTK.OpenAL
|
||||
{
|
||||
|
||||
/// <summary>Alut, FreeAlut = Free Audio Library Utilities</summary>
|
||||
public static class Alut
|
||||
{
|
||||
#region Constants
|
||||
private const string Lib = "Alut.dll";
|
||||
|
||||
private const string Lib = "alut.dll";
|
||||
private const CallingConvention Style = CallingConvention.Cdecl;
|
||||
|
||||
#endregion Constants
|
||||
|
||||
#region Init/Exit
|
||||
|
||||
/// <summary>Alut.Init initializes the ALUT internals and creates an OpenAL context on the default device and makes it the current OpenAL context. If you want something more complex than that (e.g. running on a non-default device or opening multiple contexts on multiple devices), you can use alutInitWithoutContext instead. alutInit examines the commandline arguments passed to it and remove those it recognizes. It is acceptable to pass two NULL pointers in settings where no useful information can be obtained from argc and argv.</summary>
|
||||
/// <param name="argcp">Application Main Parameters</param>
|
||||
/// <param name="argv">Application Main Parameters</param>
|
||||
/// <param name="argcp">Application Main Parameters. Can be IntPtr.Zero.</param>
|
||||
/// <param name="argv">Application Main Parameters. Can be IntPtr.Zero.</param>
|
||||
/// <returns>Success.</returns>
|
||||
[DllImport( Alut.Lib, EntryPoint = "alutInit", ExactSpelling = true, CallingConvention = Alut.Style ), SuppressUnmanagedCodeSecurity( )]
|
||||
internal static extern Al.Bool Init( [In] IntPtr argcp, [In] IntPtr argv );
|
||||
[DllImport(Alut.Lib, EntryPoint = "alutInit", ExactSpelling = true, CallingConvention = Alut.Style), SuppressUnmanagedCodeSecurity()]
|
||||
public static extern AL.Bool Init([In] IntPtr argcp, [In] IntPtr argv);
|
||||
// ALUT_API ALboolean ALUT_APIENTRY alutInit (int *argcp, char **argv);
|
||||
|
||||
|
||||
/// <summary>Parameterless function for convenience. Internally passes IntPtr.Zero as parameters.</summary>
|
||||
/// <returns>Success.</returns>
|
||||
internal static Al.Bool Init( ) // overload for convenience
|
||||
public static AL.Bool Init() // overload for convenience
|
||||
{
|
||||
return Init( IntPtr.Zero, IntPtr.Zero );
|
||||
return Init(IntPtr.Zero, IntPtr.Zero);
|
||||
}
|
||||
|
||||
/// <summary>Alut.InitWithoutContext initializes the ALUT internals. It does not create any OpenAL context or device, so this has to be done via the usual ALC calls. alutInitWithoutContext examines the commandline arguments passed to it and remove those it recognizes. It is acceptable to pass two NULL pointers in settings where no useful information can be obtained from argc and argv.</summary>
|
||||
/// <param name="argcp">Application Main Parameters</param>
|
||||
/// <param name="argv">Application Main Parameters</param>
|
||||
/// <returns>Success.</returns>
|
||||
[DllImport( Alut.Lib, EntryPoint = "alutInitWithoutContext", ExactSpelling = true, CallingConvention = Alut.Style ), SuppressUnmanagedCodeSecurity( )]
|
||||
internal static extern Al.Bool InitWithoutContext( [In] IntPtr argcp, [In] IntPtr argv );
|
||||
[DllImport(Alut.Lib, EntryPoint = "alutInitWithoutContext", ExactSpelling = true, CallingConvention = Alut.Style), SuppressUnmanagedCodeSecurity()]
|
||||
public static extern AL.Bool InitWithoutContext([In] IntPtr argcp, [In] IntPtr argv);
|
||||
// ALUT_API ALboolean ALUT_APIENTRY alutInitWithoutContext (int *argcp, char **argv);
|
||||
|
||||
internal static Al.Bool InitWithoutContext( ) // overload for convenience
|
||||
/// <summary>Alut.InitWithoutContext initializes the ALUT internals. It does not create any OpenAL context or device, so this has to be done via the usual ALC calls. alutInitWithoutContext examines the commandline arguments passed to it and remove those it recognizes. It is acceptable to pass two NULL pointers in settings where no useful information can be obtained from argc and argv.</summary>
|
||||
/// <returns>Success.</returns>
|
||||
public static AL.Bool InitWithoutContext() // overload for convenience
|
||||
{
|
||||
return InitWithoutContext( IntPtr.Zero, IntPtr.Zero );
|
||||
return InitWithoutContext(IntPtr.Zero, IntPtr.Zero);
|
||||
}
|
||||
|
||||
/// <summary>When the application has finished playing audio, it should shut down ALUT using Alut.Exit. This closes any OpenAL device/context that ALUT may have created in alutInit (but not any that the application created using ALC). After calling alutExit, you may subsequently call alutInit or alutInitWithoutContext again. Note that under well-behaved operating systems, it should be acceptable to simply exit from your program without bothering to call alutExit, relying on the OS to clean up after you. However, it is dangerous to rely on this behavior if portable operation is expected.</summary>
|
||||
/// <returns>Success.</returns>
|
||||
[DllImport( Alut.Lib, EntryPoint = "alutExit", ExactSpelling = true, CallingConvention = Alut.Style ), SuppressUnmanagedCodeSecurity( )]
|
||||
internal static extern Al.Bool Exit( );
|
||||
[DllImport(Alut.Lib, EntryPoint = "alutExit", ExactSpelling = true, CallingConvention = Alut.Style), SuppressUnmanagedCodeSecurity()]
|
||||
public static extern AL.Bool Exit();
|
||||
// ALUT_API ALboolean ALUT_APIENTRY alutExit (void);
|
||||
|
||||
#endregion Init/Exit
|
||||
|
||||
#region Error Checking
|
||||
|
||||
/// <summary>Any ALUT routine that fails will return AL_FALSE / AL_NONE / NULL and set the global error state. If a subsequent error occurs while there is still an error recorded internally, the second error will simply be ignored. Calling alutGetError will reset the error code to ALUT_ERROR_NO_ERROR. Note that the error state is not cleared by other successful ALUT calls. Alut.GetError can be called in any ALUT state and will never fail.</summary>
|
||||
/// <returns><see cref="Enums.AlutError"/></returns>
|
||||
[DllImport( Alut.Lib, EntryPoint = "alutGetError", ExactSpelling = true, CallingConvention = Alut.Style ), SuppressUnmanagedCodeSecurity( )]
|
||||
internal static extern Enums.AlutError GetError( );
|
||||
[DllImport(Alut.Lib, EntryPoint = "alutGetError", ExactSpelling = true, CallingConvention = Alut.Style), SuppressUnmanagedCodeSecurity()]
|
||||
public static extern Enums.AlutError GetError();
|
||||
// ALUT_API ALenum ALUT_APIENTRY alutGetError (void);
|
||||
|
||||
[DllImport( Alut.Lib, EntryPoint = "alutGetErrorString", ExactSpelling = true, CallingConvention = Alut.Style, CharSet = CharSet.Ansi ), SuppressUnmanagedCodeSecurity( )]
|
||||
private static extern IntPtr GetErrorStringInternal( Enums.AlutError error );
|
||||
[DllImport(Alut.Lib, EntryPoint = "alutGetErrorString", ExactSpelling = true, CallingConvention = Alut.Style, CharSet = CharSet.Ansi), SuppressUnmanagedCodeSecurity()]
|
||||
private static extern IntPtr GetErrorStringPrivate(Enums.AlutError error);
|
||||
// ALUT_API const char *ALUT_APIENTRY alutGetErrorString (ALenum error);
|
||||
|
||||
/// <summary>Alut.GetErrorString can be used to convert an error code into a human-readable description. The precise text of these descriptions may vary from implementation to implementation and should not be relied upon by the application.</summary>
|
||||
/// <param name="error">Retrieve first occured error with Alut.GetError</param>
|
||||
/// <returns>A human-readable description of the Error.</returns>
|
||||
internal static string GetErrorString( Enums.AlutError error )
|
||||
public static string GetErrorString(Enums.AlutError error)
|
||||
{
|
||||
return Marshal.PtrToStringAnsi( GetErrorStringInternal( error ) );
|
||||
return Marshal.PtrToStringAnsi(GetErrorStringPrivate(error));
|
||||
}
|
||||
|
||||
#endregion Error Checking
|
||||
|
||||
#region File Loading
|
||||
#region File Loading
|
||||
|
||||
/// <summary>Alut.CreateBufferFromFile tries to guess the sound data format by looking at the filename and/or the file contents and loads the sound data into an OpenAL buffer.</summary>
|
||||
/// <param name="filename">The file to be loaded</param>
|
||||
/// <returns>OpenAL Buffer, 0 on failure.</returns>
|
||||
[DllImport( Alut.Lib, EntryPoint = "alutCreateBufferFromFile", ExactSpelling = true, CallingConvention = Alut.Style, CharSet = CharSet.Ansi ), SuppressUnmanagedCodeSecurity( )]
|
||||
internal static extern uint CreateBufferFromFile( [In] string filename );
|
||||
[CLSCompliant(false), DllImport(Alut.Lib, EntryPoint = "alutCreateBufferFromFile", ExactSpelling = true, CallingConvention = Alut.Style, CharSet = CharSet.Ansi), SuppressUnmanagedCodeSecurity()]
|
||||
public static extern uint CreateBufferFromFile([In] string filename);
|
||||
// ALUT_API ALuint ALUT_APIENTRY alutCreateBufferFromFile (const char *fileName);
|
||||
|
||||
/// <summary>Alut.CreateBufferFromFileImage tries to guess the sound data format by looking at the contents of the memory region given as parameters and loads the sound data into an OpenAL buffer.</summary>
|
||||
/// <param name="data">A Pointer to the sound data in memory.</param>
|
||||
/// <param name="length">Size in Bytes of the sound data.</param>
|
||||
/// <returns>OpenAL Buffer, 0 on failure.</returns>
|
||||
[DllImport( Alut.Lib, EntryPoint = "alutCreateBufferFromFileImage", ExactSpelling = true, CallingConvention = Alut.Style ), SuppressUnmanagedCodeSecurity( )]
|
||||
internal static extern uint CreateBufferFromFileImage( [In] IntPtr data, int length );
|
||||
[CLSCompliant(false), DllImport(Alut.Lib, EntryPoint = "alutCreateBufferFromFileImage", ExactSpelling = true, CallingConvention = Alut.Style), SuppressUnmanagedCodeSecurity()]
|
||||
public static extern uint CreateBufferFromFileImage([In] IntPtr data, int length);
|
||||
// ALUT_API ALuint ALUT_APIENTRY alutCreateBufferFromFileImage (const ALvoid *data, ALsizei length);
|
||||
|
||||
|
||||
/// <summary>Alut.CreateBufferHelloWorld returns a handle to an OpenAL buffer containing the sound of someone saying 'Hello, world!'.</summary>
|
||||
/// <returns>OpenAL Buffer, 0 on failure.</returns>
|
||||
[DllImport( Alut.Lib, EntryPoint = "alutCreateBufferHelloWorld", ExactSpelling = true, CallingConvention = Alut.Style ), SuppressUnmanagedCodeSecurity( )]
|
||||
internal static extern uint CreateBufferHelloWorld( );
|
||||
[CLSCompliant(false), DllImport(Alut.Lib, EntryPoint = "alutCreateBufferHelloWorld", ExactSpelling = true, CallingConvention = Alut.Style), SuppressUnmanagedCodeSecurity()]
|
||||
public static extern uint CreateBufferHelloWorld();
|
||||
//ALUT_API ALuint ALUT_APIENTRY alutCreateBufferHelloWorld (void);
|
||||
|
||||
/// <summary>Alut.CreateBufferWaveform returns a handle to an OpenAL buffer containing a snippet of audio with the specified waveshape at the specified frequency (in Hertz), phase (in degrees: -180 to +180) and duration (in seconds).</summary>
|
||||
|
@ -116,8 +116,8 @@ namespace OpenTK.OpenAL
|
|||
/// <param name="phase">Phase (in degrees: -180 to +180)</param>
|
||||
/// <param name="duration">Duration (in seconds)</param>
|
||||
/// <returns>OpenAL Buffer, 0 on failure.</returns>
|
||||
[DllImport( Alut.Lib, EntryPoint = "alutCreateBufferWaveform", ExactSpelling = true, CallingConvention = Alut.Style ), SuppressUnmanagedCodeSecurity( )]
|
||||
internal static extern uint CreateBufferWaveform( Enums.AlutWaveform waveshape, float frequency, float phase, float duration );
|
||||
[CLSCompliant(false), DllImport(Alut.Lib, EntryPoint = "alutCreateBufferWaveform", ExactSpelling = true, CallingConvention = Alut.Style), SuppressUnmanagedCodeSecurity()]
|
||||
public static extern uint CreateBufferWaveform(Enums.AlutWaveform waveshape, float frequency, float phase, float duration);
|
||||
// ALUT_API ALuint ALUT_APIENTRY alutCreateBufferWaveform (ALenum waveshape, ALfloat frequency, ALfloat phase, ALfloat duration);
|
||||
|
||||
// Warning: these leak memory if not properly free'd
|
||||
|
@ -125,11 +125,12 @@ namespace OpenTK.OpenAL
|
|||
// ALUT_API ALvoid *ALUT_APIENTRY alutLoadMemoryFromFileImage (const ALvoid *data, ALsizei length, ALenum *format, ALsizei *size, ALfloat *frequency);
|
||||
// ALUT_API ALvoid *ALUT_APIENTRY alutLoadMemoryHelloWorld (ALenum *format, ALsizei *size, ALfloat *frequency);
|
||||
// ALUT_API ALvoid *ALUT_APIENTRY alutLoadMemoryWaveform (ALenum waveshape, ALfloat frequency, ALfloat phase, ALfloat duration, ALenum *format, ALsizei *size, ALfloat *freq);
|
||||
|
||||
#endregion File Loading
|
||||
|
||||
#region Misc
|
||||
[DllImport( Alut.Lib, EntryPoint = "alutGetMIMETypes", ExactSpelling = true, CallingConvention = Alut.Style, CharSet = CharSet.Ansi ), SuppressUnmanagedCodeSecurity( )]
|
||||
private static extern IntPtr GetMIMETypesInternal( Enums.AlutLoader loader );
|
||||
[DllImport(Alut.Lib, EntryPoint = "alutGetMIMETypes", ExactSpelling = true, CallingConvention = Alut.Style, CharSet = CharSet.Ansi), SuppressUnmanagedCodeSecurity()]
|
||||
private static extern IntPtr GetMIMETypesPrivate(Enums.AlutLoader loader);
|
||||
// ALUT_API const char *ALUT_APIENTRY alutGetMIMETypes (ALenum loader);
|
||||
|
||||
/// <summary>Alut.GetMIMETypes returns a comma-separated list of supported MIME types for the given loader type, e.g. something like "audio/basic,audio/mpeg,audio/x-wav".
|
||||
|
@ -137,31 +138,34 @@ namespace OpenTK.OpenAL
|
|||
/// </summary>
|
||||
/// <param name="loader"><see cref="Enums.AlutLoader"/></param>
|
||||
/// <returns>A comma-separated list of supported MIME types.</returns>
|
||||
internal static string GetMIMETypes( Enums.AlutLoader loader )
|
||||
public static string GetMIMETypes(Enums.AlutLoader loader)
|
||||
{
|
||||
return Marshal.PtrToStringAnsi( GetMIMETypesInternal( loader ) );
|
||||
return Marshal.PtrToStringAnsi(GetMIMETypesPrivate(loader));
|
||||
}
|
||||
|
||||
/// <summary>Alut.GetMajorVersion returns the major version number of the ALUT in use, which will match the major version number of the corresponding ALUT specification document. Can be compared using Enums.AlutVersions.</summary>
|
||||
/// <returns>Major Version Number.</returns>
|
||||
[DllImport( Alut.Lib, EntryPoint = "alutGetMajorVersion", ExactSpelling = true, CallingConvention = Alut.Style ), SuppressUnmanagedCodeSecurity( )]
|
||||
internal static extern int GetMajorVersion( );
|
||||
[DllImport(Alut.Lib, EntryPoint = "alutGetMajorVersion", ExactSpelling = true, CallingConvention = Alut.Style), SuppressUnmanagedCodeSecurity()]
|
||||
public static extern int GetMajorVersion();
|
||||
// ALUT_API ALint ALUT_APIENTRY alutGetMajorVersion (void);
|
||||
|
||||
/// <summary>Alut.GetMinorVersion returns the minor version number of the ALUT in use, which will match the minor version number of the corresponding ALUT specification document. Can be compared using Enums.AlutVersions.</summary>
|
||||
/// <returns>Minor Version Number.</returns>
|
||||
[DllImport( Alut.Lib, EntryPoint = "alutGetMinorVersion", ExactSpelling = true, CallingConvention = Alut.Style ), SuppressUnmanagedCodeSecurity( )]
|
||||
internal static extern int GetMinorVersion( );
|
||||
[DllImport(Alut.Lib, EntryPoint = "alutGetMinorVersion", ExactSpelling = true, CallingConvention = Alut.Style), SuppressUnmanagedCodeSecurity()]
|
||||
public static extern int GetMinorVersion();
|
||||
// ALUT_API ALint ALUT_APIENTRY alutGetMinorVersion (void);
|
||||
|
||||
/*
|
||||
/// <summary>Alut.Sleep will delay the execution of the current thread for at least the given amount of seconds. It will only return earlier if a signal has been delivered to the thread, but this does not count as an error. Note that sleeping for zero seconds will give other runnable threads a chance to run.
|
||||
/// Having a general utility function like the following in an audio-related toolkit might seem strange at first, but sleeping is a common task in a lot of audio demos and it can't be done portably without cluttering the source code with #ifdefs.
|
||||
/// </summary>
|
||||
/// <param name="duration">Number of seconds. May not be negative.</param>
|
||||
/// <returns>Success.</returns>
|
||||
[DllImport( Alut.Lib, EntryPoint = "alutSleep", ExactSpelling = true, CallingConvention = Alut.Style ), SuppressUnmanagedCodeSecurity( )]
|
||||
internal static extern Al.Bool Sleep( float duration );
|
||||
public static extern AL.Bool Sleep( float duration );
|
||||
// ALUT_API ALboolean ALUT_APIENTRY alutSleep (ALfloat duration);
|
||||
*/
|
||||
#endregion Misc
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -3,89 +3,80 @@
|
|||
* C header: \freealut-1.1.0-src\include\AL\Alut.h
|
||||
* Spec: http://www.openal.org/openal_webstf/specs/alut.html
|
||||
* Copyright (c) 2008 Christoph Brandtner and Stefanos Apostolopoulos
|
||||
* See license.txt for license details (MIT)
|
||||
* http://www.OpenTK.net
|
||||
*/
|
||||
|
||||
/* Version History:
|
||||
* 0.1
|
||||
* - Tokens AL_TRUE and AL_FALSE removed, created new type. see Al.Bool
|
||||
*
|
||||
*
|
||||
*/
|
||||
* See license.txt for license details
|
||||
* http://www.OpenTK.net */
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
|
||||
namespace OpenTK.OpenAL
|
||||
namespace OpenTK.OpenAL.Enums
|
||||
{
|
||||
public partial class Enums
|
||||
|
||||
public enum AlutVersions : int
|
||||
{
|
||||
public enum AlutVersions : int
|
||||
{
|
||||
/// <summary>Defines the A in OpenAL A.B</summary>
|
||||
ApiMajorVersion = 1,
|
||||
/// <summary>Defines the B in OpenAL A.B</summary>
|
||||
ApiMinorVersion = 1,
|
||||
}
|
||||
|
||||
public enum AlutError : int
|
||||
{
|
||||
/// <summary>No ALUT error found.</summary>
|
||||
NoError = 0,
|
||||
/// <summary>ALUT ran out of memory.</summary>
|
||||
OutOfMemory = 0x200,
|
||||
/// <summary>ALUT was given an invalid enumeration token.</summary>
|
||||
InvalidEnum = 0x201,
|
||||
/// <summary>ALUT was given an invalid value.</summary>
|
||||
InvalidValue = 0x202,
|
||||
/// <summary>The operation is invalid in the current ALUT state.</summary>
|
||||
InvalidOperation = 0x203,
|
||||
/// <summary>There is no current AL context.</summary>
|
||||
NoCurrentContext = 0x204,
|
||||
/// <summary>There was already an AL error on entry to an ALUT function.</summary>
|
||||
AlErrorOnEntry = 0x205,
|
||||
/// <summary>There was already an ALC error on entry to an ALUT function.</summary>
|
||||
AlcErrorOnEntry = 0x206,
|
||||
/// <summary>There was an error opening the ALC device.</summary>
|
||||
OpenDevice = 0x207,
|
||||
/// <summary>There was an error closing the ALC device.</summary>
|
||||
CloseDevice = 0x208,
|
||||
/// <summary>There was an error creating an ALC context.</summary>
|
||||
CreateContext = 0x209,
|
||||
/// <summary>Could not change the current ALC context.</summary>
|
||||
MakeContextCurrent = 0x20A,
|
||||
/// <summary>There was an error destroying the ALC context.</summary>
|
||||
DestroyContext = 0x20B,
|
||||
/// <summary>There was an error generating an AL buffer.</summary>
|
||||
GenBuffers = 0x20C,
|
||||
/// <summary>There was an error passing buffer data to AL.</summary>
|
||||
BufferData = 0x20D,
|
||||
/// <summary>I/O error, consult errno for more details.</summary>
|
||||
IoError = 0x20E,
|
||||
/// <summary>Unsupported file type.</summary>
|
||||
UnsupportedFileType = 0x20F,
|
||||
/// <summary>Unsupported mode within an otherwise usable file type.</summary>
|
||||
UnsupportedFileSubtype = 0x210,
|
||||
/// <summary>The sound data was corrupt or truncated.</summary>
|
||||
CorruptOrTruncatedData = 0x211,
|
||||
}
|
||||
|
||||
public enum AlutWaveform : int
|
||||
{
|
||||
Sine = 0x100,
|
||||
Square = 0x101,
|
||||
SawTooth = 0x102,
|
||||
WhiteNoise = 0x103,
|
||||
Impulse = 0x104,
|
||||
}
|
||||
|
||||
public enum AlutLoader : int
|
||||
{
|
||||
///<summary>For the loaders returning sound data in an OpenAL buffer, e.g. Alut.CreateBufferFromFile and Alut.CreateBufferFromFileImage</summary>
|
||||
Buffer = 0x300,
|
||||
///<summary>For the loaders returning sound data in a newly allocated memory region, e.g. Alut.LoadMemoryFromFile and Alut.LoadMemoryFromFileImage.</summary>
|
||||
Memory = 0x301,
|
||||
}
|
||||
/// <summary>Defines the A in OpenAL A.B</summary>
|
||||
ApiMajorVersion = 1,
|
||||
/// <summary>Defines the B in OpenAL A.B</summary>
|
||||
ApiMinorVersion = 1,
|
||||
}
|
||||
|
||||
public enum AlutError : int
|
||||
{
|
||||
/// <summary>No ALUT error found.</summary>
|
||||
NoError = 0,
|
||||
/// <summary>ALUT ran out of memory.</summary>
|
||||
OutOfMemory = 0x200,
|
||||
/// <summary>ALUT was given an invalid enumeration token.</summary>
|
||||
InvalidEnum = 0x201,
|
||||
/// <summary>ALUT was given an invalid value.</summary>
|
||||
InvalidValue = 0x202,
|
||||
/// <summary>The operation is invalid in the current ALUT state.</summary>
|
||||
InvalidOperation = 0x203,
|
||||
/// <summary>There is no current AL context.</summary>
|
||||
NoCurrentContext = 0x204,
|
||||
/// <summary>There was already an AL error on entry to an ALUT function.</summary>
|
||||
AlErrorOnEntry = 0x205,
|
||||
/// <summary>There was already an ALC error on entry to an ALUT function.</summary>
|
||||
AlcErrorOnEntry = 0x206,
|
||||
/// <summary>There was an error opening the ALC device.</summary>
|
||||
OpenDevice = 0x207,
|
||||
/// <summary>There was an error closing the ALC device.</summary>
|
||||
CloseDevice = 0x208,
|
||||
/// <summary>There was an error creating an ALC context.</summary>
|
||||
CreateContext = 0x209,
|
||||
/// <summary>Could not change the current ALC context.</summary>
|
||||
MakeContextCurrent = 0x20A,
|
||||
/// <summary>There was an error destroying the ALC context.</summary>
|
||||
DestroyContext = 0x20B,
|
||||
/// <summary>There was an error generating an AL buffer.</summary>
|
||||
GenBuffers = 0x20C,
|
||||
/// <summary>There was an error passing buffer data to AL.</summary>
|
||||
BufferData = 0x20D,
|
||||
/// <summary>I/O error, consult errno for more details.</summary>
|
||||
IoError = 0x20E,
|
||||
/// <summary>Unsupported file type.</summary>
|
||||
UnsupportedFileType = 0x20F,
|
||||
/// <summary>Unsupported mode within an otherwise usable file type.</summary>
|
||||
UnsupportedFileSubtype = 0x210,
|
||||
/// <summary>The sound data was corrupt or truncated.</summary>
|
||||
CorruptOrTruncatedData = 0x211,
|
||||
}
|
||||
|
||||
public enum AlutWaveform : int
|
||||
{
|
||||
Sine = 0x100,
|
||||
Square = 0x101,
|
||||
SawTooth = 0x102,
|
||||
WhiteNoise = 0x103,
|
||||
Impulse = 0x104,
|
||||
}
|
||||
|
||||
public enum AlutLoader : int
|
||||
{
|
||||
///<summary>For the loaders returning sound data in an OpenAL buffer, e.g. Alut.CreateBufferFromFile and Alut.CreateBufferFromFileImage</summary>
|
||||
Buffer = 0x300,
|
||||
///<summary>For the loaders returning sound data in a newly allocated memory region, e.g. Alut.LoadMemoryFromFile and Alut.LoadMemoryFromFileImage.</summary>
|
||||
Memory = 0x301,
|
||||
}
|
||||
|
||||
}
|
||||
|
|
47
Source/OpenTK/OpenAL/History.txt
Normal file
47
Source/OpenTK/OpenAL/History.txt
Normal file
|
@ -0,0 +1,47 @@
|
|||
Version History:
|
||||
|
||||
0.1 Initial
|
||||
- Tokens AL_TRUE and AL_FALSE removed, created new type. see AL.Bool
|
||||
Tokens ALC_TRUE and ALC_FALSE removed, created new type. see AL.Bool
|
||||
- Added AL.Null for convenience when working with C Manuals.
|
||||
- Alut: The following functions are not bound/imported. Issue of undoing C malloc to prevent memory leaks.
|
||||
"alutLoadMemoryFromFile, alutLoadMemoryFromFileImage, alutLoadMemoryHelloWorld, alutLoadMemoryWaveform"
|
||||
Please use Alut.CreateBuffer* functions instead, which have similar functionality and return a Buffer Handle instead.
|
||||
- AL: Functions not imported:
|
||||
alListeneri, alListener3i, alListeneriv
|
||||
alGetListeneri, alGetListener3i, alGetListeneriv
|
||||
alGetBooleanv, alGetIntegerv, alGetFloatv, alGetDoublev
|
||||
imported, but currently disabled: alGetBoolean, alGetDouble
|
||||
alBufferf, alBufferfv, alBufferi, alBuffer3i, alBufferiv
|
||||
imported, but currently disabled: alBuffer3f
|
||||
alGetBufferf, alGetBuffer3f, alGetBufferfv, alGetBuffer3i, alGetBufferiv
|
||||
|
||||
0.2
|
||||
- Largely improved documentation, found homes for previously orphaned Tokens.
|
||||
- The Token AL_DATA is hidden now, as it returns a pointer to unmanaged memory
|
||||
where the buffer was located previously to calling AL.BufferData(). (It is usually freed after buffering)
|
||||
- Added Function AL.GetErrorString()
|
||||
- Added overloads for requesting/deleting a single buffer/source at a time.
|
||||
- Added Vector3 overloads where applicable.
|
||||
|
||||
0.3 - breaks former written examples.
|
||||
- Using a single changelog now, as the number of issues per file has significantly shrunk.
|
||||
- Refactored -i -fv -3f functions to be overloads e.g AL.GetSource, AL.GetListener
|
||||
- Added XRam Extension prototype. Untested, as it requires special hardware.
|
||||
- Refactored extensively to match OpenTK naming conventions.
|
||||
- Moved functions into overloads
|
||||
- Removed all C prototype comments from AL/ALC/ALUT
|
||||
- Documented Alc properly
|
||||
|
||||
0.4
|
||||
- changed Alc enum GetString/GetStringList
|
||||
- disabled Alut.Sleep, rather use Thread.Sleep
|
||||
- DopplerVelocity, ChannelMask are deprecated and marked.
|
||||
- functions with ushort, uint, ulong marked
|
||||
|
||||
0.5 vanilla complete
|
||||
- Fix Alc.GetString( Enums.AlcGetStringList ) to terminate with 2 null, and split at 1 null
|
||||
|
||||
Next Version:
|
||||
- EFX Extension
|
||||
- Enums themselves require summaries (do EFX 1st)
|
149
Source/OpenTK/OpenAL/XRamExtension.cs
Normal file
149
Source/OpenTK/OpenAL/XRamExtension.cs
Normal file
|
@ -0,0 +1,149 @@
|
|||
#region --- OpenTK.OpenAL License ---
|
||||
/* XRamExtension.cs
|
||||
* C header: \OpenAL 1.1 SDK\include\xram.h
|
||||
* Spec: ?
|
||||
* Copyright (c) 2008 Christoph Brandtner and Stefanos Apostolopoulos
|
||||
* See license.txt for license details (MIT)
|
||||
* http://www.OpenTK.net */
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace OpenTK.OpenAL
|
||||
{
|
||||
|
||||
public class XRamExtension
|
||||
{
|
||||
#region instance state
|
||||
|
||||
private bool _valid = false;
|
||||
|
||||
/// <summary>Returns True if the X-Ram Extension has been found and could be initialized.</summary>
|
||||
public bool IsInitialized
|
||||
{
|
||||
get { return _valid; }
|
||||
}
|
||||
|
||||
#endregion instance state
|
||||
|
||||
#region X-RAM Function pointer definitions
|
||||
|
||||
public unsafe delegate AL.Bool SetBufferMode(int n, ref uint buffers, int value);
|
||||
//typedef ALboolean (__cdecl *EAXSetBufferMode)(ALsizei n, ALuint *buffers, ALint value);
|
||||
|
||||
public delegate int GetBufferMode(uint buffer, out int value);
|
||||
//typedef ALenum (__cdecl *EAXGetBufferMode)(ALuint buffer, ALint *value);
|
||||
|
||||
public SetBufferMode EAXSetBufferMode;
|
||||
public GetBufferMode EAXGetBufferMode;
|
||||
|
||||
#endregion X-RAM Function pointer definitions
|
||||
|
||||
#region X-RAM Tokens
|
||||
|
||||
private int AL_EAX_RAM_SIZE, AL_EAX_RAM_FREE,
|
||||
AL_STORAGE_AUTOMATIC, AL_STORAGE_HARDWARE, AL_STORAGE_ACCESSIBLE;
|
||||
|
||||
#endregion X-RAM Tokens
|
||||
|
||||
#region Constructor / Extension Loading
|
||||
|
||||
public XRamExtension()
|
||||
{ // Query if Extension supported and retrieve Tokens/Pointers if it is.
|
||||
_valid = false;
|
||||
if (AL.IsExtensionPresent("EAX-RAM") == AL.Bool.False)
|
||||
return;
|
||||
|
||||
AL_EAX_RAM_SIZE = AL.GetEnumValue("AL_EAX_RAM_SIZE");
|
||||
AL_EAX_RAM_FREE = AL.GetEnumValue("AL_EAX_RAM_FREE");
|
||||
AL_STORAGE_AUTOMATIC = AL.GetEnumValue("AL_STORAGE_AUTOMATIC");
|
||||
AL_STORAGE_HARDWARE = AL.GetEnumValue("AL_STORAGE_HARDWARE");
|
||||
AL_STORAGE_ACCESSIBLE = AL.GetEnumValue("AL_STORAGE_ACCESSIBLE");
|
||||
|
||||
Console.WriteLine("RamSize: {0} RamFree: {1} StorageAuto: {2} StorageHW: {3} StorageAccess: {4}", AL_EAX_RAM_SIZE, AL_EAX_RAM_FREE, AL_STORAGE_AUTOMATIC, AL_STORAGE_HARDWARE, AL_STORAGE_ACCESSIBLE);
|
||||
|
||||
if (AL_EAX_RAM_SIZE == 0 ||
|
||||
AL_EAX_RAM_FREE == 0 ||
|
||||
AL_STORAGE_AUTOMATIC == 0 ||
|
||||
AL_STORAGE_HARDWARE == 0 ||
|
||||
AL_STORAGE_ACCESSIBLE == 0)
|
||||
{
|
||||
Console.WriteLine("Token values could not be retrieved.");
|
||||
return;
|
||||
}
|
||||
|
||||
Console.WriteLine("Free Ram: {0} / {1}", GetRamFree(), GetRamSize());
|
||||
|
||||
try
|
||||
{
|
||||
EAXGetBufferMode = (GetBufferMode)Marshal.GetDelegateForFunctionPointer(AL.GetProcAddress("EAXGetBufferMode"), typeof(GetBufferMode));
|
||||
EAXSetBufferMode = (SetBufferMode)Marshal.GetDelegateForFunctionPointer(AL.GetProcAddress("EAXSetBufferMode"), typeof(SetBufferMode));
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Console.WriteLine("Attempt to marshal AL.GetProcAddress failed. " + e.ToString());
|
||||
return;
|
||||
}
|
||||
|
||||
_valid = true;
|
||||
}
|
||||
|
||||
#endregion Constructor / Extension Loading
|
||||
|
||||
#region Public Methods
|
||||
|
||||
/// <summary>Query total amount of X-RAM.</summary>
|
||||
public int GetRamSize()
|
||||
{
|
||||
return AL.Get((Enums.ALGetInteger)AL_EAX_RAM_SIZE);
|
||||
}
|
||||
|
||||
/// <summary>Query free X-RAM available.</summary>
|
||||
public int GetRamFree()
|
||||
{
|
||||
return AL.Get((Enums.ALGetInteger)AL_EAX_RAM_FREE);
|
||||
}
|
||||
|
||||
public enum XRamStorage : byte
|
||||
{
|
||||
/// <summary>Put an Open AL Buffer into X-RAM if memory is available, otherwise use host RAM. This is the default mode.
|
||||
/// alGenBuffers(1, &uiBuffer);
|
||||
/// eaxSetBufferMode(1, &uiBuffer, alGetEnumValue("AL_STORAGE_AUTOMATIC"));
|
||||
/// alBufferData(...);
|
||||
/// </summary>
|
||||
Automatic,
|
||||
/// <summary>Force an Open AL Buffer into X-RAM (good for non-streaming buffers)
|
||||
// alGenBuffers(1, &uiBuffer);
|
||||
// eaxSetBufferMode(1, &uiBuffer, alGetEnumValue("AL_STORAGE_HARDWARE"));
|
||||
// alBufferData(...);
|
||||
/// </summary>
|
||||
Hardware = 1,
|
||||
/// <summary>Force an Open AL Buffer into 'accessible' (currently host) RAM (good for streaming buffers)
|
||||
/// alGenBuffers(1, &uiBuffer);
|
||||
/// eaxSetBufferMode(1, &uiBuffer, alGetEnumValue("AL_STORAGE_ACCESSIBLE"));
|
||||
/// alBufferData(...);
|
||||
/// </summary>
|
||||
Acessible = 2,
|
||||
|
||||
}
|
||||
|
||||
public void _SetBufferMode(ref uint buffer, XRamStorage mode)
|
||||
{
|
||||
switch (mode)
|
||||
{
|
||||
case XRamStorage.Acessible:
|
||||
EAXSetBufferMode(1, ref buffer, AL_STORAGE_ACCESSIBLE);
|
||||
break;
|
||||
case XRamStorage.Hardware:
|
||||
EAXSetBufferMode(1, ref buffer, AL_STORAGE_HARDWARE);
|
||||
break;
|
||||
default:
|
||||
EAXSetBufferMode(1, ref buffer, AL_STORAGE_AUTOMATIC);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue