module openal.al;

/** Deprecated macro. */

/** Supported AL version. */
version = AL_VERSION_1_0;
version = AL_VERSION_1_1;

extern (C):
/** 8-bit boolean */
alias byte ALboolean;

/** character */
alias char ALchar;

/** signed 8-bit 2's complement integer */
alias byte ALbyte;

/** unsigned 8-bit integer */
alias ubyte ALubyte;

/** signed 16-bit 2's complement integer */
alias short ALshort;

/** unsigned 16-bit integer */
alias ushort ALushort;

/** signed 32-bit 2's complement integer */
alias int ALint;

/** unsigned 32-bit integer */
alias uint ALuint;

/** non-negative 32-bit binary integer size */
alias uint ALsizei;

/** enumerated 32-bit value */
alias int ALenum;

/** 32-bit IEEE754 floating-point */
alias float ALfloat;

/** 64-bit IEEE754 floating-point */
alias double ALdouble;

/** void type (for opaque pointers only) */
alias void ALvoid;


/* Enumerant values begin at column 50. No tabs. */

/** "no distance model" or "no buffer" */
enum AL_NONE = 0;
/** Boolean False. */
enum AL_FALSE = 0;
/** Boolean True. */
enum AL_TRUE = 1;

/**
 * Relative source.
 * Type:    ALboolean
 * Range:   [AL_TRUE, AL_FALSE]
 * Default: AL_FALSE
 *
 * Specifies if the Source has relative coordinates.
 */
enum AL_SOURCE_RELATIVE = 0x202;

/**
 * Inner cone angle, in degrees.
 * Type:    ALint, ALfloat
 * Range:   [0 - 360]
 * Default: 360
 *
 * The angle covered by the inner cone, where the source will not attenuate.
 */
enum AL_CONE_INNER_ANGLE = 0x1001;
/**
 * Outer cone angle, in degrees.
 * Range:   [0 - 360]
 * Default: 360
 *
 * The angle covered by the outer cone, where the source will be fully
 * attenuated.
 */
enum AL_CONE_OUTER_ANGLE = 0x1002;
/**
 * Source pitch.
 * Type:    ALfloat
 * Range:   [0.5 - 2.0]
 * Default: 1.0
 *
 * A multiplier for the frequency (sample rate) of the source's buffer.
 */
enum AL_PITCH = 0x1003;
/**
 * Source or listener position.
 * Type:    ALfloat[3], ALint[3]
 * Default: {0, 0, 0}
 *
 * The source or listener 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.
 */
enum AL_POSITION = 0x1004;
/**
 * Source direction.
 * Type:    ALfloat[3], ALint[3]
 * Default: {0, 0, 0}
 *
 * Specifies the current direction in local space.
 * A zero-length vector specifies an omni-directional source (cone is ignored).
 */
enum AL_DIRECTION = 0x1005;
/**
 * Source or listener velocity.
 * Type:    ALfloat[3], ALint[3]
 * Default: {0, 0, 0}
 *
 * Specifies the current velocity in local space.
 */
enum AL_VELOCITY = 0x1006;
/**
 * Source looping.
 * Type:    ALboolean
 * Range:   [AL_TRUE, AL_FALSE]
 * Default: AL_FALSE
 *
 * Specifies whether source is looping.
 */
enum AL_LOOPING = 0x1007;
/**
 * Source buffer.
 * Type:  ALuint
 * Range: any valid Buffer.
 *
 * Specifies the buffer to provide sound samples.
 */
enum AL_BUFFER = 0x1009;
/**
 * Source or listener gain.
 * Type:  ALfloat
 * Range: [0.0 - ]
 *
 * A value of 1.0 means unattenuated. Each division by 2 equals an attenuation
 * of about -6dB. Each multiplicaton by 2 equals an amplification of about
 * +6dB.
 *
 * A value of 0.0 is meaningless with respect to a logarithmic scale; it is
 * silent.
 */
enum AL_GAIN = 0x100A;
/**
 * Minimum source gain.
 * Type:  ALfloat
 * Range: [0.0 - 1.0]
 *
 * The minimum gain allowed for a source, after distance and cone attenation is
 * applied (if applicable).
 */
enum AL_MIN_GAIN = 0x100D;
/**
 * Maximum source gain.
 * Type:  ALfloat
 * Range: [0.0 - 1.0]
 *
 * The maximum gain allowed for a source, after distance and cone attenation is
 * applied (if applicable).
 */
enum AL_MAX_GAIN = 0x100E;
/**
 * Listener orientation.
 * Type: ALfloat[6]
 * Default: {0.0, 0.0, -1.0, 0.0, 1.0, 0.0}
 *
 * Effectively two three dimensional vectors. The first vector is the front (or
 * "at") and the second is the top (or "up").
 *
 * Both vectors are in local space.
 */
enum AL_ORIENTATION = 0x100F;
/**
 * Source state (query only).
 * Type:  ALint
 * Range: [AL_INITIAL, AL_PLAYING, AL_PAUSED, AL_STOPPED]
 */
enum AL_SOURCE_STATE = 0x1010;
/** Source state value. */
enum AL_INITIAL = 0x1011;
enum AL_PLAYING = 0x1012;
enum AL_PAUSED = 0x1013;
enum AL_STOPPED = 0x1014;
/**
 * Source Buffer Queue size (query only).
 * Type: ALint
 *
 * The number of buffers queued using alSourceQueueBuffers, minus the buffers
 * removed with alSourceUnqueueBuffers.
 */
enum AL_BUFFERS_QUEUED = 0x1015;
/**
 * Source Buffer Queue processed count (query only).
 * Type: ALint
 *
 * The number of queued buffers that have been fully processed, and can be
 * removed with alSourceUnqueueBuffers.
 *
 * Looping sources will never fully process buffers because they will be set to
 * play again for when the source loops.
 */
enum AL_BUFFERS_PROCESSED = 0x1016;
/**
 * Source reference distance.
 * Type:    ALfloat
 * Range:   [0.0 - ]
 * Default: 1.0
 *
 * The distance in units that no attenuation occurs.
 *
 * At 0.0, no distance attenuation ever occurs on non-linear attenuation models.
 */
enum AL_REFERENCE_DISTANCE = 0x1020;
/**
 * Source rolloff factor.
 * Type:    ALfloat
 * Range:   [0.0 - ]
 * Default: 1.0
 *
 * Multiplier to exaggerate or diminish distance attenuation.
 *
 * At 0.0, no distance attenuation ever occurs.
 */
enum AL_ROLLOFF_FACTOR = 0x1021;
/**
 * Outer cone gain.
 * Type:    ALfloat
 * Range:   [0.0 - 1.0]
 * Default: 0.0
 *
 * The gain attenuation applied when the listener is outside of the source's
 * outer cone.
 */
enum AL_CONE_OUTER_GAIN = 0x1022;
/**
 * Source maximum distance.
 * Type:    ALfloat
 * Range:   [0.0 - ]
 * Default: +inf
 *
 * The distance above which the source is not attenuated any further with a
 * clamped distance model, or where attenuation reaches 0.0 gain for linear
 * distance models with a default rolloff factor.
 */
enum AL_MAX_DISTANCE = 0x1023;

/** Source buffer position, in seconds */
enum AL_SEC_OFFSET = 0x1024;
/** Source buffer position, in sample frames */
enum AL_SAMPLE_OFFSET = 0x1025;
/** Source buffer position, in bytes */
enum AL_BYTE_OFFSET = 0x1026;

/**
 * Source type (query only).
 * Type:  ALint
 * Range: [AL_STATIC, AL_STREAMING, AL_UNDETERMINED]
 *
 * A Source is Static if a Buffer has been attached using AL_BUFFER.
 *
 * A Source is Streaming if one or more Buffers have been attached using
 * alSourceQueueBuffers.
 *
 * A Source is Undetermined when it has the NULL buffer attached using
 * AL_BUFFER.
 */
enum AL_SOURCE_TYPE = 0x1027;
/** Source type value. */
enum AL_STATIC = 0x1028;
enum AL_STREAMING = 0x1029;
enum AL_UNDETERMINED = 0x1030;

/** Buffer format specifier. */
enum AL_FORMAT_MONO8 = 0x1100;
enum AL_FORMAT_MONO16 = 0x1101;
enum AL_FORMAT_STEREO8 = 0x1102;
enum AL_FORMAT_STEREO16 = 0x1103;

/** Buffer frequency (query only). */
enum AL_FREQUENCY = 0x2001;
/** Buffer bits per sample (query only). */
enum AL_BITS = 0x2002;
/** Buffer channel count (query only). */
enum AL_CHANNELS = 0x2003;
/** Buffer data size (query only). */
enum AL_SIZE = 0x2004;
/**
 * Buffer state.
 *
 * Not for public use.
 */
enum AL_UNUSED = 0x2010;
enum AL_PENDING = 0x2011;
enum AL_PROCESSED = 0x2012;

/** No error. */
enum AL_NO_ERROR = 0;
/** Invalid name paramater passed to AL call. */
enum AL_INVALID_NAME = 0xA001;
/** Invalid enum parameter passed to AL call. */
enum AL_INVALID_ENUM = 0xA002;
/** Invalid value parameter passed to AL call. */
enum AL_INVALID_VALUE = 0xA003;
/** Illegal AL call. */
enum AL_INVALID_OPERATION = 0xA004;
/** Not enough memory. */
enum AL_OUT_OF_MEMORY = 0xA005;

/** Context string: Vendor ID. */
enum AL_VENDOR = 0xB001;
/** Context string: Version. */
enum AL_VERSION = 0xB002;
/** Context string: Renderer ID. */
enum AL_RENDERER = 0xB003;
/** Context string: Space-separated extension list. */
enum AL_EXTENSIONS = 0xB004;

/**
 * Doppler scale.
 * Type:    ALfloat
 * Range:   [0.0 - ]
 * Default: 1.0
 *
 * Scale for source and listener velocities.
 */
enum AL_DOPPLER_FACTOR = 0xC000;
void  alDopplerFactor(ALfloat value);

/**
 * Doppler velocity (deprecated).
 *
 * A multiplier applied to the Speed of Sound.
 */
enum AL_DOPPLER_VELOCITY = 0xC001;
void  alDopplerVelocity(ALfloat value);

/**
 * Speed of Sound, in units per second.
 * Type:    ALfloat
 * Range:   [0.0001 - ]
 * Default: 343.3
 *
 * The speed at which sound waves are assumed to travel, when calculating the
 * doppler effect.
 */
enum AL_SPEED_OF_SOUND = 0xC003;
void  alSpeedOfSound(ALfloat value);

/**
 * Distance attenuation model.
 * Type:    ALint
 * Range:   [AL_NONE, AL_INVERSE_DISTANCE, AL_INVERSE_DISTANCE_CLAMPED,
 *           AL_LINEAR_DISTANCE, AL_LINEAR_DISTANCE_CLAMPED,
 *           AL_EXPONENT_DISTANCE, AL_EXPONENT_DISTANCE_CLAMPED]
 * Default: AL_INVERSE_DISTANCE_CLAMPED
 *
 * The model by which sources attenuate with distance.
 *
 * None     - No distance attenuation.
 * Inverse  - Doubling the distance halves the source gain.
 * Linear   - Linear gain scaling between the reference and max distances.
 * Exponent - Exponential gain dropoff.
 *
 * Clamped variations work like the non-clamped counterparts, except the
 * distance calculated is clamped between the reference and max distances.
 */
enum AL_DISTANCE_MODEL = 0xD000;
void  alDistanceModel(ALenum distanceModel);

/** Distance model value. */
enum AL_INVERSE_DISTANCE = 0xD001;
enum AL_INVERSE_DISTANCE_CLAMPED = 0xD002;
enum AL_LINEAR_DISTANCE = 0xD003;
enum AL_LINEAR_DISTANCE_CLAMPED = 0xD004;
enum AL_EXPONENT_DISTANCE = 0xD005;
enum AL_EXPONENT_DISTANCE_CLAMPED = 0xD006;

/** Renderer State management. */
void  alEnable(ALenum capability);
void  alDisable(ALenum capability);
ALboolean  alIsEnabled(ALenum capability);

/** State retrieval. */
ALchar * alGetString(ALenum param);
void  alGetBooleanv(ALenum param, ALboolean *values);
void  alGetIntegerv(ALenum param, ALint *values);
void  alGetFloatv(ALenum param, ALfloat *values);
void  alGetDoublev(ALenum param, ALdouble *values);
ALboolean  alGetBoolean(ALenum param);
ALint  alGetInteger(ALenum param);
ALfloat  alGetFloat(ALenum param);
ALdouble  alGetDouble(ALenum param);

/**
 * Error retrieval.
 *
 * Obtain the first error generated in the AL context since the last check.
 */
ALenum  alGetError();

/**
 * Extension support.
 *
 * Query for the presence of an extension, and obtain any appropriate function
 * pointers and enum values.
 */
ALboolean  alIsExtensionPresent(ALchar *extname);
void * alGetProcAddress(ALchar *fname);
ALenum  alGetEnumValue(ALchar *ename);

/** Set Listener parameters */
void  alListenerf(ALenum param, ALfloat value);
void  alListener3f(ALenum param, ALfloat value1, ALfloat value2, ALfloat value3);
void  alListenerfv(ALenum param, ALfloat *values);
void  alListeneri(ALenum param, ALint value);
void  alListener3i(ALenum param, ALint value1, ALint value2, ALint value3);
void  alListeneriv(ALenum param, ALint *values);

/** Get Listener parameters */
void  alGetListenerf(ALenum param, ALfloat *value);
void  alGetListener3f(ALenum param, ALfloat *value1, ALfloat *value2, ALfloat *value3);
void  alGetListenerfv(ALenum param, ALfloat *values);
void  alGetListeneri(ALenum param, ALint *value);
void  alGetListener3i(ALenum param, ALint *value1, ALint *value2, ALint *value3);
void  alGetListeneriv(ALenum param, ALint *values);

/** Create Source objects. */
void  alGenSources(ALsizei n, ALuint *sources);
/** Delete Source objects. */
void  alDeleteSources(ALsizei n, ALuint *sources);
/** Verify a handle is a valid Source. */
ALboolean  alIsSource(ALuint source);

/** Set Source parameters. */
void  alSourcef(ALuint source, ALenum param, ALfloat value);
void  alSource3f(ALuint source, ALenum param, ALfloat value1, ALfloat value2, ALfloat value3);
void  alSourcefv(ALuint source, ALenum param, ALfloat *values);
void  alSourcei(ALuint source, ALenum param, ALint value);
void  alSource3i(ALuint source, ALenum param, ALint value1, ALint value2, ALint value3);
void  alSourceiv(ALuint source, ALenum param, ALint *values);

/** Get Source parameters. */
void  alGetSourcef(ALuint source, ALenum param, ALfloat *value);
void  alGetSource3f(ALuint source, ALenum param, ALfloat *value1, ALfloat *value2, ALfloat *value3);
void  alGetSourcefv(ALuint source, ALenum param, ALfloat *values);
void  alGetSourcei(ALuint source, ALenum param, ALint *value);
void  alGetSource3i(ALuint source, ALenum param, ALint *value1, ALint *value2, ALint *value3);
void  alGetSourceiv(ALuint source, ALenum param, ALint *values);

/** Play, replay, or resume (if paused) a list of Sources */
void  alSourcePlayv(ALsizei n, ALuint *sources);
/** Stop a list of Sources */
void  alSourceStopv(ALsizei n, ALuint *sources);
/** Rewind a list of Sources */
void  alSourceRewindv(ALsizei n, ALuint *sources);
/** Pause a list of Sources */
void  alSourcePausev(ALsizei n, ALuint *sources);

/** Play, replay, or resume a Source */
void  alSourcePlay(ALuint source);
/** Stop a Source */
void  alSourceStop(ALuint source);
/** Rewind a Source (set playback postiton to beginning) */
void  alSourceRewind(ALuint source);
/** Pause a Source */
void  alSourcePause(ALuint source);

/** Queue buffers onto a source */
void  alSourceQueueBuffers(ALuint source, ALsizei nb, ALuint *buffers);
/** Unqueue processed buffers from a source */
void  alSourceUnqueueBuffers(ALuint source, ALsizei nb, ALuint *buffers);


/** Create Buffer objects */
void  alGenBuffers(ALsizei n, ALuint *buffers);
/** Delete Buffer objects */
void  alDeleteBuffers(ALsizei n, ALuint *buffers);
/** Verify a handle is a valid Buffer */
ALboolean  alIsBuffer(ALuint buffer);

/** Specifies the data to be copied into a buffer */
void  alBufferData(ALuint buffer, ALenum format, ALvoid *data, ALsizei size, ALsizei freq);

/** Set Buffer parameters, */
void  alBufferf(ALuint buffer, ALenum param, ALfloat value);
void  alBuffer3f(ALuint buffer, ALenum param, ALfloat value1, ALfloat value2, ALfloat value3);
void  alBufferfv(ALuint buffer, ALenum param, ALfloat *values);
void  alBufferi(ALuint buffer, ALenum param, ALint value);
void  alBuffer3i(ALuint buffer, ALenum param, ALint value1, ALint value2, ALint value3);
void  alBufferiv(ALuint buffer, ALenum param, ALint *values);

/** Get Buffer parameters. */
void  alGetBufferf(ALuint buffer, ALenum param, ALfloat *value);
void  alGetBuffer3f(ALuint buffer, ALenum param, ALfloat *value1, ALfloat *value2, ALfloat *value3);
void  alGetBufferfv(ALuint buffer, ALenum param, ALfloat *values);
void  alGetBufferi(ALuint buffer, ALenum param, ALint *value);
void  alGetBuffer3i(ALuint buffer, ALenum param, ALint *value1, ALint *value2, ALint *value3);
void  alGetBufferiv(ALuint buffer, ALenum param, ALint *values);

/** Pointer-to-function type, useful for dynamically getting AL entry points. */
alias void  function(ALenum capability)LPALENABLE;
alias void  function(ALenum capability)LPALDISABLE;
alias ALboolean  function(ALenum capability)LPALISENABLED;
alias ALchar * function(ALenum param)LPALGETSTRING;
alias void  function(ALenum param, ALboolean *values)LPALGETBOOLEANV;
alias void  function(ALenum param, ALint *values)LPALGETINTEGERV;
alias void  function(ALenum param, ALfloat *values)LPALGETFLOATV;
alias void  function(ALenum param, ALdouble *values)LPALGETDOUBLEV;
alias ALboolean  function(ALenum param)LPALGETBOOLEAN;
alias ALint  function(ALenum param)LPALGETINTEGER;
alias ALfloat  function(ALenum param)LPALGETFLOAT;
alias ALdouble  function(ALenum param)LPALGETDOUBLE;
alias ALenum  function()LPALGETERROR;
alias ALboolean  function(ALchar *extname)LPALISEXTENSIONPRESENT;
alias void * function(ALchar *fname)LPALGETPROCADDRESS;
alias ALenum  function(ALchar *ename)LPALGETENUMVALUE;
alias void  function(ALenum param, ALfloat value)LPALLISTENERF;
alias void  function(ALenum param, ALfloat value1, ALfloat value2, ALfloat value3)LPALLISTENER3F;
alias void  function(ALenum param, ALfloat *values)LPALLISTENERFV;
alias void  function(ALenum param, ALint value)LPALLISTENERI;
alias void  function(ALenum param, ALint value1, ALint value2, ALint value3)LPALLISTENER3I;
alias void  function(ALenum param, ALint *values)LPALLISTENERIV;
alias void  function(ALenum param, ALfloat *value)LPALGETLISTENERF;
alias void  function(ALenum param, ALfloat *value1, ALfloat *value2, ALfloat *value3)LPALGETLISTENER3F;
alias void  function(ALenum param, ALfloat *values)LPALGETLISTENERFV;
alias void  function(ALenum param, ALint *value)LPALGETLISTENERI;
alias void  function(ALenum param, ALint *value1, ALint *value2, ALint *value3)LPALGETLISTENER3I;
alias void  function(ALenum param, ALint *values)LPALGETLISTENERIV;
alias void  function(ALsizei n, ALuint *sources)LPALGENSOURCES;
alias void  function(ALsizei n, ALuint *sources)LPALDELETESOURCES;
alias ALboolean  function(ALuint source)LPALISSOURCE;
alias void  function(ALuint source, ALenum param, ALfloat value)LPALSOURCEF;
alias void  function(ALuint source, ALenum param, ALfloat value1, ALfloat value2, ALfloat value3)LPALSOURCE3F;
alias void  function(ALuint source, ALenum param, ALfloat *values)LPALSOURCEFV;
alias void  function(ALuint source, ALenum param, ALint value)LPALSOURCEI;
alias void  function(ALuint source, ALenum param, ALint value1, ALint value2, ALint value3)LPALSOURCE3I;
alias void  function(ALuint source, ALenum param, ALint *values)LPALSOURCEIV;
alias void  function(ALuint source, ALenum param, ALfloat *value)LPALGETSOURCEF;
alias void  function(ALuint source, ALenum param, ALfloat *value1, ALfloat *value2, ALfloat *value3)LPALGETSOURCE3F;
alias void  function(ALuint source, ALenum param, ALfloat *values)LPALGETSOURCEFV;
alias void  function(ALuint source, ALenum param, ALint *value)LPALGETSOURCEI;
alias void  function(ALuint source, ALenum param, ALint *value1, ALint *value2, ALint *value3)LPALGETSOURCE3I;
alias void  function(ALuint source, ALenum param, ALint *values)LPALGETSOURCEIV;
alias void  function(ALsizei n, ALuint *sources)LPALSOURCEPLAYV;
alias void  function(ALsizei n, ALuint *sources)LPALSOURCESTOPV;
alias void  function(ALsizei n, ALuint *sources)LPALSOURCEREWINDV;
alias void  function(ALsizei n, ALuint *sources)LPALSOURCEPAUSEV;
alias void  function(ALuint source)LPALSOURCEPLAY;
alias void  function(ALuint source)LPALSOURCESTOP;
alias void  function(ALuint source)LPALSOURCEREWIND;
alias void  function(ALuint source)LPALSOURCEPAUSE;
alias void  function(ALuint source, ALsizei nb, ALuint *buffers)LPALSOURCEQUEUEBUFFERS;
alias void  function(ALuint source, ALsizei nb, ALuint *buffers)LPALSOURCEUNQUEUEBUFFERS;
alias void  function(ALsizei n, ALuint *buffers)LPALGENBUFFERS;
alias void  function(ALsizei n, ALuint *buffers)LPALDELETEBUFFERS;
alias ALboolean  function(ALuint buffer)LPALISBUFFER;
alias void  function(ALuint buffer, ALenum format, ALvoid *data, ALsizei size, ALsizei freq)LPALBUFFERDATA;
alias void  function(ALuint buffer, ALenum param, ALfloat value)LPALBUFFERF;
alias void  function(ALuint buffer, ALenum param, ALfloat value1, ALfloat value2, ALfloat value3)LPALBUFFER3F;
alias void  function(ALuint buffer, ALenum param, ALfloat *values)LPALBUFFERFV;
alias void  function(ALuint buffer, ALenum param, ALint value)LPALBUFFERI;
alias void  function(ALuint buffer, ALenum param, ALint value1, ALint value2, ALint value3)LPALBUFFER3I;
alias void  function(ALuint buffer, ALenum param, ALint *values)LPALBUFFERIV;
alias void  function(ALuint buffer, ALenum param, ALfloat *value)LPALGETBUFFERF;
alias void  function(ALuint buffer, ALenum param, ALfloat *value1, ALfloat *value2, ALfloat *value3)LPALGETBUFFER3F;
alias void  function(ALuint buffer, ALenum param, ALfloat *values)LPALGETBUFFERFV;
alias void  function(ALuint buffer, ALenum param, ALint *value)LPALGETBUFFERI;
alias void  function(ALuint buffer, ALenum param, ALint *value1, ALint *value2, ALint *value3)LPALGETBUFFER3I;
alias void  function(ALuint buffer, ALenum param, ALint *values)LPALGETBUFFERIV;
alias void  function(ALfloat value)LPALDOPPLERFACTOR;
alias void  function(ALfloat value)LPALDOPPLERVELOCITY;
alias void  function(ALfloat value)LPALSPEEDOFSOUND;
alias void  function(ALenum distanceModel)LPALDISTANCEMODEL;

