OpenAL patch from Hunter_rus... haven't even tried to make this work with MSVC yet

git-svn-id: https://svn.eduke32.com/eduke32@634 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2008-03-08 05:23:15 +00:00
parent a736fc08e0
commit 74d7485a19
39 changed files with 2893 additions and 67 deletions

View file

@ -238,12 +238,7 @@ static tokenlist texturetokens_pal[] =
{ "nocompress", T_NOCOMPRESS },
};
static tokenlist musictokens[] =
{
{ "id", T_ID },
{ "file", T_FILE },
};
static tokenlist soundtokens[] =
static tokenlist sound_musictokens[] =
{
{ "id", T_ID },
{ "file", T_FILE },
@ -1549,19 +1544,19 @@ case T_REDPAL: case T_BLUEPAL: case T_BROWNPAL: case T_GREYPAL: case T_GREENPAL:
case T_MUSIC:
{
char *tinttokptr = script->ltextptr;
char *ID=0,*ext="";
char *musicend;
char *dummy, *dummy2;
if (scriptfile_getbraces(script,&musicend)) break;
while (script->textptr < musicend)
if (scriptfile_getbraces(script,&dummy)) break;
while (script->textptr < dummy)
{
switch (getatoken(script,musictokens,sizeof(musictokens)/sizeof(tokenlist)))
switch (getatoken(script,sound_musictokens,sizeof(sound_musictokens)/sizeof(tokenlist)))
{
case T_ID:
scriptfile_getstring(script,&ID); break;
scriptfile_getstring(script,&dummy2);
break;
case T_FILE:
scriptfile_getstring(script,&ext);
scriptfile_getstring(script,&dummy2);
break;
}
}
}
@ -1569,19 +1564,19 @@ case T_REDPAL: case T_BLUEPAL: case T_BROWNPAL: case T_GREYPAL: case T_GREENPAL:
case T_SOUND:
{
char *tinttokptr = script->ltextptr;
char *name=0;int num=0;
char *musicend;
char *dummy, *dummy2;
if (scriptfile_getbraces(script,&musicend)) break;
while (script->textptr < musicend)
if (scriptfile_getbraces(script,&dummy)) break;
while (script->textptr < dummy)
{
switch (getatoken(script,soundtokens,sizeof(soundtokens)/sizeof(tokenlist)))
switch (getatoken(script,sound_musictokens,sizeof(sound_musictokens)/sizeof(tokenlist)))
{
case T_ID:
scriptfile_getsymbol(script,&num);break;
scriptfile_getsymbol(script,(intptr_t *)&dummy2);
break;
case T_FILE:
scriptfile_getstring(script,&name);
scriptfile_getstring(script,&dummy2);
break;
}
}
}

View file

@ -148,7 +148,7 @@ static int set_socket_blockmode(SOCKET socket, int onOrOff)
#ifdef _WIN32
flags = (onOrOff) ? 0 : 1;
rc = (ioctlsocket(socket, FIONBIO, &flags) == 0);
rc = (ioctlsocket(socket, FIONBIO, (void *)&flags) == 0);
#else
flags = fcntl(socket, F_GETFL, 0);
if (flags != -1)

View file

@ -1283,6 +1283,8 @@ int polymer_cliptofrustum(short wallnum)
GLfloat intersect[3], *frustum;
int i, j, k, l, m, result, exitpoint;
exitpoint = 0; // annoying "warning: 'exitpoint' may be used uninialized in this function"
frustum = &frustumstack[frustumstackposition];
result = 4; // 4 points to start with
if (pr_verbosity >= 3) OSD_Printf("PR : Clipping wall %d...\n", wallnum);

View file

@ -0,0 +1,732 @@
#ifndef AL_AL_H
#define AL_AL_H
#if defined(__cplusplus)
extern "C" {
#endif
#if defined(_WIN32) && !defined(_XBOX)
/* _OPENAL32LIB is deprecated */
#if defined(AL_BUILD_LIBRARY) || defined (_OPENAL32LIB)
#define AL_API __declspec(dllexport)
#else
#define AL_API __declspec(dllimport)
#endif
#else
#define AL_API extern
#endif
#if defined(_WIN32)
#define AL_APIENTRY __cdecl
#else
#define AL_APIENTRY
#endif
#if TARGET_OS_MAC
#pragma export on
#endif
/* The OPENAL, ALAPI, and ALAPIENTRY macros are deprecated, but are included for applications porting code
from AL 1.0 */
#define OPENAL
#define ALAPI AL_API
#define ALAPIENTRY AL_APIENTRY
#define AL_VERSION_1_0
#define AL_VERSION_1_1
/** 8-bit boolean */
typedef char ALboolean;
/** character */
typedef char ALchar;
/** signed 8-bit 2's complement integer */
typedef char ALbyte;
/** unsigned 8-bit integer */
typedef unsigned char ALubyte;
/** signed 16-bit 2's complement integer */
typedef short ALshort;
/** unsigned 16-bit integer */
typedef unsigned short ALushort;
/** signed 32-bit 2's complement integer */
typedef int ALint;
/** unsigned 32-bit integer */
typedef unsigned int ALuint;
/** non-negative 32-bit binary integer size */
typedef unsigned ALsizei;
/** enumerated 32-bit value */
typedef int ALenum;
/** 32-bit IEEE754 floating-point */
typedef float ALfloat;
/** 64-bit IEEE754 floating-point */
typedef double ALdouble;
/** void type (for opaque pointers only) */
typedef void ALvoid;
/* Enumerant values begin at column 50. No tabs. */
/* bad value */
#define AL_INVALID -1
#define AL_NONE 0
/* Boolean False. */
#define AL_FALSE 0
/** Boolean True. */
#define AL_TRUE 1
/** Indicate Source has relative coordinates. */
#define AL_SOURCE_RELATIVE 0x202
/**
* Directional source, inner cone angle, in degrees.
* Range: [0-360]
* Default: 360
*/
#define AL_CONE_INNER_ANGLE 0x1001
/**
* Directional source, outer cone angle, in degrees.
* Range: [0-360]
* Default: 360
*/
#define AL_CONE_OUTER_ANGLE 0x1002
/**
* Specify the pitch to be applied, either at source,
* or on mixer results, at listener.
* Range: [0.5-2.0]
* Default: 1.0
*/
#define AL_PITCH 0x1003
/**
* 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.
*/
#define AL_POSITION 0x1004
/** Specify the current direction. */
#define AL_DIRECTION 0x1005
/** Specify the current velocity in three dimensional space. */
#define AL_VELOCITY 0x1006
/**
* Indicate whether source is looping.
* Type: ALboolean?
* Range: [AL_TRUE, AL_FALSE]
* Default: FALSE.
*/
#define AL_LOOPING 0x1007
/**
* Indicate the buffer to provide sound samples.
* Type: ALuint.
* Range: any valid Buffer id.
*/
#define AL_BUFFER 0x1009
/**
* Indicate the gain (volume amplification) applied.
* Type: ALfloat.
* Range: ]0.0- ]
* 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.0 is meaningless with respect to a logarithmic
* scale; it is interpreted as zero volume - the channel
* is effectively disabled.
*/
#define AL_GAIN 0x100A
/*
* Indicate minimum source attenuation
* Type: ALfloat
* Range: [0.0 - 1.0]
*
* Logarthmic
*/
#define AL_MIN_GAIN 0x100D
/**
* Indicate maximum source attenuation
* Type: ALfloat
* Range: [0.0 - 1.0]
*
* Logarthmic
*/
#define AL_MAX_GAIN 0x100E
/**
* Indicate listener orientation.
*
* at/up
*/
#define AL_ORIENTATION 0x100F
/**
* Specify the channel mask. (Creative)
* Type: ALuint
* Range: [0 - 255]
*/
#define AL_CHANNEL_MASK 0x3000
/**
* Source state information.
*/
#define AL_SOURCE_STATE 0x1010
#define AL_INITIAL 0x1011
#define AL_PLAYING 0x1012
#define AL_PAUSED 0x1013
#define AL_STOPPED 0x1014
/**
* Buffer Queue params
*/
#define AL_BUFFERS_QUEUED 0x1015
#define AL_BUFFERS_PROCESSED 0x1016
/**
* Source buffer position information
*/
#define AL_SEC_OFFSET 0x1024
#define AL_SAMPLE_OFFSET 0x1025
#define AL_BYTE_OFFSET 0x1026
/*
* Source type (Static, Streaming or undetermined)
* Source is Static if a Buffer has been attached using AL_BUFFER
* Source is Streaming if one or more Buffers have been attached using alSourceQueueBuffers
* Source is undetermined when it has the NULL buffer attached
*/
#define AL_SOURCE_TYPE 0x1027
#define AL_STATIC 0x1028
#define AL_STREAMING 0x1029
#define AL_UNDETERMINED 0x1030
/** Sound samples: format specifier. */
#define AL_FORMAT_MONO8 0x1100
#define AL_FORMAT_MONO16 0x1101
#define AL_FORMAT_STEREO8 0x1102
#define AL_FORMAT_STEREO16 0x1103
/**
* source specific reference distance
* Type: ALfloat
* Range: 0.0 - +inf
*
* At 0.0, no distance attenuation occurs. Default is
* 1.0.
*/
#define AL_REFERENCE_DISTANCE 0x1020
/**
* source specific rolloff factor
* Type: ALfloat
* Range: 0.0 - +inf
*
*/
#define AL_ROLLOFF_FACTOR 0x1021
/**
* Directional source, outer cone gain.
*
* Default: 0.0
* Range: [0.0 - 1.0]
* Logarithmic
*/
#define AL_CONE_OUTER_GAIN 0x1022
/**
* Indicate distance above which sources are not
* attenuated using the inverse clamped distance model.
*
* Default: +inf
* Type: ALfloat
* Range: 0.0 - +inf
*/
#define AL_MAX_DISTANCE 0x1023
/**
* 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.
*/
#define AL_FREQUENCY 0x2001
#define AL_BITS 0x2002
#define AL_CHANNELS 0x2003
#define AL_SIZE 0x2004
/**
* Buffer state.
*
* Not supported for public use (yet).
*/
#define AL_UNUSED 0x2010
#define AL_PENDING 0x2011
#define AL_PROCESSED 0x2012
/** Errors: No Error. */
#define AL_NO_ERROR AL_FALSE
/**
* Invalid Name paramater passed to AL call.
*/
#define AL_INVALID_NAME 0xA001
/**
* Invalid parameter passed to AL call.
*/
#define AL_ILLEGAL_ENUM 0xA002
#define AL_INVALID_ENUM 0xA002
/**
* Invalid enum parameter value.
*/
#define AL_INVALID_VALUE 0xA003
/**
* Illegal call.
*/
#define AL_ILLEGAL_COMMAND 0xA004
#define AL_INVALID_OPERATION 0xA004
/**
* No mojo.
*/
#define AL_OUT_OF_MEMORY 0xA005
/** Context strings: Vendor Name. */
#define AL_VENDOR 0xB001
#define AL_VERSION 0xB002
#define AL_RENDERER 0xB003
#define AL_EXTENSIONS 0xB004
/** Global tweakage. */
/**
* Doppler scale. Default 1.0
*/
#define AL_DOPPLER_FACTOR 0xC000
/**
* Tweaks speed of propagation.
*/
#define AL_DOPPLER_VELOCITY 0xC001
/**
* Speed of Sound in units per second
*/
#define AL_SPEED_OF_SOUND 0xC003
/**
* Distance models
*
* used in conjunction with DistanceModel
*
* implicit: NONE, which disances distance attenuation.
*/
#define AL_DISTANCE_MODEL 0xD000
#define AL_INVERSE_DISTANCE 0xD001
#define AL_INVERSE_DISTANCE_CLAMPED 0xD002
#define AL_LINEAR_DISTANCE 0xD003
#define AL_LINEAR_DISTANCE_CLAMPED 0xD004
#define AL_EXPONENT_DISTANCE 0xD005
#define AL_EXPONENT_DISTANCE_CLAMPED 0xD006
#if !defined(AL_NO_PROTOTYPES)
/*
* Renderer State management
*/
AL_API void AL_APIENTRY alEnable( ALenum capability );
AL_API void AL_APIENTRY alDisable( ALenum capability );
AL_API ALboolean AL_APIENTRY alIsEnabled( ALenum capability );
/*
* State retrieval
*/
AL_API const ALchar* AL_APIENTRY alGetString( ALenum param );
AL_API void AL_APIENTRY alGetBooleanv( ALenum param, ALboolean* data );
AL_API void AL_APIENTRY alGetIntegerv( ALenum param, ALint* data );
AL_API void AL_APIENTRY alGetFloatv( ALenum param, ALfloat* data );
AL_API void AL_APIENTRY alGetDoublev( ALenum param, ALdouble* data );
AL_API ALboolean AL_APIENTRY alGetBoolean( ALenum param );
AL_API ALint AL_APIENTRY alGetInteger( ALenum param );
AL_API ALfloat AL_APIENTRY alGetFloat( ALenum param );
AL_API ALdouble AL_APIENTRY alGetDouble( ALenum param );
/*
* Error support.
* Obtain the most recent error generated in the AL state machine.
*/
AL_API ALenum AL_APIENTRY alGetError( void );
/*
* Extension support.
* Query for the presence of an extension, and obtain any appropriate
* function pointers and enum values.
*/
AL_API ALboolean AL_APIENTRY alIsExtensionPresent( const ALchar* extname );
AL_API void* AL_APIENTRY alGetProcAddress( const ALchar* fname );
AL_API ALenum AL_APIENTRY alGetEnumValue( const ALchar* ename );
/*
* LISTENER
* Listener represents the location and orientation of the
* 'user' in 3D-space.
*
* Properties include: -
*
* Gain AL_GAIN ALfloat
* Position AL_POSITION ALfloat[3]
* Velocity AL_VELOCITY ALfloat[3]
* Orientation AL_ORIENTATION ALfloat[6] (Forward then Up vectors)
*/
/*
* Set Listener parameters
*/
AL_API void AL_APIENTRY alListenerf( ALenum param, ALfloat value );
AL_API void AL_APIENTRY alListener3f( ALenum param, ALfloat value1, ALfloat value2, ALfloat value3 );
AL_API void AL_APIENTRY alListenerfv( ALenum param, const ALfloat* values );
AL_API void AL_APIENTRY alListeneri( ALenum param, ALint value );
AL_API void AL_APIENTRY alListener3i( ALenum param, ALint value1, ALint value2, ALint value3 );
AL_API void AL_APIENTRY alListeneriv( ALenum param, const ALint* values );
/*
* Get Listener parameters
*/
AL_API void AL_APIENTRY alGetListenerf( ALenum param, ALfloat* value );
AL_API void AL_APIENTRY alGetListener3f( ALenum param, ALfloat *value1, ALfloat *value2, ALfloat *value3 );
AL_API void AL_APIENTRY alGetListenerfv( ALenum param, ALfloat* values );
AL_API void AL_APIENTRY alGetListeneri( ALenum param, ALint* value );
AL_API void AL_APIENTRY alGetListener3i( ALenum param, ALint *value1, ALint *value2, ALint *value3 );
AL_API void AL_APIENTRY alGetListeneriv( ALenum param, ALint* values );
/**
* SOURCE
* Sources represent individual sound objects in 3D-space.
* Sources take the PCM data provided in the specified Buffer,
* apply Source-specific modifications, and then
* submit them to be mixed according to spatial arrangement etc.
*
* Properties include: -
*
* Gain AL_GAIN ALfloat
* Min Gain AL_MIN_GAIN ALfloat
* Max Gain AL_MAX_GAIN ALfloat
* Position AL_POSITION ALfloat[3]
* Velocity AL_VELOCITY ALfloat[3]
* Direction AL_DIRECTION ALfloat[3]
* Head Relative Mode AL_SOURCE_RELATIVE ALint (AL_TRUE or AL_FALSE)
* Reference Distance AL_REFERENCE_DISTANCE ALfloat
* Max Distance AL_MAX_DISTANCE ALfloat
* RollOff Factor AL_ROLLOFF_FACTOR ALfloat
* Inner Angle AL_CONE_INNER_ANGLE ALint or ALfloat
* Outer Angle AL_CONE_OUTER_ANGLE ALint or ALfloat
* Cone Outer Gain AL_CONE_OUTER_GAIN ALint or ALfloat
* Pitch AL_PITCH ALfloat
* Looping AL_LOOPING ALint (AL_TRUE or AL_FALSE)
* MS Offset AL_MSEC_OFFSET ALint or ALfloat
* Byte Offset AL_BYTE_OFFSET ALint or ALfloat
* Sample Offset AL_SAMPLE_OFFSET ALint or ALfloat
* Attached Buffer AL_BUFFER ALint
* State (Query only) AL_SOURCE_STATE ALint
* Buffers Queued (Query only) AL_BUFFERS_QUEUED ALint
* Buffers Processed (Query only) AL_BUFFERS_PROCESSED ALint
*/
/* Create Source objects */
AL_API void AL_APIENTRY alGenSources( ALsizei n, ALuint* sources );
/* Delete Source objects */
AL_API void AL_APIENTRY alDeleteSources( ALsizei n, const ALuint* sources );
/* Verify a handle is a valid Source */
AL_API ALboolean AL_APIENTRY alIsSource( ALuint sid );
/*
* Set Source parameters
*/
AL_API void AL_APIENTRY alSourcef( ALuint sid, ALenum param, ALfloat value );
AL_API void AL_APIENTRY alSource3f( ALuint sid, ALenum param, ALfloat value1, ALfloat value2, ALfloat value3 );
AL_API void AL_APIENTRY alSourcefv( ALuint sid, ALenum param, const ALfloat* values );
AL_API void AL_APIENTRY alSourcei( ALuint sid, ALenum param, ALint value );
AL_API void AL_APIENTRY alSource3i( ALuint sid, ALenum param, ALint value1, ALint value2, ALint value3 );
AL_API void AL_APIENTRY alSourceiv( ALuint sid, ALenum param, const ALint* values );
/*
* Get Source parameters
*/
AL_API void AL_APIENTRY alGetSourcef( ALuint sid, ALenum param, ALfloat* value );
AL_API void AL_APIENTRY alGetSource3f( ALuint sid, ALenum param, ALfloat* value1, ALfloat* value2, ALfloat* value3);
AL_API void AL_APIENTRY alGetSourcefv( ALuint sid, ALenum param, ALfloat* values );
AL_API void AL_APIENTRY alGetSourcei( ALuint sid, ALenum param, ALint* value );
AL_API void AL_APIENTRY alGetSource3i( ALuint sid, ALenum param, ALint* value1, ALint* value2, ALint* value3);
AL_API void AL_APIENTRY alGetSourceiv( ALuint sid, ALenum param, ALint* values );
/*
* Source vector based playback calls
*/
/* Play, replay, or resume (if paused) a list of Sources */
AL_API void AL_APIENTRY alSourcePlayv( ALsizei ns, const ALuint *sids );
/* Stop a list of Sources */
AL_API void AL_APIENTRY alSourceStopv( ALsizei ns, const ALuint *sids );
/* Rewind a list of Sources */
AL_API void AL_APIENTRY alSourceRewindv( ALsizei ns, const ALuint *sids );
/* Pause a list of Sources */
AL_API void AL_APIENTRY alSourcePausev( ALsizei ns, const ALuint *sids );
/*
* Source based playback calls
*/
/* Play, replay, or resume a Source */
AL_API void AL_APIENTRY alSourcePlay( ALuint sid );
/* Stop a Source */
AL_API void AL_APIENTRY alSourceStop( ALuint sid );
/* Rewind a Source (set playback postiton to beginning) */
AL_API void AL_APIENTRY alSourceRewind( ALuint sid );
/* Pause a Source */
AL_API void AL_APIENTRY alSourcePause( ALuint sid );
/*
* Source Queuing
*/
AL_API void AL_APIENTRY alSourceQueueBuffers( ALuint sid, ALsizei numEntries, const ALuint *bids );
AL_API void AL_APIENTRY alSourceUnqueueBuffers( ALuint sid, ALsizei numEntries, ALuint *bids );
/**
* BUFFER
* Buffer objects are storage space for sample data.
* Buffers are referred to by Sources. One Buffer can be used
* by multiple Sources.
*
* Properties include: -
*
* Frequency (Query only) AL_FREQUENCY ALint
* Size (Query only) AL_SIZE ALint
* Bits (Query only) AL_BITS ALint
* Channels (Query only) AL_CHANNELS ALint
*/
/* Create Buffer objects */
AL_API void AL_APIENTRY alGenBuffers( ALsizei n, ALuint* buffers );
/* Delete Buffer objects */
AL_API void AL_APIENTRY alDeleteBuffers( ALsizei n, const ALuint* buffers );
/* Verify a handle is a valid Buffer */
AL_API ALboolean AL_APIENTRY alIsBuffer( ALuint bid );
/* Specify the data to be copied into a buffer */
AL_API void AL_APIENTRY alBufferData( ALuint bid, ALenum format, const ALvoid* data, ALsizei size, ALsizei freq );
/*
* Set Buffer parameters
*/
AL_API void AL_APIENTRY alBufferf( ALuint bid, ALenum param, ALfloat value );
AL_API void AL_APIENTRY alBuffer3f( ALuint bid, ALenum param, ALfloat value1, ALfloat value2, ALfloat value3 );
AL_API void AL_APIENTRY alBufferfv( ALuint bid, ALenum param, const ALfloat* values );
AL_API void AL_APIENTRY alBufferi( ALuint bid, ALenum param, ALint value );
AL_API void AL_APIENTRY alBuffer3i( ALuint bid, ALenum param, ALint value1, ALint value2, ALint value3 );
AL_API void AL_APIENTRY alBufferiv( ALuint bid, ALenum param, const ALint* values );
/*
* Get Buffer parameters
*/
AL_API void AL_APIENTRY alGetBufferf( ALuint bid, ALenum param, ALfloat* value );
AL_API void AL_APIENTRY alGetBuffer3f( ALuint bid, ALenum param, ALfloat* value1, ALfloat* value2, ALfloat* value3);
AL_API void AL_APIENTRY alGetBufferfv( ALuint bid, ALenum param, ALfloat* values );
AL_API void AL_APIENTRY alGetBufferi( ALuint bid, ALenum param, ALint* value );
AL_API void AL_APIENTRY alGetBuffer3i( ALuint bid, ALenum param, ALint* value1, ALint* value2, ALint* value3);
AL_API void AL_APIENTRY alGetBufferiv( ALuint bid, ALenum param, ALint* values );
/*
* Global Parameters
*/
AL_API void AL_APIENTRY alDopplerFactor( ALfloat value );
AL_API void AL_APIENTRY alDopplerVelocity( ALfloat value );
AL_API void AL_APIENTRY alSpeedOfSound( ALfloat value );
AL_API void AL_APIENTRY alDistanceModel( ALenum distanceModel );
#else /* AL_NO_PROTOTYPES */
typedef void (AL_APIENTRY *LPALENABLE)( ALenum capability );
typedef void (AL_APIENTRY *LPALDISABLE)( ALenum capability );
typedef ALboolean (AL_APIENTRY *LPALISENABLED)( ALenum capability );
typedef const ALchar* (AL_APIENTRY *LPALGETSTRING)( ALenum param );
typedef void (AL_APIENTRY *LPALGETBOOLEANV)( ALenum param, ALboolean* data );
typedef void (AL_APIENTRY *LPALGETINTEGERV)( ALenum param, ALint* data );
typedef void (AL_APIENTRY *LPALGETFLOATV)( ALenum param, ALfloat* data );
typedef void (AL_APIENTRY *LPALGETDOUBLEV)( ALenum param, ALdouble* data );
typedef ALboolean (AL_APIENTRY *LPALGETBOOLEAN)( ALenum param );
typedef ALint (AL_APIENTRY *LPALGETINTEGER)( ALenum param );
typedef ALfloat (AL_APIENTRY *LPALGETFLOAT)( ALenum param );
typedef ALdouble (AL_APIENTRY *LPALGETDOUBLE)( ALenum param );
typedef ALenum (AL_APIENTRY *LPALGETERROR)( void );
typedef ALboolean (AL_APIENTRY *LPALISEXTENSIONPRESENT)(const ALchar* extname );
typedef void* (AL_APIENTRY *LPALGETPROCADDRESS)( const ALchar* fname );
typedef ALenum (AL_APIENTRY *LPALGETENUMVALUE)( const ALchar* ename );
typedef void (AL_APIENTRY *LPALLISTENERF)( ALenum param, ALfloat value );
typedef void (AL_APIENTRY *LPALLISTENER3F)( ALenum param, ALfloat value1, ALfloat value2, ALfloat value3 );
typedef void (AL_APIENTRY *LPALLISTENERFV)( ALenum param, const ALfloat* values );
typedef void (AL_APIENTRY *LPALLISTENERI)( ALenum param, ALint value );
typedef void (AL_APIENTRY *LPALLISTENER3I)( ALenum param, ALint value1, ALint value2, ALint value3 );
typedef void (AL_APIENTRY *LPALLISTENERIV)( ALenum param, const ALint* values );
typedef void (AL_APIENTRY *LPALGETLISTENERF)( ALenum param, ALfloat* value );
typedef void (AL_APIENTRY *LPALGETLISTENER3F)( ALenum param, ALfloat *value1, ALfloat *value2, ALfloat *value3 );
typedef void (AL_APIENTRY *LPALGETLISTENERFV)( ALenum param, ALfloat* values );
typedef void (AL_APIENTRY *LPALGETLISTENERI)( ALenum param, ALint* value );
typedef void (AL_APIENTRY *LPALGETLISTENER3I)( ALenum param, ALint *value1, ALint *value2, ALint *value3 );
typedef void (AL_APIENTRY *LPALGETLISTENERIV)( ALenum param, ALint* values );
typedef void (AL_APIENTRY *LPALGENSOURCES)( ALsizei n, ALuint* sources );
typedef void (AL_APIENTRY *LPALDELETESOURCES)( ALsizei n, const ALuint* sources );
typedef ALboolean (AL_APIENTRY *LPALISSOURCE)( ALuint sid );
typedef void (AL_APIENTRY *LPALSOURCEF)( ALuint sid, ALenum param, ALfloat value);
typedef void (AL_APIENTRY *LPALSOURCE3F)( ALuint sid, ALenum param, ALfloat value1, ALfloat value2, ALfloat value3 );
typedef void (AL_APIENTRY *LPALSOURCEFV)( ALuint sid, ALenum param, const ALfloat* values );
typedef void (AL_APIENTRY *LPALSOURCEI)( ALuint sid, ALenum param, ALint value);
typedef void (AL_APIENTRY *LPALSOURCE3I)( ALuint sid, ALenum param, ALint value1, ALint value2, ALint value3 );
typedef void (AL_APIENTRY *LPALSOURCEIV)( ALuint sid, ALenum param, const ALint* values );
typedef void (AL_APIENTRY *LPALGETSOURCEF)( ALuint sid, ALenum param, ALfloat* value );
typedef void (AL_APIENTRY *LPALGETSOURCE3F)( ALuint sid, ALenum param, ALfloat* value1, ALfloat* value2, ALfloat* value3);
typedef void (AL_APIENTRY *LPALGETSOURCEFV)( ALuint sid, ALenum param, ALfloat* values );
typedef void (AL_APIENTRY *LPALGETSOURCEI)( ALuint sid, ALenum param, ALint* value );
typedef void (AL_APIENTRY *LPALGETSOURCE3I)( ALuint sid, ALenum param, ALint* value1, ALint* value2, ALint* value3);
typedef void (AL_APIENTRY *LPALGETSOURCEIV)( ALuint sid, ALenum param, ALint* values );
typedef void (AL_APIENTRY *LPALSOURCEPLAYV)( ALsizei ns, const ALuint *sids );
typedef void (AL_APIENTRY *LPALSOURCESTOPV)( ALsizei ns, const ALuint *sids );
typedef void (AL_APIENTRY *LPALSOURCEREWINDV)( ALsizei ns, const ALuint *sids );
typedef void (AL_APIENTRY *LPALSOURCEPAUSEV)( ALsizei ns, const ALuint *sids );
typedef void (AL_APIENTRY *LPALSOURCEPLAY)( ALuint sid );
typedef void (AL_APIENTRY *LPALSOURCESTOP)( ALuint sid );
typedef void (AL_APIENTRY *LPALSOURCEREWIND)( ALuint sid );
typedef void (AL_APIENTRY *LPALSOURCEPAUSE)( ALuint sid );
typedef void (AL_APIENTRY *LPALSOURCEQUEUEBUFFERS)(ALuint sid, ALsizei numEntries, const ALuint *bids );
typedef void (AL_APIENTRY *LPALSOURCEUNQUEUEBUFFERS)(ALuint sid, ALsizei numEntries, ALuint *bids );
typedef void (AL_APIENTRY *LPALGENBUFFERS)( ALsizei n, ALuint* buffers );
typedef void (AL_APIENTRY *LPALDELETEBUFFERS)( ALsizei n, const ALuint* buffers );
typedef ALboolean (AL_APIENTRY *LPALISBUFFER)( ALuint bid );
typedef void (AL_APIENTRY *LPALBUFFERDATA)( ALuint bid, ALenum format, const ALvoid* data, ALsizei size, ALsizei freq );
typedef void (AL_APIENTRY *LPALBUFFERF)( ALuint bid, ALenum param, ALfloat value);
typedef void (AL_APIENTRY *LPALBUFFER3F)( ALuint bid, ALenum param, ALfloat value1, ALfloat value2, ALfloat value3 );
typedef void (AL_APIENTRY *LPALBUFFERFV)( ALuint bid, ALenum param, const ALfloat* values );
typedef void (AL_APIENTRY *LPALBUFFERI)( ALuint bid, ALenum param, ALint value);
typedef void (AL_APIENTRY *LPALBUFFER3I)( ALuint bid, ALenum param, ALint value1, ALint value2, ALint value3 );
typedef void (AL_APIENTRY *LPALBUFFERIV)( ALuint bid, ALenum param, const ALint* values );
typedef void (AL_APIENTRY *LPALGETBUFFERF)( ALuint bid, ALenum param, ALfloat* value );
typedef void (AL_APIENTRY *LPALGETBUFFER3F)( ALuint bid, ALenum param, ALfloat* value1, ALfloat* value2, ALfloat* value3);
typedef void (AL_APIENTRY *LPALGETBUFFERFV)( ALuint bid, ALenum param, ALfloat* values );
typedef void (AL_APIENTRY *LPALGETBUFFERI)( ALuint bid, ALenum param, ALint* value );
typedef void (AL_APIENTRY *LPALGETBUFFER3I)( ALuint bid, ALenum param, ALint* value1, ALint* value2, ALint* value3);
typedef void (AL_APIENTRY *LPALGETBUFFERIV)( ALuint bid, ALenum param, ALint* values );
typedef void (AL_APIENTRY *LPALDOPPLERFACTOR)( ALfloat value );
typedef void (AL_APIENTRY *LPALDOPPLERVELOCITY)( ALfloat value );
typedef void (AL_APIENTRY *LPALSPEEDOFSOUND)( ALfloat value );
typedef void (AL_APIENTRY *LPALDISTANCEMODEL)( ALenum distanceModel );
#endif /* AL_NO_PROTOTYPES */
#if TARGET_OS_MAC
#pragma export off
#endif
#if defined(__cplusplus)
} /* extern "C" */
#endif
#endif /* AL_AL_H */

View file

@ -0,0 +1,273 @@
#ifndef AL_ALC_H
#define AL_ALC_H
#if defined(__cplusplus)
extern "C" {
#endif
#if defined(_WIN32) && !defined(_XBOX)
/* _OPENAL32LIB is deprecated */
#if defined(AL_BUILD_LIBRARY) || defined (_OPENAL32LIB)
#define ALC_API __declspec(dllexport)
#else
#define ALC_API __declspec(dllimport)
#endif
#else
#define ALC_API extern
#endif
#if defined(_WIN32)
#define ALC_APIENTRY __cdecl
#else
#define ALC_APIENTRY
#endif
#if TARGET_OS_MAC
#pragma export on
#endif
/* The ALCAPI, and ALCAPIENTRY macros are deprecated, but are included for applications porting code
from AL 1.0 */
#define ALCAPI ALC_API
#define ALCAPIENTRY ALC_APIENTRY
#define ALC_VERSION_0_1 1
typedef struct ALCdevice_struct ALCdevice;
typedef struct ALCcontext_struct ALCcontext;
/** 8-bit boolean */
typedef char ALCboolean;
/** character */
typedef char ALCchar;
/** signed 8-bit 2's complement integer */
typedef char ALCbyte;
/** unsigned 8-bit integer */
typedef unsigned char ALCubyte;
/** signed 16-bit 2's complement integer */
typedef short ALCshort;
/** unsigned 16-bit integer */
typedef unsigned short ALCushort;
/** signed 32-bit 2's complement integer */
typedef int ALCint;
/** unsigned 32-bit integer */
typedef unsigned int ALCuint;
/** non-negative 32-bit binary integer size */
typedef int ALCsizei;
/** enumerated 32-bit value */
typedef int ALCenum;
/** 32-bit IEEE754 floating-point */
typedef float ALCfloat;
/** 64-bit IEEE754 floating-point */
typedef double ALCdouble;
/** void type (for opaque pointers only) */
typedef void ALCvoid;
/* Enumerant values begin at column 50. No tabs. */
/* bad value */
#define ALC_INVALID 0
/* Boolean False. */
#define ALC_FALSE 0
/* Boolean True. */
#define ALC_TRUE 1
/**
* followed by <int> Hz
*/
#define ALC_FREQUENCY 0x1007
/**
* followed by <int> Hz
*/
#define ALC_REFRESH 0x1008
/**
* followed by AL_TRUE, AL_FALSE
*/
#define ALC_SYNC 0x1009
/**
* followed by <int> Num of requested Mono (3D) Sources
*/
#define ALC_MONO_SOURCES 0x1010
/**
* followed by <int> Num of requested Stereo Sources
*/
#define ALC_STEREO_SOURCES 0x1011
/**
* errors
*/
/**
* No error
*/
#define ALC_NO_ERROR ALC_FALSE
/**
* No device
*/
#define ALC_INVALID_DEVICE 0xA001
/**
* invalid context ID
*/
#define ALC_INVALID_CONTEXT 0xA002
/**
* bad enum
*/
#define ALC_INVALID_ENUM 0xA003
/**
* bad value
*/
#define ALC_INVALID_VALUE 0xA004
/**
* Out of memory.
*/
#define ALC_OUT_OF_MEMORY 0xA005
/**
* The Specifier string for default device
*/
#define ALC_DEFAULT_DEVICE_SPECIFIER 0x1004
#define ALC_DEVICE_SPECIFIER 0x1005
#define ALC_EXTENSIONS 0x1006
#define ALC_MAJOR_VERSION 0x1000
#define ALC_MINOR_VERSION 0x1001
#define ALC_ATTRIBUTES_SIZE 0x1002
#define ALC_ALL_ATTRIBUTES 0x1003
/**
* Capture extension
*/
#define ALC_CAPTURE_DEVICE_SPECIFIER 0x310
#define ALC_CAPTURE_DEFAULT_DEVICE_SPECIFIER 0x311
#define ALC_CAPTURE_SAMPLES 0x312
#if !defined(ALC_NO_PROTOTYPES)
/*
* Context Management
*/
ALC_API ALCcontext * ALC_APIENTRY alcCreateContext( ALCdevice *device, const ALCint* attrlist );
ALC_API ALCboolean ALC_APIENTRY alcMakeContextCurrent( ALCcontext *context );
ALC_API void ALC_APIENTRY alcProcessContext( ALCcontext *context );
ALC_API void ALC_APIENTRY alcSuspendContext( ALCcontext *context );
ALC_API void ALC_APIENTRY alcDestroyContext( ALCcontext *context );
ALC_API ALCcontext * ALC_APIENTRY alcGetCurrentContext( ALCvoid );
ALC_API ALCdevice* ALC_APIENTRY alcGetContextsDevice( ALCcontext *context );
/*
* Device Management
*/
ALC_API ALCdevice * ALC_APIENTRY alcOpenDevice( const ALCchar *devicename );
ALC_API ALCboolean ALC_APIENTRY alcCloseDevice( ALCdevice *device );
/*
* Error support.
* Obtain the most recent Context error
*/
ALC_API ALCenum ALC_APIENTRY alcGetError( ALCdevice *device );
/*
* Extension support.
* Query for the presence of an extension, and obtain any appropriate
* function pointers and enum values.
*/
ALC_API ALCboolean ALC_APIENTRY alcIsExtensionPresent( ALCdevice *device, const ALCchar *extname );
ALC_API void * ALC_APIENTRY alcGetProcAddress( ALCdevice *device, const ALCchar *funcname );
ALC_API ALCenum ALC_APIENTRY alcGetEnumValue( ALCdevice *device, const ALCchar *enumname );
/*
* Query functions
*/
ALC_API const ALCchar * ALC_APIENTRY alcGetString( ALCdevice *device, ALCenum param );
ALC_API void ALC_APIENTRY alcGetIntegerv( ALCdevice *device, ALCenum param, ALCsizei size, ALCint *data );
/*
* Capture functions
*/
ALC_API ALCdevice* ALC_APIENTRY alcCaptureOpenDevice( const ALCchar *devicename, ALCuint frequency, ALCenum format, ALCsizei buffersize );
ALC_API ALCboolean ALC_APIENTRY alcCaptureCloseDevice( ALCdevice *device );
ALC_API void ALC_APIENTRY alcCaptureStart( ALCdevice *device );
ALC_API void ALC_APIENTRY alcCaptureStop( ALCdevice *device );
ALC_API void ALC_APIENTRY alcCaptureSamples( ALCdevice *device, ALCvoid *buffer, ALCsizei samples );
#else /* ALC_NO_PROTOTYPES */
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)( ALCvoid );
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 );
#endif /* ALC_NO_PROTOTYPES */
#if TARGET_OS_MAC
#pragma export off
#endif
#if defined(__cplusplus)
}
#endif
#endif /* AL_ALC_H */

View file

@ -0,0 +1,125 @@
#ifndef _ALCTYPES_H_
#define _ALCTYPES_H_
/**
* OpenAL cross platform audio library
* Copyright (C) 1999-2000 by authors.
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
* Or go to http://www.gnu.org/copyleft/lgpl.html
*/
#ifdef __cplusplus
extern "C" {
#endif
/** ALC boolean type. */
typedef char ALCboolean;
/** ALC 8bit signed byte. */
typedef char ALCbyte;
/** ALC 8bit unsigned byte. */
typedef unsigned char ALCubyte;
/** ALC 16bit signed short integer type. */
typedef short ALCshort;
/** ALC 16bit unsigned short integer type. */
typedef unsigned short ALCushort;
/** ALC 32bit unsigned integer type. */
typedef unsigned ALCuint;
/** ALC 32bit signed integer type. */
typedef int ALCint;
/** ALC 32bit floating point type. */
typedef float ALCfloat;
/** ALC 64bit double point type. */
typedef double ALCdouble;
/** ALC 32bit type. */
typedef unsigned int ALCsizei;
/** ALC void type */
typedef void ALCvoid;
/** ALC enumerations. */
typedef int ALCenum;
/* Bad value. */
#define ALC_INVALID (-1)
/* Boolean False. */
#define ALC_FALSE 0
/* Boolean True. */
#define ALC_TRUE 1
/** Errors: No Error. */
#define ALC_NO_ERROR ALC_FALSE
#define ALC_MAJOR_VERSION 0x1000
#define ALC_MINOR_VERSION 0x1001
#define ALC_ATTRIBUTES_SIZE 0x1002
#define ALC_ALL_ATTRIBUTES 0x1003
#define ALC_DEFAULT_DEVICE_SPECIFIER 0x1004
#define ALC_DEVICE_SPECIFIER 0x1005
#define ALC_EXTENSIONS 0x1006
#define ALC_FREQUENCY 0x1007
#define ALC_REFRESH 0x1008
#define ALC_SYNC 0x1009
/**
* The device argument does not name a valid dvice.
*/
#define ALC_INVALID_DEVICE 0xA001
/**
* The context argument does not name a valid context.
*/
#define ALC_INVALID_CONTEXT 0xA002
/**
* A function was called at inappropriate time,
* or in an inappropriate way, causing an illegal state.
* This can be an incompatible ALenum, object ID,
* and/or function.
*/
#define ALC_INVALID_ENUM 0xA003
/**
* Illegal value passed as an argument to an AL call.
* Applies to parameter values, but not to enumerations.
*/
#define ALC_INVALID_VALUE 0xA004
/**
* A function could not be completed,
* because there is not enough memory available.
*/
#define ALC_OUT_OF_MEMORY 0xA005
#ifdef __cplusplus
}
#endif
#endif

View file

@ -0,0 +1,332 @@
#ifndef _ALTYPES_H_
#define _ALTYPES_H_
/**
* OpenAL cross platform audio library
* Copyright (C) 1999-2000 by authors.
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
* Or go to http://www.gnu.org/copyleft/lgpl.html
*/
#ifdef __cplusplus
extern "C" {
#endif
/** OpenAL boolean type. */
typedef char ALboolean;
/** OpenAL 8bit signed byte. */
typedef char ALbyte;
/** OpenAL 8bit unsigned byte. */
typedef unsigned char ALubyte;
/** OpenAL 16bit signed short integer type. */
typedef short ALshort;
/** OpenAL 16bit unsigned short integer type. */
typedef unsigned short ALushort;
/** OpenAL 32bit unsigned integer type. */
typedef unsigned ALuint;
/** OpenAL 32bit signed integer type. */
typedef int ALint;
/** OpenAL 32bit floating point type. */
typedef float ALfloat;
/** OpenAL 64bit double point type. */
typedef double ALdouble;
/** OpenAL 32bit type. */
typedef unsigned int ALsizei;
/** OpenAL void type */
typedef void ALvoid;
/** OpenAL enumerations. */
typedef int ALenum;
/* Bad value. */
#define AL_INVALID (-1)
/* Disable value. */
#define AL_NONE 0
/* Boolean False. */
#define AL_FALSE 0
/* Boolean True. */
#define AL_TRUE 1
/**
* Indicate the type of AL_SOURCE.
* Sources can be spatialized
*/
#define AL_SOURCE_TYPE 0x200
/** Indicate source has absolute coordinates. */
#define AL_SOURCE_ABSOLUTE 0x201
/** Indicate Source has listener relative coordinates. */
#define AL_SOURCE_RELATIVE 0x202
/**
* Directional source, inner cone angle, in degrees.
* Range: [0-360]
* Default: 360
*/
#define AL_CONE_INNER_ANGLE 0x1001
/**
* Directional source, outer cone angle, in degrees.
* Range: [0-360]
* Default: 360
*/
#define AL_CONE_OUTER_ANGLE 0x1002
/**
* Specify the pitch to be applied, either at source,
* or on mixer results, at listener.
* Range: [0.5-2.0]
* Default: 1.0
*/
#define AL_PITCH 0x1003
/**
* 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.
*/
#define AL_POSITION 0x1004
/** Specify the current direction as forward vector. */
#define AL_DIRECTION 0x1005
/** Specify the current velocity in three dimensional space. */
#define AL_VELOCITY 0x1006
/**
* Indicate whether source has to loop infinite.
* Type: ALboolean
* Range: [AL_TRUE, AL_FALSE]
* Default: AL_FALSE
*/
#define AL_LOOPING 0x1007
/**
* Indicate the buffer to provide sound samples.
* Type: ALuint.
* Range: any valid Buffer id.
*/
#define AL_BUFFER 0x1009
/**
* Indicate the gain (volume amplification) applied.
* Type: ALfloat.
* Range: ]0.0- ]
* 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.0 is meaningless with respect to a logarithmic
* scale; it is interpreted as zero volume - the channel
* is effectively disabled.
*/
#define AL_GAIN 0x100A
/**
* Indicate minimum source attenuation.
* Type: ALfloat
* Range: [0.0 - 1.0]
*/
#define AL_MIN_GAIN 0x100D
/**
* Indicate maximum source attenuation.
* Type: ALfloat
* Range: [0.0 - 1.0]
*/
#define AL_MAX_GAIN 0x100E
/**
* Specify the current orientation.
* Type: ALfv6 (at/up)
* Range: N/A
*/
#define AL_ORIENTATION 0x100F
/* byte offset into source (in canon format). -1 if source
* is not playing. Don't set this, get this.
*
* Type: ALfloat
* Range: [0.0 - ]
* Default: 1.0
*/
#define AL_REFERENCE_DISTANCE 0x1020
/**
* Indicate the rolloff factor for the source.
* Type: ALfloat
* Range: [0.0 - ]
* Default: 1.0
*/
#define AL_ROLLOFF_FACTOR 0x1021
/**
* Indicate the gain (volume amplification) applied.
* Type: ALfloat.
* Range: ]0.0- ]
* 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.0 is meaningless with respect to a logarithmic
* scale; it is interpreted as zero volume - the channel
* is effectively disabled.
*/
#define AL_CONE_OUTER_GAIN 0x1022
/**
* Specify the maximum distance.
* Type: ALfloat
* Range: [0.0 - ]
*/
#define AL_MAX_DISTANCE 0x1023
/**
* Specify the channel mask. (Creative)
* Type: ALuint
* Range: [0 - 255]
*/
#define AL_CHANNEL_MASK 0x3000
/**
* Source state information
*/
#define AL_SOURCE_STATE 0x1010
#define AL_INITIAL 0x1011
#define AL_PLAYING 0x1012
#define AL_PAUSED 0x1013
#define AL_STOPPED 0x1014
/**
* Buffer Queue params
*/
#define AL_BUFFERS_QUEUED 0x1015
#define AL_BUFFERS_PROCESSED 0x1016
/** Sound buffers: format specifier. */
#define AL_FORMAT_MONO8 0x1100
#define AL_FORMAT_MONO16 0x1101
#define AL_FORMAT_STEREO8 0x1102
#define AL_FORMAT_STEREO16 0x1103
/**
* Sound buffers: 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.
*/
#define AL_FREQUENCY 0x2001
#define AL_BITS 0x2002
#define AL_CHANNELS 0x2003
#define AL_SIZE 0x2004
#define AL_DATA 0x2005
/**
* Buffer state.
*
* Not supported for public use (yet).
*/
#define AL_UNUSED 0x2010
#define AL_PENDING 0x2011
#define AL_PROCESSED 0x2012
/** Errors: No Error. */
#define AL_NO_ERROR AL_FALSE
/**
* Illegal name passed as an argument to an AL call.
*/
#define AL_INVALID_NAME 0xA001
/**
* Illegal enum passed as an argument to an AL call.
*/
#define AL_INVALID_ENUM 0xA002
/**
* Illegal value passed as an argument to an AL call.
* Applies to parameter values, but not to enumerations.
*/
#define AL_INVALID_VALUE 0xA003
/**
* A function was called at inappropriate time,
* or in an inappropriate way, causing an illegal state.
* This can be an incompatible ALenum, object ID,
* and/or function.
*/
#define AL_INVALID_OPERATION 0xA004
/**
* A function could not be completed,
* because there is not enough memory available.
*/
#define AL_OUT_OF_MEMORY 0xA005
/** Context strings: Vendor Name. */
#define AL_VENDOR 0xB001
#define AL_VERSION 0xB002
#define AL_RENDERER 0xB003
#define AL_EXTENSIONS 0xB004
/** Global tweakage. */
/**
* Doppler scale. Default 1.0
*/
#define AL_DOPPLER_FACTOR 0xC000
/**
* Doppler velocity. Default 1.0
*/
#define AL_DOPPLER_VELOCITY 0xC001
/**
* Distance model. Default AL_INVERSE_DISTANCE_CLAMPED
*/
#define AL_DISTANCE_MODEL 0xD000
/** Distance models. */
#define AL_INVERSE_DISTANCE 0xD001
#define AL_INVERSE_DISTANCE_CLAMPED 0xD002
/**
* enables
*/
#ifdef __cplusplus
}
#endif
#endif

View file

@ -0,0 +1,184 @@
/********************************************************************
* *
* THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. *
* USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
* *
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002 *
* by the Xiph.Org Foundation http://www.xiph.org/ *
* *
********************************************************************
function: toplevel libogg include
last mod: $Id: ogg.h,v 1.18 2002/07/13 10:28:33 giles Exp $
********************************************************************/
#ifndef _OGG_H
#define _OGG_H
#ifdef __cplusplus
extern "C" {
#endif
#include <ogg/os_types.h>
typedef struct {
long endbyte;
int endbit;
unsigned char *buffer;
unsigned char *ptr;
long storage;
} oggpack_buffer;
/* ogg_page is used to encapsulate the data in one Ogg bitstream page *****/
typedef struct {
unsigned char *header;
long header_len;
unsigned char *body;
long body_len;
} ogg_page;
/* ogg_stream_state contains the current encode/decode state of a logical
Ogg bitstream **********************************************************/
typedef struct {
unsigned char *body_data; /* bytes from packet bodies */
long body_storage; /* storage elements allocated */
long body_fill; /* elements stored; fill mark */
long body_returned; /* elements of fill returned */
int *lacing_vals; /* The values that will go to the segment table */
ogg_int64_t *granule_vals; /* granulepos values for headers. Not compact
this way, but it is simple coupled to the
lacing fifo */
long lacing_storage;
long lacing_fill;
long lacing_packet;
long lacing_returned;
unsigned char header[282]; /* working space for header encode */
int header_fill;
int e_o_s; /* set when we have buffered the last packet in the
logical bitstream */
int b_o_s; /* set after we've written the initial page
of a logical bitstream */
long serialno;
long pageno;
ogg_int64_t packetno; /* sequence number for decode; the framing
knows where there's a hole in the data,
but we need coupling so that the codec
(which is in a seperate abstraction
layer) also knows about the gap */
ogg_int64_t granulepos;
} ogg_stream_state;
/* ogg_packet is used to encapsulate the data and metadata belonging
to a single raw Ogg/Vorbis packet *************************************/
typedef struct {
unsigned char *packet;
long bytes;
long b_o_s;
long e_o_s;
ogg_int64_t granulepos;
ogg_int64_t packetno; /* sequence number for decode; the framing
knows where there's a hole in the data,
but we need coupling so that the codec
(which is in a seperate abstraction
layer) also knows about the gap */
} ogg_packet;
typedef struct {
unsigned char *data;
int storage;
int fill;
int returned;
int unsynced;
int headerbytes;
int bodybytes;
} ogg_sync_state;
/* Ogg BITSTREAM PRIMITIVES: bitstream ************************/
extern void oggpack_writeinit(oggpack_buffer *b);
extern void oggpack_writetrunc(oggpack_buffer *b,long bits);
extern void oggpack_writealign(oggpack_buffer *b);
extern void oggpack_writecopy(oggpack_buffer *b,void *source,long bits);
extern void oggpack_reset(oggpack_buffer *b);
extern void oggpack_writeclear(oggpack_buffer *b);
extern void oggpack_readinit(oggpack_buffer *b,unsigned char *buf,int bytes);
extern void oggpack_write(oggpack_buffer *b,unsigned long value,int bits);
extern long oggpack_look(oggpack_buffer *b,int bits);
extern long oggpack_look1(oggpack_buffer *b);
extern void oggpack_adv(oggpack_buffer *b,int bits);
extern void oggpack_adv1(oggpack_buffer *b);
extern long oggpack_read(oggpack_buffer *b,int bits);
extern long oggpack_read1(oggpack_buffer *b);
extern long oggpack_bytes(oggpack_buffer *b);
extern long oggpack_bits(oggpack_buffer *b);
extern unsigned char *oggpack_get_buffer(oggpack_buffer *b);
/* Ogg BITSTREAM PRIMITIVES: encoding **************************/
extern int ogg_stream_packetin(ogg_stream_state *os, ogg_packet *op);
extern int ogg_stream_pageout(ogg_stream_state *os, ogg_page *og);
extern int ogg_stream_flush(ogg_stream_state *os, ogg_page *og);
/* Ogg BITSTREAM PRIMITIVES: decoding **************************/
extern int ogg_sync_init(ogg_sync_state *oy);
extern int ogg_sync_clear(ogg_sync_state *oy);
extern int ogg_sync_reset(ogg_sync_state *oy);
extern int ogg_sync_destroy(ogg_sync_state *oy);
extern char *ogg_sync_buffer(ogg_sync_state *oy, long size);
extern int ogg_sync_wrote(ogg_sync_state *oy, long bytes);
extern long ogg_sync_pageseek(ogg_sync_state *oy,ogg_page *og);
extern int ogg_sync_pageout(ogg_sync_state *oy, ogg_page *og);
extern int ogg_stream_pagein(ogg_stream_state *os, ogg_page *og);
extern int ogg_stream_packetout(ogg_stream_state *os,ogg_packet *op);
extern int ogg_stream_packetpeek(ogg_stream_state *os,ogg_packet *op);
/* Ogg BITSTREAM PRIMITIVES: general ***************************/
extern int ogg_stream_init(ogg_stream_state *os,int serialno);
extern int ogg_stream_clear(ogg_stream_state *os);
extern int ogg_stream_reset(ogg_stream_state *os);
extern int ogg_stream_reset_serialno(ogg_stream_state *os,int serialno);
extern int ogg_stream_destroy(ogg_stream_state *os);
extern int ogg_stream_eos(ogg_stream_state *os);
extern void ogg_page_checksum_set(ogg_page *og);
extern int ogg_page_version(ogg_page *og);
extern int ogg_page_continued(ogg_page *og);
extern int ogg_page_bos(ogg_page *og);
extern int ogg_page_eos(ogg_page *og);
extern ogg_int64_t ogg_page_granulepos(ogg_page *og);
extern int ogg_page_serialno(ogg_page *og);
extern long ogg_page_pageno(ogg_page *og);
extern int ogg_page_packets(ogg_page *og);
extern void ogg_packet_clear(ogg_packet *op);
#ifdef __cplusplus
}
#endif
#endif /* _OGG_H */

View file

@ -0,0 +1,89 @@
/********************************************************************
* *
* THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. *
* USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
* *
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002 *
* by the Xiph.Org Foundation http://www.xiph.org/ *
* *
********************************************************************
function: #ifdef jail to whip a few platforms into the UNIX ideal.
last mod: $Id: os_types.h,v 1.11 2002/07/19 08:25:51 msmith Exp $
********************************************************************/
#ifndef _OS_TYPES_H
#define _OS_TYPES_H
/* make it easy on the folks that want to compile the libs with a
different malloc than stdlib */
#define _ogg_malloc malloc
#define _ogg_calloc calloc
#define _ogg_realloc realloc
#define _ogg_free free
#ifdef _WIN32
# ifndef __GNUC__
/* MSVC/Borland */
typedef __int64 ogg_int64_t;
typedef __int32 ogg_int32_t;
typedef unsigned __int32 ogg_uint32_t;
typedef __int16 ogg_int16_t;
# else
/* Cygwin */
/* #include <_G_config.h>
typedef _G_int64_t ogg_int64_t;
typedef _G_int32_t ogg_int32_t;
typedef _G_uint32_t ogg_uint32_t;
typedef _G_int16_t ogg_int16_t;*/
typedef long long ogg_int64_t;
/* typedef signed int ogg_int32_t;
typedef unsigned int ogg_uint32_t;
typedef signed short ogg_int16_t;*/
# endif
#elif defined(__MACOS__)
# include <sys/types.h>
typedef SInt16 ogg_int16_t;
typedef SInt32 ogg_int32_t;
typedef UInt32 ogg_uint32_t;
typedef SInt64 ogg_int64_t;
#elif defined(__MACOSX__) /* MacOS X Framework build */
# include <sys/types.h>
typedef int16_t ogg_int16_t;
typedef int32_t ogg_int32_t;
typedef u_int32_t ogg_uint32_t;
typedef int64_t ogg_int64_t;
#elif defined(__BEOS__)
/* Be */
# include <inttypes.h>
typedef int16_t ogg_int16_t;
typedef int32_t ogg_int32_t;
typedef u_int32_t ogg_uint32_t;
typedef int64_t ogg_int64_t;
#elif defined (__EMX__)
/* OS/2 GCC */
typedef short ogg_int16_t;
typedef int ogg_int32_t;
typedef unsigned int ogg_uint32_t;
typedef long long ogg_int64_t;
#else
# include <sys/types.h>
# include <ogg/config_types.h>
#endif
#endif /* _OS_TYPES_H */

View file

@ -0,0 +1,233 @@
/********************************************************************
* *
* THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. *
* USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
* *
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2001 *
* by the XIPHOPHORUS Company http://www.xiph.org/ *
********************************************************************
function: libvorbis codec headers
last mod: $Id: codec.h,v 1.40 2002/02/28 04:12:47 xiphmont Exp $
********************************************************************/
#ifndef _vorbis_codec_h_
#define _vorbis_codec_h_
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
#include <ogg/ogg.h>
typedef struct vorbis_info{
int version;
int channels;
long rate;
/* The below bitrate declarations are *hints*.
Combinations of the three values carry the following implications:
all three set to the same value:
implies a fixed rate bitstream
only nominal set:
implies a VBR stream that averages the nominal bitrate. No hard
upper/lower limit
upper and or lower set:
implies a VBR bitstream that obeys the bitrate limits. nominal
may also be set to give a nominal rate.
none set:
the coder does not care to speculate.
*/
long bitrate_upper;
long bitrate_nominal;
long bitrate_lower;
long bitrate_window;
void *codec_setup;
} vorbis_info;
/* vorbis_dsp_state buffers the current vorbis audio
analysis/synthesis state. The DSP state belongs to a specific
logical bitstream ****************************************************/
typedef struct vorbis_dsp_state{
int analysisp;
vorbis_info *vi;
float **pcm;
float **pcmret;
int pcm_storage;
int pcm_current;
int pcm_returned;
int preextrapolate;
int eofflag;
long lW;
long W;
long nW;
long centerW;
ogg_int64_t granulepos;
ogg_int64_t sequence;
ogg_int64_t glue_bits;
ogg_int64_t time_bits;
ogg_int64_t floor_bits;
ogg_int64_t res_bits;
void *backend_state;
} vorbis_dsp_state;
typedef struct vorbis_block{
/* necessary stream state for linking to the framing abstraction */
float **pcm; /* this is a pointer into local storage */
oggpack_buffer opb;
long lW;
long W;
long nW;
int pcmend;
int mode;
int eofflag;
ogg_int64_t granulepos;
ogg_int64_t sequence;
vorbis_dsp_state *vd; /* For read-only access of configuration */
/* local storage to avoid remallocing; it's up to the mapping to
structure it */
void *localstore;
long localtop;
long localalloc;
long totaluse;
struct alloc_chain *reap;
/* bitmetrics for the frame */
long glue_bits;
long time_bits;
long floor_bits;
long res_bits;
void *internal;
} vorbis_block;
/* vorbis_block is a single block of data to be processed as part of
the analysis/synthesis stream; it belongs to a specific logical
bitstream, but is independant from other vorbis_blocks belonging to
that logical bitstream. *************************************************/
struct alloc_chain{
void *ptr;
struct alloc_chain *next;
};
/* vorbis_info contains all the setup information specific to the
specific compression/decompression mode in progress (eg,
psychoacoustic settings, channel setup, options, codebook
etc). vorbis_info and substructures are in backends.h.
*********************************************************************/
/* the comments are not part of vorbis_info so that vorbis_info can be
static storage */
typedef struct vorbis_comment{
/* unlimited user comment fields. libvorbis writes 'libvorbis'
whatever vendor is set to in encode */
char **user_comments;
int *comment_lengths;
int comments;
char *vendor;
} vorbis_comment;
/* libvorbis encodes in two abstraction layers; first we perform DSP
and produce a packet (see docs/analysis.txt). The packet is then
coded into a framed OggSquish bitstream by the second layer (see
docs/framing.txt). Decode is the reverse process; we sync/frame
the bitstream and extract individual packets, then decode the
packet back into PCM audio.
The extra framing/packetizing is used in streaming formats, such as
files. Over the net (such as with UDP), the framing and
packetization aren't necessary as they're provided by the transport
and the streaming layer is not used */
/* Vorbis PRIMITIVES: general ***************************************/
extern void vorbis_info_init(vorbis_info *vi);
extern void vorbis_info_clear(vorbis_info *vi);
extern int vorbis_info_blocksize(vorbis_info *vi,int zo);
extern void vorbis_comment_init(vorbis_comment *vc);
extern void vorbis_comment_add(vorbis_comment *vc, char *comment);
extern void vorbis_comment_add_tag(vorbis_comment *vc,
char *tag, char *contents);
extern char *vorbis_comment_query(vorbis_comment *vc, char *tag, int count);
extern int vorbis_comment_query_count(vorbis_comment *vc, char *tag);
extern void vorbis_comment_clear(vorbis_comment *vc);
extern int vorbis_block_init(vorbis_dsp_state *v, vorbis_block *vb);
extern int vorbis_block_clear(vorbis_block *vb);
extern void vorbis_dsp_clear(vorbis_dsp_state *v);
/* Vorbis PRIMITIVES: analysis/DSP layer ****************************/
extern int vorbis_analysis_init(vorbis_dsp_state *v,vorbis_info *vi);
extern int vorbis_commentheader_out(vorbis_comment *vc, ogg_packet *op);
extern int vorbis_analysis_headerout(vorbis_dsp_state *v,
vorbis_comment *vc,
ogg_packet *op,
ogg_packet *op_comm,
ogg_packet *op_code);
extern float **vorbis_analysis_buffer(vorbis_dsp_state *v,int vals);
extern int vorbis_analysis_wrote(vorbis_dsp_state *v,int vals);
extern int vorbis_analysis_blockout(vorbis_dsp_state *v,vorbis_block *vb);
extern int vorbis_analysis(vorbis_block *vb,ogg_packet *op);
extern int vorbis_bitrate_addblock(vorbis_block *vb);
extern int vorbis_bitrate_flushpacket(vorbis_dsp_state *vd,
ogg_packet *op);
/* Vorbis PRIMITIVES: synthesis layer *******************************/
extern int vorbis_synthesis_headerin(vorbis_info *vi,vorbis_comment *vc,
ogg_packet *op);
extern int vorbis_synthesis_init(vorbis_dsp_state *v,vorbis_info *vi);
extern int vorbis_synthesis(vorbis_block *vb,ogg_packet *op);
extern int vorbis_synthesis_trackonly(vorbis_block *vb,ogg_packet *op);
extern int vorbis_synthesis_blockin(vorbis_dsp_state *v,vorbis_block *vb);
extern int vorbis_synthesis_pcmout(vorbis_dsp_state *v,float ***pcm);
extern int vorbis_synthesis_read(vorbis_dsp_state *v,int samples);
extern long vorbis_packet_blocksize(vorbis_info *vi,ogg_packet *op);
/* Vorbis ERRORS and return codes ***********************************/
#define OV_FALSE -1
#define OV_EOF -2
#define OV_HOLE -3
#define OV_EREAD -128
#define OV_EFAULT -129
#define OV_EIMPL -130
#define OV_EINVAL -131
#define OV_ENOTVORBIS -132
#define OV_EBADHEADER -133
#define OV_EVERSION -134
#define OV_ENOTAUDIO -135
#define OV_EBADPACKET -136
#define OV_EBADLINK -137
#define OV_ENOSEEK -138
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif

View file

@ -0,0 +1,93 @@
/********************************************************************
* *
* THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. *
* USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
* *
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2001 *
* by the XIPHOPHORUS Company http://www.xiph.org/ *
* *
********************************************************************
function: vorbis encode-engine setup
last mod: $Id: vorbisenc.h,v 1.10 2002/07/01 11:20:10 xiphmont Exp $
********************************************************************/
#ifndef _OV_ENC_H_
#define _OV_ENC_H_
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
#include "codec.h"
extern int vorbis_encode_init(vorbis_info *vi,
long channels,
long rate,
long max_bitrate,
long nominal_bitrate,
long min_bitrate);
extern int vorbis_encode_setup_managed(vorbis_info *vi,
long channels,
long rate,
long max_bitrate,
long nominal_bitrate,
long min_bitrate);
extern int vorbis_encode_setup_vbr(vorbis_info *vi,
long channels,
long rate,
float /* quality level from 0. (lo) to 1. (hi) */
);
extern int vorbis_encode_init_vbr(vorbis_info *vi,
long channels,
long rate,
float base_quality /* quality level from 0. (lo) to 1. (hi) */
);
extern int vorbis_encode_setup_init(vorbis_info *vi);
extern int vorbis_encode_ctl(vorbis_info *vi,int number,void *arg);
#define OV_ECTL_RATEMANAGE_GET 0x10
#define OV_ECTL_RATEMANAGE_SET 0x11
#define OV_ECTL_RATEMANAGE_AVG 0x12
#define OV_ECTL_RATEMANAGE_HARD 0x13
#define OV_ECTL_LOWPASS_GET 0x20
#define OV_ECTL_LOWPASS_SET 0x21
#define OV_ECTL_IBLOCK_GET 0x30
#define OV_ECTL_IBLOCK_SET 0x31
struct ovectl_ratemanage_arg {
int management_active;
long bitrate_hard_min;
long bitrate_hard_max;
double bitrate_hard_window;
long bitrate_av_lo;
long bitrate_av_hi;
double bitrate_av_window;
double bitrate_av_window_center;
};
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif

View file

@ -0,0 +1,133 @@
/********************************************************************
* *
* THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. *
* USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
* *
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2001 *
* by the XIPHOPHORUS Company http://www.xiph.org/ *
* *
********************************************************************
function: stdio-based convenience library for opening/seeking/decoding
last mod: $Id: vorbisfile.h,v 1.17 2002/03/07 03:41:03 xiphmont Exp $
********************************************************************/
#ifndef _OV_FILE_H_
#define _OV_FILE_H_
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
#include <stdio.h>
#include "codec.h"
/* The function prototypes for the callbacks are basically the same as for
* the stdio functions fread, fseek, fclose, ftell.
* The one difference is that the FILE * arguments have been replaced with
* a void * - this is to be used as a pointer to whatever internal data these
* functions might need. In the stdio case, it's just a FILE * cast to a void *
*
* If you use other functions, check the docs for these functions and return
* the right values. For seek_func(), you *MUST* return -1 if the stream is
* unseekable
*/
typedef struct {
size_t (*read_func) (void *ptr, size_t size, size_t nmemb, void *datasource);
int (*seek_func) (void *datasource, ogg_int64_t offset, int whence);
int (*close_func) (void *datasource);
long (*tell_func) (void *datasource);
} ov_callbacks;
#define NOTOPEN 0
#define PARTOPEN 1
#define OPENED 2
#define STREAMSET 3
#define INITSET 4
typedef struct OggVorbis_File {
void *datasource; /* Pointer to a FILE *, etc. */
int seekable;
ogg_int64_t offset;
ogg_int64_t end;
ogg_sync_state oy;
/* If the FILE handle isn't seekable (eg, a pipe), only the current
stream appears */
int links;
ogg_int64_t *offsets;
ogg_int64_t *dataoffsets;
long *serialnos;
ogg_int64_t *pcmlengths; /* overloaded to maintain binary
compatability; x2 size, stores both
beginning and end values */
vorbis_info *vi;
vorbis_comment *vc;
/* Decoding working state local storage */
ogg_int64_t pcm_offset;
int ready_state;
long current_serialno;
int current_link;
double bittrack;
double samptrack;
ogg_stream_state os; /* take physical pages, weld into a logical
stream of packets */
vorbis_dsp_state vd; /* central working state for the packet->PCM decoder */
vorbis_block vb; /* local working space for packet->PCM decode */
ov_callbacks callbacks;
} OggVorbis_File;
extern int ov_clear(OggVorbis_File *vf);
extern int ov_open(FILE *f,OggVorbis_File *vf,char *initial,long ibytes);
extern int ov_open_callbacks(void *datasource, OggVorbis_File *vf,
char *initial, long ibytes, ov_callbacks callbacks);
extern int ov_test(FILE *f,OggVorbis_File *vf,char *initial,long ibytes);
extern int ov_test_callbacks(void *datasource, OggVorbis_File *vf,
char *initial, long ibytes, ov_callbacks callbacks);
extern int ov_test_open(OggVorbis_File *vf);
extern long ov_bitrate(OggVorbis_File *vf,int i);
extern long ov_bitrate_instant(OggVorbis_File *vf);
extern long ov_streams(OggVorbis_File *vf);
extern long ov_seekable(OggVorbis_File *vf);
extern long ov_serialnumber(OggVorbis_File *vf,int i);
extern ogg_int64_t ov_raw_total(OggVorbis_File *vf,int i);
extern ogg_int64_t ov_pcm_total(OggVorbis_File *vf,int i);
extern double ov_time_total(OggVorbis_File *vf,int i);
extern int ov_raw_seek(OggVorbis_File *vf,ogg_int64_t pos);
extern int ov_pcm_seek(OggVorbis_File *vf,ogg_int64_t pos);
extern int ov_pcm_seek_page(OggVorbis_File *vf,ogg_int64_t pos);
extern int ov_time_seek(OggVorbis_File *vf,double pos);
extern int ov_time_seek_page(OggVorbis_File *vf,double pos);
extern ogg_int64_t ov_raw_tell(OggVorbis_File *vf);
extern ogg_int64_t ov_pcm_tell(OggVorbis_File *vf);
extern double ov_time_tell(OggVorbis_File *vf);
extern vorbis_info *ov_info(OggVorbis_File *vf,int link);
extern vorbis_comment *ov_comment(OggVorbis_File *vf,int link);
extern long ov_read_float(OggVorbis_File *vf,float ***pcm_channels,int samples,
int *bitstream);
extern long ov_read(OggVorbis_File *vf,char *buffer,int length,
int bigendianp,int word,int sgned,int *bitstream);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -1,7 +1,8 @@
# EDuke32 Makefile for GNU Make
# SDK locations - adjust to match your setup
# DXROOT=c:/sdks/msc/dx61
DXROOT=../sdk/dx
ALROOT=AL
# Engine options
SUPERBUILD = 1
@ -14,6 +15,7 @@ BUILD32_ON_64 = 0
# Debugging options
RELEASE?=1
NOSOUND?=0
USE_OPENAL?=0
# build locations
@ -51,10 +53,16 @@ ifeq ($(PLATFORM),LINUX)
OBJ=obj
EOBJ=eobj
NASMFLAGS+= -f elf
ifeq ($(USE_OPENAL),1)
LIBS+= -lopenal -lvorbisfile -lvorbis -logg
endif
else
ifeq ($(PLATFORM),WINDOWS)
OBJ=obj_win
EOBJ=eobj_win
ifeq ($(USE_OPENAL),1)
LIBS+= -L$(ALROOT)/lib -lOpenAL32 -lvorbisfile -lvorbis -logg
endif
else
OBJ=obj
EOBJ=eobj
@ -77,6 +85,11 @@ AUDIOLIB_FX_SDL=$(OBJ)/ll_man.$o \
$(OBJ)/dsl.$o \
$(OBJ)/pitch.$o \
$(OBJ)/multivoc.$o
ifeq ($(USE_OPENAL),1)
AUDIOLIB_FX_SDL += $(OBJ)/openal.$o
endif
AUDIOLIB_MUSIC_SDL=$(OBJ)/sdlmusic.$o
AUDIOLIB_FX=$(OBJ)/pitch.$o \
@ -84,6 +97,11 @@ AUDIOLIB_FX=$(OBJ)/pitch.$o \
$(OBJ)/ll_man.$o \
$(OBJ)/fx_man.$o \
$(OBJ)/dsoundout.$o
ifeq ($(USE_OPENAL),1)
AUDIOLIB_FX += $(OBJ)/openal.$o
endif
AUDIOLIB_MUSIC=$(OBJ)/midi.$o \
$(OBJ)/mpu401.$o \
$(OBJ)/music.$o
@ -124,7 +142,7 @@ GAMEOBJS=$(OBJ)/game.$o \
EDITOROBJS=$(OBJ)/astub.$o
ifeq ($(PLATFORM),WINDOWS)
OURCFLAGS+= -DUNDERSCORES -I$(DXROOT)/include
OURCFLAGS+= -DUNDERSCORES -I$(DXROOT)/include -I$(ALROOT)/include
NASMFLAGS+= -DUNDERSCORES -f win32
GAMEOBJS+= $(OBJ)/gameres.$o $(OBJ)/winbits.$o $(OBJ)/startwin.game.$o
EDITOROBJS+= $(OBJ)/buildres.$o
@ -162,6 +180,10 @@ GAMEOBJS+= $(AUDIOLIBOBJ)
OURCFLAGS+= $(BUILDCFLAGS)
OURCXXFLAGS+= $(BUILDCFLAGS)
ifeq ($(USE_OPENAL),1)
OURCFLAGS+= -DUSE_OPENAL
endif
.PHONY: clean all engine $(EOBJ)/$(ENGINELIB) $(EOBJ)/$(EDITORLIB)
# TARGETS

View file

@ -60,6 +60,7 @@ $(OBJ)/pitch.$o: $(SRC)/jaudiolib/pitch.c $(SRC)/jaudiolib/pitch.h
$(OBJ)/multivoc.$o: $(SRC)/jaudiolib/multivoc.c $(SRC)/jaudiolib/usrhooks.h $(SRC)/jaudiolib/linklist.h $(SRC)/jaudiolib/pitch.h $(SRC)/jaudiolib/multivoc.h $(SRC)/jaudiolib/_multivc.h
$(OBJ)/fx_man.$o: $(SRC)/jaudiolib/fx_man.c $(SRC)/jaudiolib/multivoc.h $(SRC)/jaudiolib/ll_man.h $(SRC)/jaudiolib/fx_man.h
$(OBJ)/dsoundout.$o: $(SRC)/jaudiolib/dsoundout.c $(SRC)/jaudiolib/dsoundout.h
$(OBJ)/openal.$o: $(SRC)/jaudiolib/openal.c $(SRC)/jaudiolib/openal.h
$(OBJ)/dsl.$o: $(SRC)/jaudiolib/dsl.c $(SRC)/jaudiolib/dsl.h $(EINC)/compat.h
$(OBJ)/midi.$o: $(SRC)/jaudiolib/midi.c $(SRC)/jaudiolib/standard.h $(SRC)/jaudiolib/usrhooks.h $(SRC)/jaudiolib/music.h $(SRC)/jaudiolib/_midi.h $(SRC)/jaudiolib/midi.h

View file

@ -61,6 +61,7 @@ AUDIOLIB_FX=$(OBJ)\mv_mix.$o \
$(OBJ)\mvreverb.$o \
$(OBJ)\pitch.$o \
$(OBJ)\multivoc.$o \
# $(OBJ)\openal.$o \
$(OBJ)\ll_man.$o \
$(OBJ)\fx_man.$o \
$(OBJ)\dsoundout.$o

View file

@ -43,6 +43,7 @@ JAUDIOLIB_FX=$(OBJ)\mv_mix.$o &
$(OBJ)\mvreverb.$o &
$(OBJ)\pitch.$o &
$(OBJ)\multivoc.$o &
$(OBJ)\openal.$o &
$(OBJ)\ll_man.$o &
$(OBJ)\fx_man.$o &
$(OBJ)\dsoundout.$o

View file

@ -705,6 +705,10 @@
RelativePath=".\source\jaudiolib\multivoc.h"
>
</File>
<File
RelativePath=".\source\jaudiolib\openal.h"
>
</File>
<File
RelativePath=".\source\jaudiolib\music.h"
>
@ -773,6 +777,10 @@
RelativePath=".\source\jaudiolib\multivoc.c"
>
</File>
<File
RelativePath=".\source\jaudiolib\openal.c"
>
</File>
<File
RelativePath=".\source\jaudiolib\music.c"
>

View file

@ -309,6 +309,7 @@ typedef struct {
typedef struct {
int length, num, soundsiz;
char *filename, *ptr;
char *filename1;
short ps,pe,vo;
volatile char lock;
char pr,m;
@ -327,7 +328,7 @@ extern short numanimwalls;
extern int probey;
extern char typebuflen,typebuf[141];
extern char MusicPtr[72000*2];
extern char *MusicPtr;extern int Musicsize;
extern int msx[2048],msy[2048];
extern short cyclers[MAXCYCLERS][6],numcyclers;
extern char myname[32];
@ -962,10 +963,10 @@ extern char setupfilename[BMAX_PATH];
typedef struct {
int partime, designertime;
char *name, *filename, *musicfn;
char *name, *filename, *musicfn, *musicfn1;
} map_t;
extern map_t map[MAXVOLUMES*MAXLEVELS];
extern map_t map[(MAXVOLUMES+1)*MAXLEVELS]; // +1 volume for "intro", "briefing" music
typedef struct {
player_struct *ps;

View file

@ -31,7 +31,7 @@ extern void SoundShutdown(void);
extern void MusicStartup(void);
extern void MusicShutdown(void);
extern void intomenusounds(void);
extern void playmusic(const char *fn);
extern void playmusicMAP(const char *fn,const int sel);
extern int loadsound(unsigned num);
extern int xyzsound(int num,int i,int x,int y,int z);
extern void sound(int num);

View file

@ -257,6 +257,10 @@ enum
T_CACHESIZE = 2,
T_ALLOW = 2,
T_NOAUTOLOAD,
T_MUSIC,
T_SOUND,
T_FILE,
T_ID
};
typedef struct
@ -7989,7 +7993,7 @@ static void nonsharedkeys(void)
{
Bsprintf(fta_quotes[26],"PLAYING %s",&map[(unsigned char)music_select].musicfn[0]);
FTA(26,g_player[myconnectindex].ps);
playmusic(&map[(unsigned char)music_select].musicfn[0]);
playmusicMAP(&map[(unsigned char)music_select].musicfn[0],music_select);
}
return;
}
@ -8622,6 +8626,14 @@ static int parsegroupfiles(scriptfile *script)
{ "loadgrp", T_LOADGRP },
{ "cachesize", T_CACHESIZE },
{ "noautload", T_NOAUTOLOAD },
{ "music", T_MUSIC },
{ "sound", T_SOUND },
};
tokenlist sound_musictokens[] =
{
{ "id", T_ID },
{ "file", T_FILE },
};
while (1)
@ -8684,6 +8696,60 @@ static int parsegroupfiles(scriptfile *script)
case T_NOAUTOLOAD:
g_NoAutoLoad = 1;
break;
case T_MUSIC:
{
char *tinttokptr = script->ltextptr;
char *ID=NULL,*ext="";
char *musicend;
if (scriptfile_getbraces(script,&musicend)) break;
while (script->textptr < musicend)
{
switch (getatoken(script,sound_musictokens,sizeof(sound_musictokens)/sizeof(tokenlist)))
{
case T_ID:
scriptfile_getstring(script,&ID);
break;
case T_FILE:
scriptfile_getstring(script,&ext);
break;
}
}
if(ID==NULL)
{
initprintf("Error: missing ID for music definition near line %s:%d\n", script->filename, scriptfile_getlinum(script,tinttokptr));
break;
}
if (AL_DefineMusic(ID,ext))
initprintf("Error: invalid music ID on line %s:%d\n", script->filename, scriptfile_getlinum(script,tinttokptr));
}
break;
case T_SOUND:
{
char *tinttokptr = script->ltextptr;
char *name="";int num=-1;
char *musicend;
if (scriptfile_getbraces(script,&musicend)) break;
while (script->textptr < musicend)
{
switch (getatoken(script,sound_musictokens,sizeof(sound_musictokens)/sizeof(tokenlist)))
{
case T_ID:
scriptfile_getsymbol(script,&num);break;
case T_FILE:
scriptfile_getstring(script,&name);
}
}
if(num==-1)
{
initprintf("Error: missing ID for sound definition near line %s:%d\n", script->filename, scriptfile_getlinum(script,tinttokptr));
break;
}
if(AL_DefineSound(num,name))initprintf("Error: invalid sound ID on line %s:%d\n", script->filename, scriptfile_getlinum(script,tinttokptr));
}
break;
case T_EOF:
return(0);
default:
@ -9258,7 +9324,7 @@ static void Logo(void)
if (logoflags & LOGO_FLAG_PLAYMUSIC)
{
music_select = -1; // hack
playmusic(&env_music_fn[0][0]);
playmusicMAP(&env_music_fn[0][0],MAXVOLUMES*MAXLEVELS);
}
if (!NAM)
@ -9418,7 +9484,7 @@ static void freeconmem(void)
{
int i;
for (i=(MAXLEVELS*MAXVOLUMES)-1;i>=0;i--)
for (i=(MAXLEVELS*(MAXVOLUMES+1))-1;i>=0;i--) // +1 volume for "intro", "briefing" music
{
if (map[i].name != NULL)
Bfree(map[i].name);
@ -9426,6 +9492,8 @@ static void freeconmem(void)
Bfree(map[i].filename);
if (map[i].musicfn != NULL)
Bfree(map[i].musicfn);
if (map[i].musicfn1 != NULL)
Bfree(map[i].musicfn1);
}
for (i=MAXQUOTES-1;i>=0;i--)
@ -9456,6 +9524,8 @@ static void freeconmem(void)
{
if (g_sounds[i].filename != NULL)
Bfree(g_sounds[i].filename);
if (g_sounds[i].filename1 != NULL)
Bfree(g_sounds[i].filename1);
}
if (label != NULL)

View file

@ -6959,7 +6959,7 @@ static int parse(void)
insptr++;
music_select=(ud.volume_number*MAXLEVELS)+(*(insptr++));
if (map[(unsigned char)music_select].musicfn != NULL)
playmusic(&map[(unsigned char)music_select].musicfn[0]);
playmusicMAP(&map[(unsigned char)music_select].musicfn[0],music_select);
break;
case CON_GETTEXTURECEILING:

View file

@ -23,7 +23,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
//-------------------------------------------------------------------------
#include "duke3d.h"
char MusicPtr[72000*2];
char *MusicPtr=0;int Musicsize;
short global_random;
short neartagsector, neartagwall, neartagsprite;
@ -56,7 +56,7 @@ short mirrorwall[64], mirrorsector[64], mirrorcnt;
int current_menu;
map_t map[MAXVOLUMES*MAXLEVELS];
map_t map[(MAXVOLUMES+1)*MAXLEVELS]; // +1 volume for "intro", "briefing" music
char volume_names[MAXVOLUMES][33] = { "L.A. MELTDOWN", "LUNAR APOCALYPSE", "SHRAPNEL CITY" };
char skill_names[5][33] = { "PIECE OF CAKE", "LET'S ROCK", "COME GET SOME", "DAMN I'M GOOD" };

View file

@ -32,8 +32,12 @@ Modifications for JonoF's port by Jonathon Fowler (jonof@edgenetwk.com)
#ifndef ___MULTIVC_H
#define ___MULTIVC_H
#include "openal.h"
#ifndef TRUE
#define TRUE ( 1 == 1 )
#define FALSE ( !TRUE )
#endif
#define VOC_8BIT 0x0
#define VOC_CT4_ADPCM 0x1
@ -83,7 +87,10 @@ typedef enum
Raw,
VOC,
DemandFeed,
WAV
WAV,
#ifdef USE_OPENAL
OGG
#endif
} wavedata;
typedef enum
@ -127,7 +134,11 @@ typedef struct VoiceNode
int priority;
void ( *DemandFeed )( char **ptr, unsigned int *length );
#ifdef USE_OPENAL
struct sounddef OGGstream;
char *bufsnd;
int downsample;
#endif
short *LeftVolume;
short *RightVolume;

View file

@ -25,7 +25,9 @@ Adapted to work with JonoF's port by James Bentler (bentler@cs.umn.edu)
#include "dsl.h"
#include "compat.h"
#ifdef USE_OPENAL
#include "openal.h"
#endif
#include "SDL.h"
#include "SDL_mixer.h"
@ -114,6 +116,7 @@ static void mixer_callback(int chan, void *stream, int len, void *udata)
Uint8 *fxptr;
int copysize;
AL_Update();
/* len should equal _BufferSize, else this is screwed up */
stptr = (Uint8 *)stream;

View file

@ -33,7 +33,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <stdio.h>
#include <string.h>
#include "dsound.h"
#ifdef USE_OPENAL
#include "openal.h"
#endif
#include "compat.h"
#include "winlayer.h"
@ -271,7 +273,7 @@ int DSOUND_Init(int soundcard, int mixrate, int numchannels, int samplebits, int
return DSOUND_Error;
}
hr = IDirectSoundBuffer_QueryInterface(lpDSBSecondary, &IID_IDirectSoundNotify, &lpDSNotify);
hr = IDirectSoundBuffer_QueryInterface(lpDSBSecondary, &IID_IDirectSoundNotify, (LPVOID *)&lpDSNotify);
if (hr != DS_OK)
{
DSOUND_Shutdown();
@ -419,6 +421,9 @@ static DWORD WINAPI isr(LPVOID parm)
while (1)
{
#ifdef USE_OPENAL
AL_Update();
#endif
rv = WaitForMultipleObjects(1+_DSOUND_NumBuffers, handles, FALSE, INFINITE);
if (!(rv >= WAIT_OBJECT_0 && rv <= WAIT_OBJECT_0+1+_DSOUND_NumBuffers)) return -1;

View file

@ -31,12 +31,15 @@ Modifications for JonoF's port by Jonathon Fowler (jonof@edgenetwk.com)
#include <stdio.h>
#include <stdlib.h>
#include <duke3d.h>
#include "multivoc.h"
#include "ll_man.h"
#include "fx_man.h"
#ifndef TRUE
#define TRUE ( 1 == 1 )
#define FALSE ( !TRUE )
#endif
static unsigned FX_MixRate;
@ -656,6 +659,8 @@ int FX_PlayLoopedVOC
vol, left, right, priority, callbackval);
if (handle < MV_Ok)
{
sprintf(tempbuf, "Sound error %d: %s\n",callbackval, FX_ErrorString(FX_Error));
initprintf(tempbuf);
FX_SetErrorCode(FX_MultiVocError);
handle = FX_Warning;
}
@ -695,6 +700,37 @@ int FX_PlayWAV
return(handle);
}
/*---------------------------------------------------------------------
Function: FX_PlayOGG
Begin playback of sound data with the given volume and priority.
---------------------------------------------------------------------*/
#ifdef USE_OPENAL
int FX_PlayOGG
(
char *ptr,
int pitchoffset,
int vol,
int left,
int right,
int priority,
unsigned int callbackval
)
{
int handle;
handle = MV_PlayOGG(ptr, pitchoffset, vol, left, right,
priority, callbackval);
if (handle < MV_Ok)
{
FX_SetErrorCode(FX_MultiVocError);
handle = FX_Warning;
}
return(handle);
}
#endif
/*---------------------------------------------------------------------
Function: FX_PlayWAV
@ -722,14 +758,44 @@ int FX_PlayLoopedWAV
pitchoffset, vol, left, right, priority, callbackval);
if (handle < MV_Ok)
{
sprintf(tempbuf, "Sound error %d: %s\n",callbackval, FX_ErrorString(FX_Error));
initprintf(tempbuf);
FX_SetErrorCode(FX_MultiVocError);
handle = FX_Warning;
}
return(handle);
}
#ifdef USE_OPENAL
int FX_PlayLoopedOGG
(
char *ptr,
int loopstart,
int loopend,
int pitchoffset,
int vol,
int left,
int right,
int priority,
unsigned int callbackval
)
{
int handle;
handle = MV_PlayLoopedOGG(ptr, loopstart, loopend,
pitchoffset, vol, left, right, priority, callbackval);
if (handle < MV_Ok)
{
sprintf(tempbuf, "Sound error %d: %s\n",callbackval, FX_ErrorString(FX_Error));
initprintf(tempbuf);
FX_SetErrorCode(FX_MultiVocError);
handle = FX_Warning;
}
return(handle);
}
#endif
/*---------------------------------------------------------------------
Function: FX_PlayVOC3D
@ -760,7 +826,31 @@ int FX_PlayVOC3D
return(handle);
}
#ifdef USE_OPENAL
int FX_PlayOGG3D
(
char *ptr,
int pitchoffset,
int angle,
int distance,
int priority,
unsigned int callbackval
)
{
int handle;
handle = MV_PlayOGG3D(ptr, pitchoffset, angle, distance,
priority, callbackval);
if (handle < MV_Ok)
{
FX_SetErrorCode(FX_MultiVocError);
handle = FX_Warning;
}
return(handle);
}
#endif
/*---------------------------------------------------------------------
Function: FX_PlayWAV3D
@ -1072,3 +1162,65 @@ void FX_StopRecord
extern void MUSIC_Update(void);
void AudioUpdate(void) { MUSIC_Update(); }
void playmusic(const char *fn);
char *makename(char *destname,char *OGGname)
{
if (!(*OGGname))
return NULL;
if (destname)
Bfree(destname);
destname=Bcalloc(Bstrlen(OGGname)+1,sizeof(char));
if (destname != NULL)
Bstrcpy(destname,OGGname);
/* if(*OGGname&&OGGname[Bstrlen(OGGname)-1]=='/')
{
while(*origname=='/')origname++;
Bstrcat(destname,origname);
}
OGGname=Bstrchr(destname,'.');
if(OGGname)Bstrcpy(OGGname,".ogg");else Bstrcat(destname,".ogg"); */
return destname;
}
int AL_DefineSound(int ID,char *name)
{
if(ID>=MAXSOUNDS)return 1;
g_sounds[ID].filename1=makename(g_sounds[ID].filename1,name);
// initprintf("(%s)(%s)(%s)\n",g_sounds[ID].filename1,name,g_sounds[ID].filename);
// loadsound(ID);
return 0;
}
int AL_DefineMusic(char *ID,char *name)
{
int lev,ep,sel;char b1,b2;
if(!ID)return 1;
if(!Bstrcmp(ID,"intro")) {sel=MAXVOLUMES*MAXLEVELS; ID=env_music_fn[0];}else
if(!Bstrcmp(ID,"briefing")){sel=MAXVOLUMES*MAXLEVELS+1;ID=env_music_fn[1];}else
if(!Bstrcmp(ID,"loading")) {sel=MAXVOLUMES*MAXLEVELS+2;ID=env_music_fn[2];}else
{
sscanf(ID,"%c%d%c%d",&b1,&ep,&b2,&lev);
lev--;ep--;
if(toupper(b1)!='E'||toupper(b2)!='L'||lev>=MAXLEVELS||ep>=MAXVOLUMES)return 1;
sel=(ep*MAXLEVELS)+lev;
// ID=map[sel].musicfn;
}
map[sel].musicfn1=makename(map[sel].musicfn1,name/*,ID*/);
initprintf("%s | %3d %2d %2d | %s\n",ID,sel,ep,lev,map[sel].musicfn1);
// playmusicMAP(ID,sel);
return 0;
}
void playmusicMAP(const char *fn,const int sel)
{
Musicsize=0;
if(map[sel].musicfn1)
playmusic(map[sel].musicfn1);
if(!Musicsize)
playmusic(fn);
}

View file

@ -111,6 +111,11 @@ int FX_PlayWAV( char *ptr, int pitchoffset, int vol, int left, int right,
int FX_PlayLoopedWAV( char *ptr, int loopstart, int loopend,
int pitchoffset, int vol, int left, int right, int priority,
unsigned int callbackval );
int FX_PlayLoopedOGG( char *ptr, int loopstart, int loopend,
int pitchoffset, int vol, int left, int right, int priority,
unsigned int callbackval );
int FX_PlayOGG3D( char *ptr, int pitchoffset, int angle, int distance,
int priority, unsigned int callbackval );
int FX_PlayVOC3D( char *ptr, int pitchoffset, int angle, int distance,
int priority, unsigned int callbackval );
int FX_PlayWAV3D( char *ptr, int pitchoffset, int angle, int distance,
@ -134,4 +139,7 @@ void FX_StopRecord( void );
void FX_Update(void);
int AL_DefineMusic(char *ID,char *name);
int AL_DefineSound(int ID,char *name);
#endif

View file

@ -35,6 +35,8 @@ Modifications for JonoF's port by Jonathon Fowler (jonof@edgenetwk.com)
#ifndef _MSC_VER
#include <unistd.h>
#endif
#include <duke3d.h>
#ifdef _WIN32
#include "dsoundout.h"
#else
@ -47,6 +49,9 @@ Modifications for JonoF's port by Jonathon Fowler (jonof@edgenetwk.com)
#include "pitch.h"
#include "multivoc.h"
#include "_multivc.h"
#ifdef USE_OPENAL
#include "openal.h"
#endif
#define STEREO 1
#define SIXTEEN_BIT 2
@ -201,7 +206,11 @@ char *MV_ErrorString(int ErrorNumber)
case MV_InvalidWAVFile :
ErrorString = "Invalid WAV file passed in to Multivoc.";
break;
#ifdef USE_OPENAL
case MV_InvalidOGGFile :
ErrorString = "Invalid OGG file passed in to Multivoc.";
break;
#endif
case MV_InvalidMixMode :
ErrorString = "Invalid mix mode request in Multivoc.";
break;
@ -367,7 +376,10 @@ void MV_PlayVoice(VoiceNode *voice)
flags = DisableInterrupts();
LL_SortedInsertion(&VoiceList, voice, prev, next, VoiceNode, priority);
#ifdef USE_OPENAL
if(!voice->bufsnd)voice->bufsnd=(char *)Bcalloc(0x8000*4,sizeof(char));
if(!voice->bufsnd)initprintf("Attention. It gonna crash! Thank you."); // FIXME: change the msg
#endif
RestoreInterrupts(flags);
}
@ -383,7 +395,9 @@ void MV_StopVoice(VoiceNode *voice)
unsigned int flags;
flags = DisableInterrupts();
#ifdef USE_OPENAL
if(!voice->bufsnd)Bfree(voice->bufsnd);
#endif
// move the voice from the play list to the free list
LL_Remove(voice, next, prev);
LL_Add(&VoicePool, voice, next, prev);
@ -893,7 +907,76 @@ playbackstatus MV_GetNextWAVBlock(VoiceNode *voice)
return(KeepPlaying);
}
/*---------------------------------------------------------------------
Function: MV_GetNextOGGBlock
Controls playback of demand fed data.
---------------------------------------------------------------------*/
#ifdef USE_OPENAL
void downsample(char *ptr,int size,int factor)
{
short *pti=(short *)ptr;int i,j,sum;
for(i=0;i<size>>factor;i++)
{
sum=0;
for(j=0;j<1<<factor;j++)sum+=pti[(i<<factor)+j];
pti[i]=sum>>factor;
}
}
playbackstatus MV_GetNextOGGBlock(VoiceNode *voice)
{
int sz;
int size=0;
int section,result;
// initprintf("_%d %d, %d\n",voice->callbackval,voice->position,voice->BlockLength);
if (voice->BlockLength <= 0)
{
if (voice->LoopStart == NULL)
{
// initprintf("END %d\n",voice->callbackval);
voice->Playing = FALSE;
return(NoMoreData);
}
// initprintf("repeat 2\n");
voice->BlockLength = voice->LoopSize;
voice->length = 0;
voice->position = 0;
ov_pcm_seek(&voice->OGGstream.oggStream,0);
}
voice->position -= voice->length;
sz=voice->length = min(voice->BlockLength, 0x8000);
voice->BlockLength -= voice->length;
voice->length <<= 16;
sz<<=voice->downsample+1;
while(size<sz)
{
result=ov_read(&voice->OGGstream.oggStream,voice->bufsnd+(size>>voice->downsample),sz-size,0,2,1,&section);
if(result> 0)
{
downsample(voice->bufsnd+(size>>voice->downsample),result,voice->downsample);
size+=result;
}else
if(result==0)
{
// initprintf("!repeat %d\n",voice->callbackval);
voice->BlockLength=0;
voice->length=size<<16;break;
}else
{
initprintf("#%d\n",result);
break;
}
}
voice->sound=voice->bufsnd;
return(KeepPlaying);
}
#endif
/*---------------------------------------------------------------------
Function: MV_ServiceRecord
@ -1674,6 +1757,47 @@ int MV_SetMixMode(int numchannels, int samplebits)
}
// ---------------------------------------------------------------------
// OGG file
// ---------------------------------------------------------------------
ov_callbacks cb;
size_t ReadOgg(void *ptr, size_t size1, size_t nmemb, void *datasource)
{
sounddef *d=(sounddef *)datasource;
size1*=nmemb;
if(d->pos>=d->size)return 0;
if(d->pos+size1>=d->size)size1=d->size-d->pos;
Bmemcpy(ptr,(d->ptrsnd+d->pos),size1);
d->pos+=size1;
return size1;
}
int SeekOgg(void *datasource,ogg_int64_t offset,int whence)
{
sounddef *d=(sounddef *)datasource;
switch(whence)
{
case SEEK_SET: whence=offset;break;
case SEEK_CUR: whence=d->pos+offset;break;
case SEEK_END: whence=d->size-offset-1;break;
default: return -1;
}
if(whence>=(int)d->size||whence<0)return -1;
d->pos=whence;
return 0;
}
long TellOgg(void *datasource)
{
sounddef *d=(sounddef *)datasource;
return d->pos;
}
int CloseOgg(void *datasource)
{
return 0;
}
/*---------------------------------------------------------------------
Function: MV_StartPlayback
@ -1685,6 +1809,11 @@ int MV_StartPlayback(void)
int status;
int buffer;
cb.close_func=CloseOgg;
cb.read_func =ReadOgg;
cb.seek_func =SeekOgg;
cb.tell_func =TellOgg;
// Initialize the buffers
ClearBuffer_DW(MV_MixBuffer[ 0 ], MV_Silence, TotalBufferSize >> 2);
for (buffer = 0; buffer < MV_NumberOfBuffers; buffer++)
@ -1968,6 +2097,11 @@ int MV_PlayWAV(char *ptr, int pitchoffset, int vol, int left, int right, int pri
int status;
status = MV_PlayLoopedWAV(ptr, -1, -1, pitchoffset, vol, left, right, priority, callbackval);
if (status < MV_Ok)
{
sprintf(tempbuf, "Sound error %d: %s\n",callbackval, FX_ErrorString(FX_Error));
initprintf(tempbuf);
}
return(status);
}
@ -2185,6 +2319,11 @@ int MV_PlayVOC(char *ptr, int pitchoffset, int vol, int left, int right, int pri
int status;
status = MV_PlayLoopedVOC(ptr, -1, -1, pitchoffset, vol, left, right, priority, callbackval);
if (status < MV_Ok)
{
sprintf(tempbuf, "Sound error %d: %s\n",callbackval, FX_ErrorString(FX_Error));
initprintf(tempbuf);
}
return(status);
}
@ -2254,7 +2393,154 @@ int MV_PlayLoopedVOC(char *ptr, int loopstart, int loopend, int pitchoffset, int
return(voice->handle);
}
/*---------------------------------------------------------------------
Function: MV_PlayLoopedOGG
Begin playback of sound data with the given sound levels and
priority.
---------------------------------------------------------------------*/
VoiceNode *voice;
#ifdef USE_OPENAL
int MV_PlayLoopedOGG(char *ptr, int loopstart, int loopend, int pitchoffset, int vol, int left, int right, int priority, unsigned int callbackval)
{
vorbis_info *vorbisInfo;
int length;
if (!MV_Installed)
{
MV_SetErrorCode(MV_NotInstalled);
return(MV_Error);
}
// Request a voice from the voice pool
voice = MV_AllocVoice(priority);
if (voice == NULL)
{
MV_SetErrorCode(MV_NoVoices);
return(MV_Error);
}
voice->OGGstream.pos=0;
voice->OGGstream.ptrsnd=ptr;
voice->OGGstream.size=g_sounds[callbackval].soundsiz;
voice->downsample=0;
if(ov_open_callbacks(&voice->OGGstream,&voice->OGGstream.oggStream,0,0,cb)<0)
{
MV_SetErrorCode(MV_InvalidOGGFile);
return(MV_Error);
}
vorbisInfo=ov_info(&voice->OGGstream.oggStream,-1);
if(!vorbisInfo)
{
MV_SetErrorCode(MV_InvalidOGGFile);
return(MV_Error);
}
while((uint64)(vorbisInfo->rate)/(1<<voice->downsample)*PITCH_GetScale(pitchoffset)/0x1000000/0x100)
voice->downsample++;
length=ov_pcm_total(&voice->OGGstream.oggStream,0);
if(!length)length=0xffffff;
loopend=length=length>>voice->downsample;
voice->wavetype = OGG;
voice->bits = 16;
voice->GetSound = MV_GetNextOGGBlock;
voice->Playing = TRUE;
voice->DemandFeed = NULL;
voice->LoopStart = NULL;
voice->LoopCount = 0;
voice->position = 0;
voice->length = 0;
voice->BlockLength = loopend;
voice->NextBlock = NULL;
voice->next = NULL;
voice->prev = NULL;
voice->priority = priority;
voice->callbackval = callbackval;
voice->LoopStart = voice->NextBlock + loopstart+1;
voice->LoopEnd = voice->NextBlock + loopend+1;
voice->LoopSize = loopend - loopstart;
if (loopstart < 0)
{
voice->LoopStart = NULL;
voice->LoopEnd = NULL;
voice->BlockLength = length;
}
MV_SetVoicePitch(voice, vorbisInfo->rate>>voice->downsample, pitchoffset);
if(vorbisInfo->channels==2)voice->downsample++;
MV_SetVoiceVolume(voice, vol, left, right);
MV_PlayVoice(voice);
return(voice->handle);
}
/*---------------------------------------------------------------------
Function: MV_PlayOGG
Begin playback of sound data with the given sound levels and
priority.
---------------------------------------------------------------------*/
int MV_PlayOGG(char *ptr, int pitchoffset, int vol, int left, int right, int priority, unsigned int callbackval)
{
int status;
status = MV_PlayLoopedOGG(ptr, -1, -1, pitchoffset, vol, left, right, priority, callbackval);
if (status < MV_Ok)
{
sprintf(tempbuf, "Sound error %d: %s\n",callbackval, FX_ErrorString(FX_Error));
initprintf(tempbuf);
}
return(status);
}
/*---------------------------------------------------------------------
Function: MV_PlayOGG3D
Begin playback of sound data at specified angle and distance
from listener.
---------------------------------------------------------------------*/
int MV_PlayOGG3D(char *ptr, int pitchoffset, int angle, int distance, int priority, unsigned int callbackval)
{
int left;
int right;
int mid;
int volume;
int status;
if (!MV_Installed)
{
MV_SetErrorCode(MV_NotInstalled);
return(MV_Error);
}
if (distance < 0)
{
distance = -distance;
angle += MV_NumPanPositions / 2;
}
volume = MIX_VOLUME(distance);
// Ensure angle is within 0 - 31
angle &= MV_MaxPanPosition;
left = MV_PanTable[ angle ][ volume ].left;
right = MV_PanTable[ angle ][ volume ].right;
mid = max(0, 255 - distance);
status = MV_PlayOGG(ptr, pitchoffset, mid, left, right, priority, callbackval);
return(status);
}
#endif
/*---------------------------------------------------------------------
Function: MV_CreateVolumeTable
@ -2582,6 +2868,9 @@ int MV_Init(int soundcard, int MixRate, int Voices, int numchannels, int sampleb
MV_SetReverseStereo(FALSE);
// Initialize the sound card
#ifdef USE_OPENAL
AL_Init();
#endif
#if defined(_WIN32)
status = DSOUND_Init(soundcard, MixRate, numchannels, samplebits, TotalBufferSize);
if (status != DSOUND_Ok)
@ -2682,6 +2971,9 @@ int MV_Shutdown(void)
MV_StopPlayback();
// Shutdown the sound card
#ifdef USE_OPENAL
AL_Shutdown();
#endif
#if defined(_WIN32)
DSOUND_Shutdown();
#else

View file

@ -50,6 +50,9 @@ enum MV_Errors
MV_DPMI_Error,
MV_InvalidVOCFile,
MV_InvalidWAVFile,
#ifdef USE_OPENAL
MV_InvalidOGGFile,
#endif
MV_InvalidMixMode,
MV_IrqFailure,
MV_DMAFailure,
@ -95,6 +98,13 @@ int MV_PlayWAV3D( char *ptr, int pitchoffset, int angle, int distance,
int MV_PlayLoopedWAV( char *ptr, int loopstart, int loopend,
int pitchoffset, int vol, int left, int right, int priority,
unsigned int callbackval );
int MV_PlayOGG( char *ptr, int pitchoffset, int vol, int left,
int right, int priority, unsigned int callbackval );
int MV_PlayOGG3D( char *ptr, int pitchoffset, int angle, int distance,
int priority, unsigned int callbackval );
int MV_PlayLoopedOGG( char *ptr, int loopstart, int loopend,
int pitchoffset, int vol, int left, int right, int priority,
unsigned int callbackval );
int MV_PlayVOC3D( char *ptr, int pitchoffset, int angle, int distance,
int priority, unsigned int callbackval );
int MV_PlayVOC( char *ptr, int pitchoffset, int vol, int left, int right,

View file

@ -34,15 +34,23 @@ Modifications for JonoF's port by Jonathon Fowler (jonof@edgenetwk.com)
#include "music.h"
#include "midi.h"
#include "mpu401.h"
#ifdef USE_OPENAL
#include "openal.h"
#endif
#ifndef TRUE
#define TRUE ( 1 == 1 )
#define FALSE ( !TRUE )
#endif
#ifdef __MINGW32__
#define max(a,b) (((a)>(b))?(a):(b))
#ifndef min
#define min(a,b) (((a)<(b))?(a):(b))
#endif
#ifndef max
# define max(a,b) ( ((a) > (b)) ? (a) : (b) )
#endif
int MUSIC_SoundDevice = -1;
int MUSIC_ErrorCode = MUSIC_Ok;
@ -182,7 +190,9 @@ void MUSIC_SetVolume
{
volume = max(0, volume);
volume = min(volume, 255);
#ifdef USE_OPENAL
AL_SetMusicVolume(volume);
#endif
if (MUSIC_SoundDevice != -1)
{
MIDI_SetVolume(volume);
@ -288,6 +298,9 @@ void MUSIC_Continue
)
{
#ifdef USE_OPENAL
AL_Continue();
#endif
MIDI_ContinueSong();
}
@ -304,6 +317,9 @@ void MUSIC_Pause
)
{
#ifdef USE_OPENAL
AL_Pause();
#endif
MIDI_PauseSong();
}
@ -320,6 +336,9 @@ int MUSIC_StopSong
)
{
#ifdef USE_OPENAL
AL_stop();
#endif
MUSIC_StopFade();
MIDI_StopSong();
MUSIC_SetErrorCode(MUSIC_Ok);
@ -342,14 +361,19 @@ int MUSIC_PlaySong
{
int status;
#ifdef USE_OPENAL
AL_PlaySong((char *)song,loopflag);
if(AL_isntALmusic())
#endif
{
MUSIC_StopSong();
status = MIDI_PlaySong(song, loopflag);
if (status != MIDI_Ok)
{
MUSIC_SetErrorCode(MUSIC_MidiError);
return(MUSIC_Warning);
}
}
return(MUSIC_Ok);
}

View file

@ -4238,9 +4238,9 @@ cheat_for_port_credits:
if (ud.recstat != 2 && g_player[myconnectindex].ps->gm&MODE_GAME)
{
if (map[(unsigned char)music_select].musicfn != NULL)
playmusic(&map[(unsigned char)music_select].musicfn[0]);
playmusicMAP(&map[(unsigned char)music_select].musicfn[0],music_select);
}
else playmusic(&env_music_fn[0][0]);
else playmusicMAP(&env_music_fn[0][0],MAXVOLUMES*MAXLEVELS);
MUSIC_Continue();
}

View file

@ -362,9 +362,9 @@ static int osdcmd_restartsound(const osdfuncparm_t *parm)
if (ud.recstat != 2 && g_player[myconnectindex].ps->gm&MODE_GAME)
{
if (map[(unsigned char)music_select].musicfn != NULL)
playmusic(&map[(unsigned char)music_select].musicfn[0]);
playmusicMAP(&map[(unsigned char)music_select].musicfn[0],music_select);
}
else playmusic(&env_music_fn[0][0]);
else playmusicMAP(&env_music_fn[0][0],MAXVOLUMES*MAXLEVELS);
}
return OSDCMD_OK;

View file

@ -272,14 +272,15 @@ static void cachegoodsprites(void)
static int getsound(unsigned int num)
{
short fp;
short fp = -1;
int l;
if (num >= MAXSOUNDS || ud.config.SoundToggle == 0) return 0;
if (ud.config.FXDevice < 0) return 0;
if (!g_sounds[num].filename) return 0;
fp = kopen4load(g_sounds[num].filename,loadfromgrouponly);
if(g_sounds[num].filename1)fp = kopen4load(g_sounds[num].filename1,loadfromgrouponly);
if (fp == -1)fp = kopen4load(g_sounds[num].filename,loadfromgrouponly);
if (fp == -1) return 0;
l = kfilelength(fp);
@ -1181,7 +1182,7 @@ void newgame(int vn,int ln,int sk)
if (ln == 0 && vn == 3 && ud.multimode < 2 && ud.lockout == 0)
{
playmusic(&env_music_fn[1][0]);
playmusicMAP(&env_music_fn[1][0],MAXVOLUMES*MAXLEVELS+1);
flushperms();
setview(0,0,xdim-1,ydim-1);
@ -1604,6 +1605,7 @@ int enterlevel(int g)
FX_StopAllSounds();
clearsoundlocks();
FX_SetReverb(0);
playmusicMAP(&env_music_fn[1][0],MAXVOLUMES*MAXLEVELS+2); // loadmus
if (boardfilename[0] != 0 && ud.m_level_number == 7 && ud.m_volume_number == 0)
{
@ -1751,15 +1753,13 @@ int enterlevel(int g)
cachedebug = 0;
automapping = 0;
if (ud.recstat != 2) MUSIC_StopSong();
cacheit();
if (ud.recstat != 2)
{
music_select = (ud.volume_number*MAXLEVELS) + ud.level_number;
if (map[(unsigned char)music_select].musicfn != NULL)
playmusic(&map[(unsigned char)music_select].musicfn[0]);
playmusicMAP(&map[(unsigned char)music_select].musicfn[0],music_select);
}
if ((g&MODE_GAME) || (g&MODE_EOL))

View file

@ -415,7 +415,7 @@ int loadplayer(int spot)
if (map[(unsigned char)music_select].musicfn != NULL && i != music_select)
{
MUSIC_StopSong();
playmusic(&map[(unsigned char)music_select].musicfn[0]);
playmusicMAP(&map[(unsigned char)music_select].musicfn[0],music_select);
}
g_player[myconnectindex].ps->gm = MODE_GAME;

View file

@ -203,11 +203,11 @@ void playmusic(const char *fn)
if (fp == -1) return;
l = kfilelength(fp);
if (l >= (signed int)sizeof(MusicPtr))
{
kclose(fp);
return;
}
MUSIC_StopSong();
Musicsize=0;
if(!MusicPtr)MusicPtr=Bcalloc(1,l);
else MusicPtr=Brealloc(MusicPtr,l);
Musicsize=l;
kread(fp, MusicPtr, l);
kclose(fp);
@ -228,7 +228,7 @@ void playmusic(const char *fn)
int loadsound(unsigned int num)
{
int fp, l;
int fp = -1, l;
if (num >= MAXSOUNDS || ud.config.SoundToggle == 0) return 0;
if (ud.config.FXDevice < 0) return 0;
@ -239,7 +239,8 @@ int loadsound(unsigned int num)
return 0;
}
fp = kopen4load(g_sounds[num].filename,loadfromgrouponly);
if(g_sounds[num].filename1)fp = kopen4load(g_sounds[num].filename1,loadfromgrouponly);
if (fp == -1)fp = kopen4load(g_sounds[num].filename,loadfromgrouponly);
if (fp == -1)
{
// Bsprintf(fta_quotes[113],"g_sounds %s(#%d) not found.",sounds[num],num);
@ -387,6 +388,12 @@ int xyzsound(int num,int i,int x,int y,int z)
if (*g_sounds[num].ptr == 'C')
voice = FX_PlayLoopedVOC(g_sounds[num].ptr, start, start + g_sounds[num].soundsiz,
pitch,sndist>>6,sndist>>6,0,g_sounds[num].pr,num);
#ifdef USE_OPENAL
else
if (*g_sounds[num].ptr == 'O')
voice = FX_PlayLoopedOGG(g_sounds[num].ptr, start, start + g_sounds[num].soundsiz,
pitch,sndist>>6,sndist>>6,0,g_sounds[num].pr,num);
#endif
else
voice = FX_PlayLoopedWAV(g_sounds[num].ptr, start, start + g_sounds[num].soundsiz,
pitch,sndist>>6,sndist>>6,0,g_sounds[num].pr,num);
@ -395,6 +402,11 @@ int xyzsound(int num,int i,int x,int y,int z)
{
if (*g_sounds[num].ptr == 'C')
voice = FX_PlayVOC3D(g_sounds[ num ].ptr,pitch,sndang>>6,sndist>>6, g_sounds[num].pr, num);
#ifdef USE_OPENAL
else
if (*g_sounds[num].ptr == 'O')
voice = FX_PlayOGG3D(g_sounds[ num ].ptr,pitch,sndang>>6,sndist>>6, g_sounds[num].pr, num);
#endif
else
voice = FX_PlayWAV3D(g_sounds[ num ].ptr,pitch,sndang>>6,sndist>>6, g_sounds[num].pr, num);
}
@ -457,6 +469,15 @@ void sound(int num)
voice = FX_PlayLoopedVOC(g_sounds[num].ptr, start, start + g_sounds[num].soundsiz,
pitch,LOUDESTVOLUME,LOUDESTVOLUME,LOUDESTVOLUME,g_sounds[num].pr,num);
}
#ifdef USE_OPENAL
else
if (*g_sounds[num].ptr == 'O')
{
start = (int)*(unsigned short *)(g_sounds[num].ptr + 0x14);
voice = FX_PlayLoopedOGG(g_sounds[num].ptr, start, start + g_sounds[num].soundsiz,
pitch,LOUDESTVOLUME,LOUDESTVOLUME,LOUDESTVOLUME,g_sounds[num].pr,num);
}
#endif
else
{
start = (int)*(unsigned short *)(g_sounds[num].ptr + 0x14);
@ -468,6 +489,11 @@ void sound(int num)
{
if (*g_sounds[num].ptr == 'C')
voice = FX_PlayVOC3D(g_sounds[ num ].ptr, pitch,0,255-LOUDESTVOLUME,g_sounds[num].pr, num);
#ifdef USE_OPENAL
else
if (*g_sounds[num].ptr == 'O')
voice = FX_PlayOGG3D(g_sounds[ num ].ptr, pitch,0,255-LOUDESTVOLUME,g_sounds[num].pr, num);
#endif
else
voice = FX_PlayWAV3D(g_sounds[ num ].ptr, pitch,0,255-LOUDESTVOLUME,g_sounds[num].pr, num);
}