mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-25 03:00:46 +00:00
git-svn-id: https://svn.eduke32.com/eduke32@637 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
bc0f8369e6
commit
6b956dfe2a
12 changed files with 1037 additions and 1037 deletions
|
@ -53,16 +53,12 @@ ifeq ($(PLATFORM),LINUX)
|
||||||
OBJ=obj
|
OBJ=obj
|
||||||
EOBJ=eobj
|
EOBJ=eobj
|
||||||
NASMFLAGS+= -f elf
|
NASMFLAGS+= -f elf
|
||||||
ifeq ($(USE_OPENAL),1)
|
LIBS+= -lvorbisfile -lvorbis -logg
|
||||||
LIBS+= -lvorbisfile -lvorbis -logg
|
|
||||||
endif
|
|
||||||
else
|
else
|
||||||
ifeq ($(PLATFORM),WINDOWS)
|
ifeq ($(PLATFORM),WINDOWS)
|
||||||
OBJ=obj_win
|
OBJ=obj_win
|
||||||
EOBJ=eobj_win
|
EOBJ=eobj_win
|
||||||
ifeq ($(USE_OPENAL),1)
|
LIBS+= -L$(ALROOT)/lib -lvorbisfile -lvorbis -logg
|
||||||
LIBS+= -L$(ALROOT)/lib -lvorbisfile -lvorbis -logg
|
|
||||||
endif
|
|
||||||
else
|
else
|
||||||
OBJ=obj
|
OBJ=obj
|
||||||
EOBJ=eobj
|
EOBJ=eobj
|
||||||
|
|
|
@ -8720,8 +8720,10 @@ static int parsegroupfiles(scriptfile *script)
|
||||||
initprintf("Error: missing ID for music definition near line %s:%d\n", script->filename, scriptfile_getlinum(script,tinttokptr));
|
initprintf("Error: missing ID for music definition near line %s:%d\n", script->filename, scriptfile_getlinum(script,tinttokptr));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
#ifdef USE_OPENAL
|
||||||
if (AL_DefineMusic(ID,ext))
|
if (AL_DefineMusic(ID,ext))
|
||||||
initprintf("Error: invalid music ID on line %s:%d\n", script->filename, scriptfile_getlinum(script,tinttokptr));
|
initprintf("Error: invalid music ID on line %s:%d\n", script->filename, scriptfile_getlinum(script,tinttokptr));
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -88,9 +88,7 @@ typedef enum
|
||||||
VOC,
|
VOC,
|
||||||
DemandFeed,
|
DemandFeed,
|
||||||
WAV,
|
WAV,
|
||||||
#ifdef USE_OPENAL
|
|
||||||
OGG
|
OGG
|
||||||
#endif
|
|
||||||
} wavedata;
|
} wavedata;
|
||||||
|
|
||||||
typedef enum
|
typedef enum
|
||||||
|
@ -134,11 +132,11 @@ typedef struct VoiceNode
|
||||||
int priority;
|
int priority;
|
||||||
|
|
||||||
void ( *DemandFeed )( char **ptr, unsigned int *length );
|
void ( *DemandFeed )( char **ptr, unsigned int *length );
|
||||||
#ifdef USE_OPENAL
|
|
||||||
struct sounddef OGGstream;
|
struct sounddef OGGstream;
|
||||||
char *bufsnd;
|
char *bufsnd;
|
||||||
int downsample;
|
int downsample;
|
||||||
#endif
|
|
||||||
short *LeftVolume;
|
short *LeftVolume;
|
||||||
short *RightVolume;
|
short *RightVolume;
|
||||||
|
|
||||||
|
|
|
@ -705,7 +705,6 @@ int FX_PlayWAV
|
||||||
|
|
||||||
Begin playback of sound data with the given volume and priority.
|
Begin playback of sound data with the given volume and priority.
|
||||||
---------------------------------------------------------------------*/
|
---------------------------------------------------------------------*/
|
||||||
#ifdef USE_OPENAL
|
|
||||||
int FX_PlayOGG
|
int FX_PlayOGG
|
||||||
(
|
(
|
||||||
char *ptr,
|
char *ptr,
|
||||||
|
@ -730,7 +729,6 @@ int FX_PlayOGG
|
||||||
|
|
||||||
return(handle);
|
return(handle);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------
|
/*---------------------------------------------------------------------
|
||||||
Function: FX_PlayWAV
|
Function: FX_PlayWAV
|
||||||
|
@ -766,7 +764,7 @@ int FX_PlayLoopedWAV
|
||||||
|
|
||||||
return(handle);
|
return(handle);
|
||||||
}
|
}
|
||||||
#ifdef USE_OPENAL
|
|
||||||
int FX_PlayLoopedOGG
|
int FX_PlayLoopedOGG
|
||||||
(
|
(
|
||||||
char *ptr,
|
char *ptr,
|
||||||
|
@ -795,7 +793,7 @@ int FX_PlayLoopedOGG
|
||||||
|
|
||||||
return(handle);
|
return(handle);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
/*---------------------------------------------------------------------
|
/*---------------------------------------------------------------------
|
||||||
Function: FX_PlayVOC3D
|
Function: FX_PlayVOC3D
|
||||||
|
|
||||||
|
@ -826,7 +824,7 @@ int FX_PlayVOC3D
|
||||||
|
|
||||||
return(handle);
|
return(handle);
|
||||||
}
|
}
|
||||||
#ifdef USE_OPENAL
|
|
||||||
int FX_PlayOGG3D
|
int FX_PlayOGG3D
|
||||||
(
|
(
|
||||||
char *ptr,
|
char *ptr,
|
||||||
|
@ -850,7 +848,6 @@ int FX_PlayOGG3D
|
||||||
|
|
||||||
return(handle);
|
return(handle);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------
|
/*---------------------------------------------------------------------
|
||||||
Function: FX_PlayWAV3D
|
Function: FX_PlayWAV3D
|
||||||
|
|
|
@ -206,11 +206,9 @@ char *MV_ErrorString(int ErrorNumber)
|
||||||
case MV_InvalidWAVFile :
|
case MV_InvalidWAVFile :
|
||||||
ErrorString = "Invalid WAV file passed in to Multivoc.";
|
ErrorString = "Invalid WAV file passed in to Multivoc.";
|
||||||
break;
|
break;
|
||||||
#ifdef USE_OPENAL
|
|
||||||
case MV_InvalidOGGFile :
|
case MV_InvalidOGGFile :
|
||||||
ErrorString = "Invalid OGG file passed in to Multivoc.";
|
ErrorString = "Invalid OGG file passed in to Multivoc.";
|
||||||
break;
|
break;
|
||||||
#endif
|
|
||||||
case MV_InvalidMixMode :
|
case MV_InvalidMixMode :
|
||||||
ErrorString = "Invalid mix mode request in Multivoc.";
|
ErrorString = "Invalid mix mode request in Multivoc.";
|
||||||
break;
|
break;
|
||||||
|
@ -918,7 +916,7 @@ playbackstatus MV_GetNextWAVBlock(VoiceNode *voice)
|
||||||
|
|
||||||
Controls playback of demand fed data.
|
Controls playback of demand fed data.
|
||||||
---------------------------------------------------------------------*/
|
---------------------------------------------------------------------*/
|
||||||
#ifdef USE_OPENAL
|
|
||||||
void downsample(char *ptr,int size,int factor)
|
void downsample(char *ptr,int size,int factor)
|
||||||
{
|
{
|
||||||
short *pti=(short *)ptr;int i,j,sum;
|
short *pti=(short *)ptr;int i,j,sum;
|
||||||
|
@ -982,7 +980,7 @@ playbackstatus MV_GetNextOGGBlock(VoiceNode *voice)
|
||||||
|
|
||||||
return(KeepPlaying);
|
return(KeepPlaying);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
/*---------------------------------------------------------------------
|
/*---------------------------------------------------------------------
|
||||||
Function: MV_ServiceRecord
|
Function: MV_ServiceRecord
|
||||||
|
|
||||||
|
@ -2406,7 +2404,7 @@ int MV_PlayLoopedVOC(char *ptr, int loopstart, int loopend, int pitchoffset, int
|
||||||
priority.
|
priority.
|
||||||
---------------------------------------------------------------------*/
|
---------------------------------------------------------------------*/
|
||||||
VoiceNode *voice;
|
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)
|
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;
|
vorbis_info *vorbisInfo;
|
||||||
|
@ -2546,7 +2544,7 @@ int MV_PlayOGG3D(char *ptr, int pitchoffset, int angle, int distance, int priori
|
||||||
|
|
||||||
return(status);
|
return(status);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
/*---------------------------------------------------------------------
|
/*---------------------------------------------------------------------
|
||||||
Function: MV_CreateVolumeTable
|
Function: MV_CreateVolumeTable
|
||||||
|
|
||||||
|
@ -2886,11 +2884,11 @@ int MV_Init(int soundcard, int MixRate, int Voices, int numchannels, int sampleb
|
||||||
Bfree(map[i].musicfn1);
|
Bfree(map[i].musicfn1);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i=MAXSOUNDS-1;i>=0;i--)
|
/* for (i=MAXSOUNDS-1;i>=0;i--)
|
||||||
{
|
{
|
||||||
if (g_sounds[i].filename1 != NULL)
|
if (g_sounds[i].filename1 != NULL)
|
||||||
Bfree(g_sounds[i].filename1);
|
Bfree(g_sounds[i].filename1);
|
||||||
}
|
} */
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
|
|
|
@ -50,9 +50,7 @@ enum MV_Errors
|
||||||
MV_DPMI_Error,
|
MV_DPMI_Error,
|
||||||
MV_InvalidVOCFile,
|
MV_InvalidVOCFile,
|
||||||
MV_InvalidWAVFile,
|
MV_InvalidWAVFile,
|
||||||
#ifdef USE_OPENAL
|
|
||||||
MV_InvalidOGGFile,
|
MV_InvalidOGGFile,
|
||||||
#endif
|
|
||||||
MV_InvalidMixMode,
|
MV_InvalidMixMode,
|
||||||
MV_IrqFailure,
|
MV_IrqFailure,
|
||||||
MV_DMAFailure,
|
MV_DMAFailure,
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,36 +1,36 @@
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#include "dsound.h"
|
#include "dsound.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "baselayer.h"
|
#include "baselayer.h"
|
||||||
#include "compat.h"
|
#include "compat.h"
|
||||||
#include <AL/al.h>
|
#include <AL/al.h>
|
||||||
#include <AL/alc.h>
|
#include <AL/alc.h>
|
||||||
#include <vorbis/vorbisfile.h>
|
#include <vorbis/vorbisfile.h>
|
||||||
#include "_multivc.h"
|
#include "_multivc.h"
|
||||||
|
|
||||||
ALCdevice * device=NULL;
|
ALCdevice * device=NULL;
|
||||||
ALCcontext * context=NULL;
|
ALCcontext * context=NULL;
|
||||||
|
|
||||||
char *ALdoing="";
|
char *ALdoing="";
|
||||||
int AL_Error;
|
int AL_Error;
|
||||||
int bufsize;
|
int bufsize;
|
||||||
int openal_disabled = 0;
|
int openal_disabled = 0;
|
||||||
|
|
||||||
typedef struct SD
|
typedef struct SD
|
||||||
{
|
{
|
||||||
ALuint buffers[16];
|
ALuint buffers[16];
|
||||||
ALuint source;
|
ALuint source;
|
||||||
ALenum format;
|
ALenum format;
|
||||||
|
|
||||||
char loop;
|
char loop;
|
||||||
char type;
|
char type;
|
||||||
int rate;
|
int rate;
|
||||||
sounddef def;
|
sounddef def;
|
||||||
}sounddef1;
|
}sounddef1;
|
||||||
|
|
||||||
sounddef1 sounds1[2];
|
sounddef1 sounds1[2];
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
// Windows
|
// Windows
|
||||||
static HANDLE hALDLL;
|
static HANDLE hALDLL;
|
||||||
|
@ -38,33 +38,33 @@ static HANDLE hALDLL;
|
||||||
#include <dlfcn.h>
|
#include <dlfcn.h>
|
||||||
|
|
||||||
static void *alhandle = NULL;
|
static void *alhandle = NULL;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
char *aldriver = NULL;
|
char *aldriver = NULL;
|
||||||
|
|
||||||
void (AL_APIENTRY * balGetSourcei)( ALuint sid, ALenum param, ALint* value );
|
void (AL_APIENTRY * balGetSourcei)( ALuint sid, ALenum param, ALint* value );
|
||||||
void (AL_APIENTRY * balSourcef)( ALuint sid, ALenum param, ALfloat value );
|
void (AL_APIENTRY * balSourcef)( ALuint sid, ALenum param, ALfloat value );
|
||||||
void (AL_APIENTRY * balSourcePlay)( ALuint sid );
|
void (AL_APIENTRY * balSourcePlay)( ALuint sid );
|
||||||
void (AL_APIENTRY * balSourcePause)( ALuint sid );
|
void (AL_APIENTRY * balSourcePause)( ALuint sid );
|
||||||
ALCenum (ALC_APIENTRY * balcGetError)( ALCdevice *device );
|
ALCenum (ALC_APIENTRY * balcGetError)( ALCdevice *device );
|
||||||
ALenum (AL_APIENTRY * balGetError)( void );
|
ALenum (AL_APIENTRY * balGetError)( void );
|
||||||
void (AL_APIENTRY * balBufferData)( ALuint bid, ALenum format, const ALvoid* data, ALsizei size, ALsizei freq );
|
void (AL_APIENTRY * balBufferData)( ALuint bid, ALenum format, const ALvoid* data, ALsizei size, ALsizei freq );
|
||||||
void (AL_APIENTRY * balGenBuffers)( ALsizei n, ALuint* buffers );
|
void (AL_APIENTRY * balGenBuffers)( ALsizei n, ALuint* buffers );
|
||||||
void (AL_APIENTRY * balGenSources)( ALsizei n, ALuint* sources );
|
void (AL_APIENTRY * balGenSources)( ALsizei n, ALuint* sources );
|
||||||
void (AL_APIENTRY * balSourcei)( ALuint sid, ALenum param, ALint value );
|
void (AL_APIENTRY * balSourcei)( ALuint sid, ALenum param, ALint value );
|
||||||
void (AL_APIENTRY * balSourceQueueBuffers)( ALuint sid, ALsizei numEntries, const ALuint *bids );
|
void (AL_APIENTRY * balSourceQueueBuffers)( ALuint sid, ALsizei numEntries, const ALuint *bids );
|
||||||
void (AL_APIENTRY * balSourceStop)( ALuint sid );
|
void (AL_APIENTRY * balSourceStop)( ALuint sid );
|
||||||
void (AL_APIENTRY * balSourceUnqueueBuffers)( ALuint sid, ALsizei numEntries, ALuint *bids );
|
void (AL_APIENTRY * balSourceUnqueueBuffers)( ALuint sid, ALsizei numEntries, ALuint *bids );
|
||||||
void (AL_APIENTRY * bbalDeleteSources)( ALsizei n, const ALuint* sources );
|
void (AL_APIENTRY * bbalDeleteSources)( ALsizei n, const ALuint* sources );
|
||||||
ALCboolean (ALC_APIENTRY * balcMakeContextCurrent)( ALCcontext *context );
|
ALCboolean (ALC_APIENTRY * balcMakeContextCurrent)( ALCcontext *context );
|
||||||
void (AL_APIENTRY * balDeleteSources)( ALsizei n, const ALuint* sources );
|
void (AL_APIENTRY * balDeleteSources)( ALsizei n, const ALuint* sources );
|
||||||
void (AL_APIENTRY * balDeleteBuffers)( ALsizei n, const ALuint* buffers );
|
void (AL_APIENTRY * balDeleteBuffers)( ALsizei n, const ALuint* buffers );
|
||||||
void (ALC_APIENTRY * balcDestroyContext)( ALCcontext *context );
|
void (ALC_APIENTRY * balcDestroyContext)( ALCcontext *context );
|
||||||
ALCboolean (ALC_APIENTRY * balcCloseDevice)( ALCdevice *device );
|
ALCboolean (ALC_APIENTRY * balcCloseDevice)( ALCdevice *device );
|
||||||
ALCdevice *(ALC_APIENTRY * balcOpenDevice)( const ALCchar *devicename );
|
ALCdevice *(ALC_APIENTRY * balcOpenDevice)( const ALCchar *devicename );
|
||||||
ALCcontext *(ALC_APIENTRY * balcCreateContext)( ALCdevice *device, const ALCint* attrlist );
|
ALCcontext *(ALC_APIENTRY * balcCreateContext)( ALCdevice *device, const ALCint* attrlist );
|
||||||
const ALchar* (AL_APIENTRY * balGetString)( ALenum param );
|
const ALchar* (AL_APIENTRY * balGetString)( ALenum param );
|
||||||
|
|
||||||
static void * algetproc_(const char *s, int *err, int fatal)
|
static void * algetproc_(const char *s, int *err, int fatal)
|
||||||
{
|
{
|
||||||
void *t;
|
void *t;
|
||||||
|
@ -101,26 +101,26 @@ int unloadaldriver(void)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
balGetSourcei = NULL;
|
balGetSourcei = NULL;
|
||||||
balSourcef = NULL;
|
balSourcef = NULL;
|
||||||
balSourcePlay = NULL;
|
balSourcePlay = NULL;
|
||||||
balSourcePause = NULL;
|
balSourcePause = NULL;
|
||||||
balcGetError = NULL;
|
balcGetError = NULL;
|
||||||
balGetError = NULL;
|
balGetError = NULL;
|
||||||
balBufferData = NULL;
|
balBufferData = NULL;
|
||||||
balGenBuffers = NULL;
|
balGenBuffers = NULL;
|
||||||
balGenSources = NULL;
|
balGenSources = NULL;
|
||||||
balSourcei = NULL;
|
balSourcei = NULL;
|
||||||
balSourceQueueBuffers = NULL;
|
balSourceQueueBuffers = NULL;
|
||||||
balSourceStop = NULL;
|
balSourceStop = NULL;
|
||||||
balSourceUnqueueBuffers = NULL;
|
balSourceUnqueueBuffers = NULL;
|
||||||
bbalDeleteSources = NULL;
|
bbalDeleteSources = NULL;
|
||||||
balcMakeContextCurrent = NULL;
|
balcMakeContextCurrent = NULL;
|
||||||
balDeleteSources = NULL;
|
balDeleteSources = NULL;
|
||||||
balDeleteBuffers = NULL;
|
balDeleteBuffers = NULL;
|
||||||
balcDestroyContext = NULL;
|
balcDestroyContext = NULL;
|
||||||
balcCloseDevice = NULL;
|
balcCloseDevice = NULL;
|
||||||
balcOpenDevice = NULL;
|
balcOpenDevice = NULL;
|
||||||
balcCreateContext = NULL;
|
balcCreateContext = NULL;
|
||||||
balGetString = NULL;
|
balGetString = NULL;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -159,309 +159,309 @@ int loadaldriver(void)
|
||||||
aldriver = strdup(driver);
|
aldriver = strdup(driver);
|
||||||
|
|
||||||
balGetSourcei = ALGETPROC("alGetSourcei");
|
balGetSourcei = ALGETPROC("alGetSourcei");
|
||||||
balSourcef = ALGETPROC("alSourcef");
|
balSourcef = ALGETPROC("alSourcef");
|
||||||
balSourcePlay = ALGETPROC("alSourcePlay");
|
balSourcePlay = ALGETPROC("alSourcePlay");
|
||||||
balSourcePause = ALGETPROC("alSourcePause");
|
balSourcePause = ALGETPROC("alSourcePause");
|
||||||
balcGetError = ALGETPROC("alcGetError");
|
balcGetError = ALGETPROC("alcGetError");
|
||||||
balGetError = ALGETPROC("alGetError");
|
balGetError = ALGETPROC("alGetError");
|
||||||
balBufferData = ALGETPROC("alBufferData");
|
balBufferData = ALGETPROC("alBufferData");
|
||||||
balGenBuffers = ALGETPROC("alGenBuffers");
|
balGenBuffers = ALGETPROC("alGenBuffers");
|
||||||
balGenSources = ALGETPROC("alGenSources");
|
balGenSources = ALGETPROC("alGenSources");
|
||||||
balSourcei = ALGETPROC("alSourcei");
|
balSourcei = ALGETPROC("alSourcei");
|
||||||
balSourceQueueBuffers = ALGETPROC("alSourceQueueBuffers");
|
balSourceQueueBuffers = ALGETPROC("alSourceQueueBuffers");
|
||||||
balSourceStop = ALGETPROC("alSourceStop");
|
balSourceStop = ALGETPROC("alSourceStop");
|
||||||
balSourceUnqueueBuffers = ALGETPROC("alSourceUnqueueBuffers");
|
balSourceUnqueueBuffers = ALGETPROC("alSourceUnqueueBuffers");
|
||||||
balDeleteSources = ALGETPROC("alDeleteSources");
|
balDeleteSources = ALGETPROC("alDeleteSources");
|
||||||
balcMakeContextCurrent = ALGETPROC("alcMakeContextCurrent");
|
balcMakeContextCurrent = ALGETPROC("alcMakeContextCurrent");
|
||||||
balDeleteSources = ALGETPROC("alDeleteSources");
|
balDeleteSources = ALGETPROC("alDeleteSources");
|
||||||
balDeleteBuffers = ALGETPROC("alDeleteBuffers");
|
balDeleteBuffers = ALGETPROC("alDeleteBuffers");
|
||||||
balcDestroyContext = ALGETPROC("alcDestroyContext");
|
balcDestroyContext = ALGETPROC("alcDestroyContext");
|
||||||
balcCloseDevice = ALGETPROC("alcCloseDevice");
|
balcCloseDevice = ALGETPROC("alcCloseDevice");
|
||||||
balcOpenDevice = ALGETPROC("alcOpenDevice");
|
balcOpenDevice = ALGETPROC("alcOpenDevice");
|
||||||
balcCreateContext = ALGETPROC("alcCreateContext");
|
balcCreateContext = ALGETPROC("alcCreateContext");
|
||||||
balGetString = ALGETPROC("alGetString");
|
balGetString = ALGETPROC("alGetString");
|
||||||
|
|
||||||
if (err) unloadaldriver();
|
if (err) unloadaldriver();
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
char *ALC_ErrorString(int code)
|
|
||||||
{
|
|
||||||
switch(code)
|
|
||||||
{
|
|
||||||
case ALC_NO_ERROR:
|
|
||||||
return "OpenAL error: There is no current error.";
|
|
||||||
case ALC_INVALID_DEVICE:
|
|
||||||
return "OpenAL error: No device.";
|
|
||||||
case ALC_INVALID_CONTEXT:
|
|
||||||
return "OpenAL error: Invalid context ID.";
|
|
||||||
case ALC_INVALID_ENUM:
|
|
||||||
return "OpenAL error: Invalid parameter.";
|
|
||||||
case ALC_INVALID_VALUE:
|
|
||||||
return "OpenAL error: Invalid enum parameter value.";
|
|
||||||
case ALC_OUT_OF_MEMORY:
|
|
||||||
return "OpenAL error: Unable to allocate memory.";
|
|
||||||
default:
|
|
||||||
return "OpenAL error: Unknown error.";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
char *AL_ErrorString(int code)
|
|
||||||
{
|
|
||||||
switch(code)
|
|
||||||
{
|
|
||||||
case AL_NO_ERROR:
|
|
||||||
return "OpenAL error: There is no current error.";
|
|
||||||
case AL_INVALID_NAME:
|
|
||||||
return "OpenAL error: Invalid name parameter.";
|
|
||||||
case AL_INVALID_ENUM:
|
|
||||||
return "OpenAL error: Invalid parameter.";
|
|
||||||
case AL_INVALID_VALUE:
|
|
||||||
return "OpenAL error: Invalid enum parameter value.";
|
|
||||||
case AL_INVALID_OPERATION:
|
|
||||||
return "OpenAL error: Illegal call.";
|
|
||||||
case AL_OUT_OF_MEMORY:
|
|
||||||
return "OpenAL error: Unable to allocate memory.";
|
|
||||||
case OV_EFAULT:
|
|
||||||
return "Internal logic fault (bug or heap/stack corruption.";
|
|
||||||
case OV_EREAD:
|
|
||||||
return "Read from media.";
|
|
||||||
case OV_EIMPL:
|
|
||||||
return "The bitstream makes use of a feature not implemented in this library version.";
|
|
||||||
case OV_EINVAL:
|
|
||||||
return "Invalid argument value.";
|
|
||||||
case OV_ENOTVORBIS:
|
|
||||||
return "Not Vorbis data.";
|
|
||||||
case OV_EBADHEADER:
|
|
||||||
return "Invalid Vorbis header.";
|
|
||||||
case OV_EVERSION:
|
|
||||||
return "Vorbis version mismatch.";
|
|
||||||
case OV_ENOTAUDIO:
|
|
||||||
return "Packet data submitted to vorbis_synthesis is not audio data.";
|
|
||||||
case OV_EBADPACKET:
|
|
||||||
return "Invalid packet submitted to vorbis_synthesis.";
|
|
||||||
case OV_EBADLINK:
|
|
||||||
return "Invalid stream section supplied to libvorbis/libvorbisfile, or the requested link is corrupt.";
|
|
||||||
case OV_ENOSEEK:
|
|
||||||
return "Bitstream is not seekable.";
|
|
||||||
default:
|
|
||||||
return "Unknown OpenAL/Ogg error.";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
void check(int show)
|
|
||||||
{
|
|
||||||
AL_Error=balcGetError(device);
|
|
||||||
if(AL_Error!=ALC_NO_ERROR&&show)initprintf("%s(%s)\n",ALC_ErrorString(AL_Error),ALdoing);
|
|
||||||
AL_Error=balGetError();
|
|
||||||
if(AL_Error!= AL_NO_ERROR&&show)initprintf("%s(%s)\n", AL_ErrorString(AL_Error),ALdoing);
|
|
||||||
}
|
|
||||||
extern ov_callbacks cb;
|
|
||||||
|
|
||||||
|
|
||||||
int AL_Init()
|
|
||||||
{
|
|
||||||
if (loadaldriver())
|
|
||||||
{
|
|
||||||
initprintf("Failed loading OpenAL driver.\n");
|
|
||||||
openal_disabled = 1;
|
|
||||||
|
|
||||||
return 1;
|
char *ALC_ErrorString(int code)
|
||||||
}
|
{
|
||||||
|
switch(code)
|
||||||
ALdoing="Init";
|
{
|
||||||
// device=alcOpenDevice(ud.config.HardwareAL?"Generic Hardware":"Generic Software");
|
case ALC_NO_ERROR:
|
||||||
device=balcOpenDevice(NULL);
|
return "OpenAL error: There is no current error.";
|
||||||
check(1);
|
case ALC_INVALID_DEVICE:
|
||||||
if(device)
|
return "OpenAL error: No device.";
|
||||||
{
|
case ALC_INVALID_CONTEXT:
|
||||||
context=balcCreateContext(device,NULL);
|
return "OpenAL error: Invalid context ID.";
|
||||||
check(1);
|
case ALC_INVALID_ENUM:
|
||||||
}
|
return "OpenAL error: Invalid parameter.";
|
||||||
if(context)
|
case ALC_INVALID_VALUE:
|
||||||
{
|
return "OpenAL error: Invalid enum parameter value.";
|
||||||
balcMakeContextCurrent(context);check(1);
|
case ALC_OUT_OF_MEMORY:
|
||||||
initprintf("OpenAL Information:\n"
|
return "OpenAL error: Unable to allocate memory.";
|
||||||
" Version: %s\n"
|
default:
|
||||||
" Vendor: %s\n\n",balGetString(AL_VERSION),balGetString(AL_VENDOR));
|
return "OpenAL error: Unknown error.";
|
||||||
} else initprintf("OpenAL initialisation failed. Try http://www.openal.org/\n");
|
}
|
||||||
|
}
|
||||||
ALdoing="Open";
|
char *AL_ErrorString(int code)
|
||||||
balGenBuffers(16, sounds1[1].buffers);
|
{
|
||||||
check(1);
|
switch(code)
|
||||||
balGenSources(1,&sounds1[1].source);
|
{
|
||||||
check(1);
|
case AL_NO_ERROR:
|
||||||
|
return "OpenAL error: There is no current error.";
|
||||||
return 0;
|
case AL_INVALID_NAME:
|
||||||
}
|
return "OpenAL error: Invalid name parameter.";
|
||||||
|
case AL_INVALID_ENUM:
|
||||||
void AL_Shutdown()
|
return "OpenAL error: Invalid parameter.";
|
||||||
{
|
case AL_INVALID_VALUE:
|
||||||
ALdoing="Delete source";
|
return "OpenAL error: Invalid enum parameter value.";
|
||||||
balDeleteSources(1,&sounds1[1].source);
|
case AL_INVALID_OPERATION:
|
||||||
check(1);
|
return "OpenAL error: Illegal call.";
|
||||||
ALdoing="Delete buffers";
|
case AL_OUT_OF_MEMORY:
|
||||||
balDeleteBuffers(16, sounds1[1].buffers);
|
return "OpenAL error: Unable to allocate memory.";
|
||||||
check(1);
|
case OV_EFAULT:
|
||||||
|
return "Internal logic fault (bug or heap/stack corruption.";
|
||||||
ALdoing="Shut";
|
case OV_EREAD:
|
||||||
balcMakeContextCurrent(NULL);
|
return "Read from media.";
|
||||||
check(1);
|
case OV_EIMPL:
|
||||||
balcDestroyContext(context);
|
return "The bitstream makes use of a feature not implemented in this library version.";
|
||||||
check(1);
|
case OV_EINVAL:
|
||||||
balcCloseDevice(device);
|
return "Invalid argument value.";
|
||||||
unloadaldriver();
|
case OV_ENOTVORBIS:
|
||||||
}
|
return "Not Vorbis data.";
|
||||||
|
case OV_EBADHEADER:
|
||||||
#define BUFFER_SIZE (4096 * 4*8*8)
|
return "Invalid Vorbis header.";
|
||||||
int AL_MusicVolume;
|
case OV_EVERSION:
|
||||||
sounddef1 music;
|
return "Vorbis version mismatch.";
|
||||||
extern int Musicsize;
|
case OV_ENOTAUDIO:
|
||||||
|
return "Packet data submitted to vorbis_synthesis is not audio data.";
|
||||||
|
case OV_EBADPACKET:
|
||||||
void AL_stop();
|
return "Invalid packet submitted to vorbis_synthesis.";
|
||||||
int update();
|
case OV_EBADLINK:
|
||||||
int stream(ALuint buffer);
|
return "Invalid stream section supplied to libvorbis/libvorbisfile, or the requested link is corrupt.";
|
||||||
void open1(char *ptr,int sizef,char loop);
|
case OV_ENOSEEK:
|
||||||
|
return "Bitstream is not seekable.";
|
||||||
|
default:
|
||||||
|
return "Unknown OpenAL/Ogg error.";
|
||||||
void AL_Pause() {if(music.def.size)balSourcePause(music.source);}
|
}
|
||||||
void AL_Continue() {if(music.def.size)balSourcePlay(music.source);}
|
}
|
||||||
void AL_Update() {if(music.def.size&&!update(0))AL_stop();}
|
void check(int show)
|
||||||
int AL_isntALmusic() {return !music.def.size;}
|
{
|
||||||
|
AL_Error=balcGetError(device);
|
||||||
void AL_SetMusicVolume(int volume)
|
if(AL_Error!=ALC_NO_ERROR&&show)initprintf("%s(%s)\n",ALC_ErrorString(AL_Error),ALdoing);
|
||||||
{
|
AL_Error=balGetError();
|
||||||
AL_MusicVolume=volume;
|
if(AL_Error!= AL_NO_ERROR&&show)initprintf("%s(%s)\n", AL_ErrorString(AL_Error),ALdoing);
|
||||||
if(music.def.size)balSourcef(music.source,AL_GAIN,volume/(255.));
|
}
|
||||||
}
|
extern ov_callbacks cb;
|
||||||
|
|
||||||
int isplaying()
|
|
||||||
{
|
int AL_Init()
|
||||||
ALenum state;
|
{
|
||||||
balGetSourcei(music.source,AL_SOURCE_STATE,&state);
|
if (loadaldriver())
|
||||||
return state==AL_PLAYING;
|
{
|
||||||
}
|
initprintf("Failed loading OpenAL driver.\nDownload OpenAL 1.1 or greater from http://www.openal.org/downloads.html.");
|
||||||
|
openal_disabled = 1;
|
||||||
int update()
|
|
||||||
{
|
return 1;
|
||||||
int processed=0;
|
}
|
||||||
int active=1;
|
|
||||||
ALuint buffer;
|
ALdoing="Init";
|
||||||
|
// device=alcOpenDevice(ud.config.HardwareAL?"Generic Hardware":"Generic Software");
|
||||||
ALdoing="update";
|
device=balcOpenDevice(NULL);
|
||||||
balGetSourcei(music.source,AL_BUFFERS_PROCESSED,&processed);
|
check(1);
|
||||||
check(1);
|
if(device)
|
||||||
if(processed)
|
{
|
||||||
switch(music.type)
|
context=balcCreateContext(device,NULL);
|
||||||
{
|
check(1);
|
||||||
case 1:
|
}
|
||||||
while(processed--)
|
if(context)
|
||||||
{
|
{
|
||||||
balSourceUnqueueBuffers(music.source,1,&buffer);
|
balcMakeContextCurrent(context);check(1);
|
||||||
check(1);
|
initprintf("OpenAL Information:\n"
|
||||||
active=stream(buffer);
|
" Version: %s\n"
|
||||||
if(active)
|
" Vendor: %s\n\n",balGetString(AL_VERSION),balGetString(AL_VENDOR));
|
||||||
{
|
} else initprintf("OpenAL initialization failed.\n");
|
||||||
balSourceQueueBuffers(music.source,1,&buffer);
|
|
||||||
check(1);
|
ALdoing="Open";
|
||||||
}
|
balGenBuffers(16, sounds1[1].buffers);
|
||||||
}
|
check(1);
|
||||||
break;
|
balGenSources(1,&sounds1[1].source);
|
||||||
}
|
check(1);
|
||||||
return active;
|
|
||||||
}
|
return 0;
|
||||||
|
}
|
||||||
void AL_stop()
|
|
||||||
{
|
void AL_Shutdown()
|
||||||
int queued=0;ALuint buffer;
|
{
|
||||||
|
ALdoing="Delete source";
|
||||||
if(!music.def.size)return;
|
balDeleteSources(1,&sounds1[1].source);
|
||||||
|
check(1);
|
||||||
balSourceStop(music.source);
|
ALdoing="Delete buffers";
|
||||||
balGetSourcei(music.source,AL_BUFFERS_QUEUED,&queued);
|
balDeleteBuffers(16, sounds1[1].buffers);
|
||||||
|
check(1);
|
||||||
ALdoing="release";
|
|
||||||
while(queued--)
|
ALdoing="Shut";
|
||||||
{
|
balcMakeContextCurrent(NULL);
|
||||||
balSourceUnqueueBuffers(music.source,1,&buffer);
|
check(1);
|
||||||
check(1);
|
balcDestroyContext(context);
|
||||||
}
|
check(1);
|
||||||
balDeleteSources(1,&music.source);check(1);
|
balcCloseDevice(device);
|
||||||
balDeleteBuffers(2, music.buffers);check(1);
|
unloadaldriver();
|
||||||
|
}
|
||||||
if(music.type==1)ov_clear(&music.def.oggStream);
|
|
||||||
Bmemset(&music,0,sizeof(sounddef1));
|
#define BUFFER_SIZE (4096 * 4*8*8)
|
||||||
}
|
int AL_MusicVolume;
|
||||||
|
sounddef1 music;
|
||||||
int stream(ALuint buffer)
|
extern int Musicsize;
|
||||||
{
|
|
||||||
char pcm[BUFFER_SIZE];
|
|
||||||
ALsizei size=0;
|
void AL_Stop();
|
||||||
int section,result;
|
int update();
|
||||||
|
int stream(ALuint buffer);
|
||||||
while(size<BUFFER_SIZE)
|
void open1(char *ptr,int sizef,char loop);
|
||||||
{
|
|
||||||
result=ov_read(&music.def.oggStream,pcm+size,BUFFER_SIZE-size,0,2,1,§ion);
|
|
||||||
if(result==0&&music.loop)ov_pcm_seek(&music.def.oggStream,0);else
|
|
||||||
if(result> 0)size+=result;else break;
|
void AL_Pause() {if(music.def.size)balSourcePause(music.source);}
|
||||||
}
|
void AL_Continue() {if(music.def.size)balSourcePlay(music.source);}
|
||||||
if(!size)return 0;
|
void AL_Update() {if(music.def.size&&!update(0))AL_Stop();}
|
||||||
ALdoing="stream";
|
int AL_isntALmusic() {return !music.def.size;}
|
||||||
balBufferData(buffer,music.format,pcm,size,music.rate);
|
|
||||||
check(1);
|
void AL_SetMusicVolume(int volume)
|
||||||
return 1;
|
{
|
||||||
}
|
AL_MusicVolume=volume;
|
||||||
|
if(music.def.size)balSourcef(music.source,AL_GAIN,volume/(255.));
|
||||||
void AL_PlaySong(char *ptr,int loop)
|
}
|
||||||
{
|
|
||||||
vorbis_info* vorbisInfo;
|
int isplaying()
|
||||||
int bf=2,i;
|
{
|
||||||
ALenum format;ALsizei size;ALsizei freq;ALvoid* data;
|
ALenum state;
|
||||||
|
balGetSourcei(music.source,AL_SOURCE_STATE,&state);
|
||||||
if(!context)return;
|
return state==AL_PLAYING;
|
||||||
Bmemset(&music,0,sizeof(sounddef1));
|
}
|
||||||
switch(*ptr)
|
|
||||||
{
|
int update()
|
||||||
case 'O':music.type=1;break;
|
{
|
||||||
default: return;
|
int processed=0;
|
||||||
}
|
int active=1;
|
||||||
music.def.size=Musicsize;
|
ALuint buffer;
|
||||||
music.loop=loop;
|
|
||||||
music.def.ptrsnd=ptr;
|
ALdoing="update";
|
||||||
|
balGetSourcei(music.source,AL_BUFFERS_PROCESSED,&processed);
|
||||||
switch(music.type)
|
check(1);
|
||||||
{
|
if(processed)
|
||||||
case 1:
|
switch(music.type)
|
||||||
if((i=ov_open_callbacks(&music.def,&music.def.oggStream,0,0,cb))<0)
|
{
|
||||||
{
|
case 1:
|
||||||
Bmemset(&music,0,sizeof(sounddef1));
|
while(processed--)
|
||||||
initprintf("Music error: %s\n",AL_ErrorString(i));
|
{
|
||||||
return;
|
balSourceUnqueueBuffers(music.source,1,&buffer);
|
||||||
}
|
check(1);
|
||||||
vorbisInfo=ov_info(&music.def.oggStream,-1);
|
active=stream(buffer);
|
||||||
if(!vorbisInfo)
|
if(active)
|
||||||
{
|
{
|
||||||
initprintf("Music error: vorbisInfo\n");
|
balSourceQueueBuffers(music.source,1,&buffer);
|
||||||
Bmemset(&music,0,sizeof(sounddef1));
|
check(1);
|
||||||
return;
|
}
|
||||||
}
|
}
|
||||||
music.rate=vorbisInfo->rate;
|
break;
|
||||||
music.format=(vorbisInfo->channels==1)?AL_FORMAT_MONO16:AL_FORMAT_STEREO16;break;
|
}
|
||||||
}
|
return active;
|
||||||
|
}
|
||||||
ALdoing="Open";
|
|
||||||
balGenBuffers(2, music.buffers);check(1);
|
void AL_Stop()
|
||||||
balGenSources(1,&music.source);check(1);
|
{
|
||||||
balSourcei(music.source,AL_SOURCE_RELATIVE,AL_TRUE);
|
int queued=0;ALuint buffer;
|
||||||
|
|
||||||
switch(music.type)
|
if(!music.def.size)return;
|
||||||
{
|
|
||||||
case 1: stream(music.buffers[0]);
|
balSourceStop(music.source);
|
||||||
if(!stream(music.buffers[1]))bf=1;
|
balGetSourcei(music.source,AL_BUFFERS_QUEUED,&queued);
|
||||||
balSourceQueueBuffers(music.source,bf,music.buffers);
|
|
||||||
break;
|
ALdoing="release";
|
||||||
}
|
while(queued--)
|
||||||
|
{
|
||||||
AL_SetMusicVolume(AL_MusicVolume);
|
balSourceUnqueueBuffers(music.source,1,&buffer);
|
||||||
AL_Continue();
|
check(1);
|
||||||
}
|
}
|
||||||
|
balDeleteSources(1,&music.source);check(1);
|
||||||
|
balDeleteBuffers(2, music.buffers);check(1);
|
||||||
|
|
||||||
|
if(music.type==1)ov_clear(&music.def.oggStream);
|
||||||
|
Bmemset(&music,0,sizeof(sounddef1));
|
||||||
|
}
|
||||||
|
|
||||||
|
int stream(ALuint buffer)
|
||||||
|
{
|
||||||
|
char pcm[BUFFER_SIZE];
|
||||||
|
ALsizei size=0;
|
||||||
|
int section,result;
|
||||||
|
|
||||||
|
while(size<BUFFER_SIZE)
|
||||||
|
{
|
||||||
|
result=ov_read(&music.def.oggStream,pcm+size,BUFFER_SIZE-size,0,2,1,§ion);
|
||||||
|
if(result==0&&music.loop)ov_pcm_seek(&music.def.oggStream,0);else
|
||||||
|
if(result> 0)size+=result;else break;
|
||||||
|
}
|
||||||
|
if(!size)return 0;
|
||||||
|
ALdoing="stream";
|
||||||
|
balBufferData(buffer,music.format,pcm,size,music.rate);
|
||||||
|
check(1);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
void AL_PlaySong(char *ptr,int loop)
|
||||||
|
{
|
||||||
|
vorbis_info* vorbisInfo;
|
||||||
|
int bf=2,i;
|
||||||
|
ALenum format;ALsizei size;ALsizei freq;ALvoid* data;
|
||||||
|
|
||||||
|
if(!context)return;
|
||||||
|
Bmemset(&music,0,sizeof(sounddef1));
|
||||||
|
switch(*ptr)
|
||||||
|
{
|
||||||
|
case 'O':music.type=1;break;
|
||||||
|
default: return;
|
||||||
|
}
|
||||||
|
music.def.size=Musicsize;
|
||||||
|
music.loop=loop;
|
||||||
|
music.def.ptrsnd=ptr;
|
||||||
|
|
||||||
|
switch(music.type)
|
||||||
|
{
|
||||||
|
case 1:
|
||||||
|
if((i=ov_open_callbacks(&music.def,&music.def.oggStream,0,0,cb))<0)
|
||||||
|
{
|
||||||
|
Bmemset(&music,0,sizeof(sounddef1));
|
||||||
|
initprintf("Music error: %s\n",AL_ErrorString(i));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
vorbisInfo=ov_info(&music.def.oggStream,-1);
|
||||||
|
if(!vorbisInfo)
|
||||||
|
{
|
||||||
|
initprintf("Music error: vorbisInfo\n");
|
||||||
|
Bmemset(&music,0,sizeof(sounddef1));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
music.rate=vorbisInfo->rate;
|
||||||
|
music.format=(vorbisInfo->channels==1)?AL_FORMAT_MONO16:AL_FORMAT_STEREO16;break;
|
||||||
|
}
|
||||||
|
|
||||||
|
ALdoing="Open";
|
||||||
|
balGenBuffers(2, music.buffers);check(1);
|
||||||
|
balGenSources(1,&music.source);check(1);
|
||||||
|
balSourcei(music.source,AL_SOURCE_RELATIVE,AL_TRUE);
|
||||||
|
|
||||||
|
switch(music.type)
|
||||||
|
{
|
||||||
|
case 1: stream(music.buffers[0]);
|
||||||
|
if(!stream(music.buffers[1]))bf=1;
|
||||||
|
balSourceQueueBuffers(music.source,bf,music.buffers);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
AL_SetMusicVolume(AL_MusicVolume);
|
||||||
|
AL_Continue();
|
||||||
|
}
|
||||||
|
|
|
@ -9,7 +9,7 @@ void AL_Update();
|
||||||
char *AL_ErrorString(int code);
|
char *AL_ErrorString(int code);
|
||||||
char *ALC_ErrorString(int code);
|
char *ALC_ErrorString(int code);
|
||||||
|
|
||||||
void AL_stop();
|
void AL_Stop();
|
||||||
int AL_isntALmusic();
|
int AL_isntALmusic();
|
||||||
void AL_PlaySong(char *song,int loopflag);
|
void AL_PlaySong(char *song,int loopflag);
|
||||||
void AL_Pause();
|
void AL_Pause();
|
||||||
|
|
|
@ -54,6 +54,10 @@ Adapted to work with JonoF's port by James Bentler (bentler@cs.umn.edu)
|
||||||
#include <SDL_mixer.h>
|
#include <SDL_mixer.h>
|
||||||
#include "music.h"
|
#include "music.h"
|
||||||
|
|
||||||
|
#ifdef USE_OPENAL
|
||||||
|
#include "openal.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#define __FX_TRUE (1 == 1)
|
#define __FX_TRUE (1 == 1)
|
||||||
#define __FX_FALSE (!__FX_TRUE)
|
#define __FX_FALSE (!__FX_TRUE)
|
||||||
|
|
||||||
|
@ -376,6 +380,11 @@ void MUSIC_SetVolume(int volume)
|
||||||
volume = max(0, volume);
|
volume = max(0, volume);
|
||||||
volume = min(volume, 255);
|
volume = min(volume, 255);
|
||||||
|
|
||||||
|
#ifdef USE_OPENAL
|
||||||
|
if (!openal_disabled)
|
||||||
|
AL_SetMusicVolume(volume);
|
||||||
|
#endif
|
||||||
|
|
||||||
Mix_VolumeMusic(volume >> 1); // convert 0-255 to 0-128.
|
Mix_VolumeMusic(volume >> 1); // convert 0-255 to 0-128.
|
||||||
} // MUSIC_SetVolume
|
} // MUSIC_SetVolume
|
||||||
|
|
||||||
|
@ -412,6 +421,10 @@ int MUSIC_SongPlaying(void)
|
||||||
|
|
||||||
void MUSIC_Continue(void)
|
void MUSIC_Continue(void)
|
||||||
{
|
{
|
||||||
|
#ifdef USE_OPENAL
|
||||||
|
if (!openal_disabled)
|
||||||
|
AL_Continue();
|
||||||
|
#endif
|
||||||
if (Mix_PausedMusic())
|
if (Mix_PausedMusic())
|
||||||
Mix_ResumeMusic();
|
Mix_ResumeMusic();
|
||||||
else if (music_songdata)
|
else if (music_songdata)
|
||||||
|
@ -421,12 +434,20 @@ void MUSIC_Continue(void)
|
||||||
|
|
||||||
void MUSIC_Pause(void)
|
void MUSIC_Pause(void)
|
||||||
{
|
{
|
||||||
|
#ifdef USE_OPENAL
|
||||||
|
if (!openal_disabled)
|
||||||
|
AL_Pause();
|
||||||
|
#endif
|
||||||
Mix_PauseMusic();
|
Mix_PauseMusic();
|
||||||
} // MUSIC_Pause
|
} // MUSIC_Pause
|
||||||
|
|
||||||
|
|
||||||
int MUSIC_StopSong(void)
|
int MUSIC_StopSong(void)
|
||||||
{
|
{
|
||||||
|
#ifdef USE_OPENAL
|
||||||
|
if (!openal_disabled)
|
||||||
|
AL_Stop();
|
||||||
|
#endif
|
||||||
//if (!fx_initialized)
|
//if (!fx_initialized)
|
||||||
if (!Mix_QuerySpec(NULL, NULL, NULL))
|
if (!Mix_QuerySpec(NULL, NULL, NULL))
|
||||||
{
|
{
|
||||||
|
@ -450,7 +471,12 @@ int MUSIC_StopSong(void)
|
||||||
int MUSIC_PlaySong(unsigned char *song, int loopflag)
|
int MUSIC_PlaySong(unsigned char *song, int loopflag)
|
||||||
{
|
{
|
||||||
//SDL_RWops *rw;
|
//SDL_RWops *rw;
|
||||||
|
#ifdef USE_OPENAL
|
||||||
|
if (!openal_disabled)
|
||||||
|
AL_PlaySong((char *)song,loopflag);
|
||||||
|
if(openal_disabled || AL_isntALmusic())
|
||||||
|
#endif
|
||||||
|
{
|
||||||
MUSIC_StopSong();
|
MUSIC_StopSong();
|
||||||
|
|
||||||
music_songdata = (char *)song;
|
music_songdata = (char *)song;
|
||||||
|
@ -468,7 +494,7 @@ int MUSIC_PlaySong(unsigned char *song, int loopflag)
|
||||||
music_musicchunk = Mix_LoadMUS_RW(rw);
|
music_musicchunk = Mix_LoadMUS_RW(rw);
|
||||||
Mix_PlayMusic(music_musicchunk, (loopflag == MUSIC_PlayOnce) ? 0 : -1);
|
Mix_PlayMusic(music_musicchunk, (loopflag == MUSIC_PlayOnce) ? 0 : -1);
|
||||||
*/
|
*/
|
||||||
|
}
|
||||||
return(MUSIC_Ok);
|
return(MUSIC_Ok);
|
||||||
} // MUSIC_PlaySong
|
} // MUSIC_PlaySong
|
||||||
|
|
||||||
|
|
|
@ -1605,7 +1605,8 @@ int enterlevel(int g)
|
||||||
FX_StopAllSounds();
|
FX_StopAllSounds();
|
||||||
clearsoundlocks();
|
clearsoundlocks();
|
||||||
FX_SetReverb(0);
|
FX_SetReverb(0);
|
||||||
playmusicMAP(&env_music_fn[1][0],MAXVOLUMES*MAXLEVELS+2); // loadmus
|
MUSIC_StopSong();
|
||||||
|
playmusicMAP(&env_music_fn[2][0],MAXVOLUMES*MAXLEVELS+2); // loadmus
|
||||||
|
|
||||||
if (boardfilename[0] != 0 && ud.m_level_number == 7 && ud.m_volume_number == 0)
|
if (boardfilename[0] != 0 && ud.m_level_number == 7 && ud.m_volume_number == 0)
|
||||||
{
|
{
|
||||||
|
|
|
@ -392,14 +392,10 @@ int xyzsound(int num,int i,int x,int y,int z)
|
||||||
if (*g_sounds[num].ptr == 'C')
|
if (*g_sounds[num].ptr == 'C')
|
||||||
voice = FX_PlayLoopedVOC(g_sounds[num].ptr, start, start + g_sounds[num].soundsiz,
|
voice = FX_PlayLoopedVOC(g_sounds[num].ptr, start, start + g_sounds[num].soundsiz,
|
||||||
pitch,sndist>>6,sndist>>6,0,g_sounds[num].pr,num);
|
pitch,sndist>>6,sndist>>6,0,g_sounds[num].pr,num);
|
||||||
#ifdef USE_OPENAL
|
else
|
||||||
else if (!openal_disabled)
|
|
||||||
{
|
|
||||||
if (*g_sounds[num].ptr == 'O')
|
if (*g_sounds[num].ptr == 'O')
|
||||||
voice = FX_PlayLoopedOGG(g_sounds[num].ptr, start, start + g_sounds[num].soundsiz,
|
voice = FX_PlayLoopedOGG(g_sounds[num].ptr, start, start + g_sounds[num].soundsiz,
|
||||||
pitch,sndist>>6,sndist>>6,0,g_sounds[num].pr,num);
|
pitch,sndist>>6,sndist>>6,0,g_sounds[num].pr,num);
|
||||||
}
|
|
||||||
#endif
|
|
||||||
else
|
else
|
||||||
voice = FX_PlayLoopedWAV(g_sounds[num].ptr, start, start + g_sounds[num].soundsiz,
|
voice = FX_PlayLoopedWAV(g_sounds[num].ptr, start, start + g_sounds[num].soundsiz,
|
||||||
pitch,sndist>>6,sndist>>6,0,g_sounds[num].pr,num);
|
pitch,sndist>>6,sndist>>6,0,g_sounds[num].pr,num);
|
||||||
|
@ -408,13 +404,9 @@ int xyzsound(int num,int i,int x,int y,int z)
|
||||||
{
|
{
|
||||||
if (*g_sounds[num].ptr == 'C')
|
if (*g_sounds[num].ptr == 'C')
|
||||||
voice = FX_PlayVOC3D(g_sounds[ num ].ptr,pitch,sndang>>6,sndist>>6, g_sounds[num].pr, num);
|
voice = FX_PlayVOC3D(g_sounds[ num ].ptr,pitch,sndang>>6,sndist>>6, g_sounds[num].pr, num);
|
||||||
#ifdef USE_OPENAL
|
else
|
||||||
else if (!openal_disabled)
|
|
||||||
{
|
|
||||||
if (*g_sounds[num].ptr == 'O')
|
if (*g_sounds[num].ptr == 'O')
|
||||||
voice = FX_PlayOGG3D(g_sounds[ num ].ptr,pitch,sndang>>6,sndist>>6, g_sounds[num].pr, num);
|
voice = FX_PlayOGG3D(g_sounds[ num ].ptr,pitch,sndang>>6,sndist>>6, g_sounds[num].pr, num);
|
||||||
}
|
|
||||||
#endif
|
|
||||||
else
|
else
|
||||||
voice = FX_PlayWAV3D(g_sounds[ num ].ptr,pitch,sndang>>6,sndist>>6, g_sounds[num].pr, num);
|
voice = FX_PlayWAV3D(g_sounds[ num ].ptr,pitch,sndang>>6,sndist>>6, g_sounds[num].pr, num);
|
||||||
}
|
}
|
||||||
|
@ -477,17 +469,13 @@ void sound(int num)
|
||||||
voice = FX_PlayLoopedVOC(g_sounds[num].ptr, start, start + g_sounds[num].soundsiz,
|
voice = FX_PlayLoopedVOC(g_sounds[num].ptr, start, start + g_sounds[num].soundsiz,
|
||||||
pitch,LOUDESTVOLUME,LOUDESTVOLUME,LOUDESTVOLUME,g_sounds[num].pr,num);
|
pitch,LOUDESTVOLUME,LOUDESTVOLUME,LOUDESTVOLUME,g_sounds[num].pr,num);
|
||||||
}
|
}
|
||||||
#ifdef USE_OPENAL
|
else
|
||||||
else if (!openal_disabled)
|
|
||||||
{
|
|
||||||
if (*g_sounds[num].ptr == 'O')
|
if (*g_sounds[num].ptr == 'O')
|
||||||
{
|
{
|
||||||
start = (int)*(unsigned short *)(g_sounds[num].ptr + 0x14);
|
start = (int)*(unsigned short *)(g_sounds[num].ptr + 0x14);
|
||||||
voice = FX_PlayLoopedOGG(g_sounds[num].ptr, start, start + g_sounds[num].soundsiz,
|
voice = FX_PlayLoopedOGG(g_sounds[num].ptr, start, start + g_sounds[num].soundsiz,
|
||||||
pitch,LOUDESTVOLUME,LOUDESTVOLUME,LOUDESTVOLUME,g_sounds[num].pr,num);
|
pitch,LOUDESTVOLUME,LOUDESTVOLUME,LOUDESTVOLUME,g_sounds[num].pr,num);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
#endif
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
start = (int)*(unsigned short *)(g_sounds[num].ptr + 0x14);
|
start = (int)*(unsigned short *)(g_sounds[num].ptr + 0x14);
|
||||||
|
@ -499,13 +487,9 @@ void sound(int num)
|
||||||
{
|
{
|
||||||
if (*g_sounds[num].ptr == 'C')
|
if (*g_sounds[num].ptr == 'C')
|
||||||
voice = FX_PlayVOC3D(g_sounds[ num ].ptr, pitch,0,255-LOUDESTVOLUME,g_sounds[num].pr, num);
|
voice = FX_PlayVOC3D(g_sounds[ num ].ptr, pitch,0,255-LOUDESTVOLUME,g_sounds[num].pr, num);
|
||||||
#ifdef USE_OPENAL
|
else
|
||||||
else if (!openal_disabled)
|
|
||||||
{
|
|
||||||
if (*g_sounds[num].ptr == 'O')
|
if (*g_sounds[num].ptr == 'O')
|
||||||
voice = FX_PlayOGG3D(g_sounds[ num ].ptr, pitch,0,255-LOUDESTVOLUME,g_sounds[num].pr, num);
|
voice = FX_PlayOGG3D(g_sounds[ num ].ptr, pitch,0,255-LOUDESTVOLUME,g_sounds[num].pr, num);
|
||||||
}
|
|
||||||
#endif
|
|
||||||
else
|
else
|
||||||
voice = FX_PlayWAV3D(g_sounds[ num ].ptr, pitch,0,255-LOUDESTVOLUME,g_sounds[num].pr, num);
|
voice = FX_PlayWAV3D(g_sounds[ num ].ptr, pitch,0,255-LOUDESTVOLUME,g_sounds[num].pr, num);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue