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@640 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
68675e28aa
commit
dd4a7b5450
14 changed files with 236 additions and 161 deletions
|
@ -27,7 +27,7 @@ DXROOT=c:\sdks\dx6
|
||||||
MSSDKROOT="C:\Program Files\Microsoft Visual Studio 8\VC
|
MSSDKROOT="C:\Program Files\Microsoft Visual Studio 8\VC
|
||||||
PLATFORMSDK="C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK
|
PLATFORMSDK="C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK
|
||||||
|
|
||||||
ENGINEOPTS=/DSUPERBUILD /DPOLYMOST /DUSE_OPENGL
|
ENGINEOPTS=/DSUPERBUILD /DPOLYMOST /DUSE_OPENGL /DUSE_OPENAL
|
||||||
|
|
||||||
CC=cl
|
CC=cl
|
||||||
AS=ml
|
AS=ml
|
||||||
|
@ -38,8 +38,9 @@ CFLAGS= /MD /J /nologo $(flags_cl) \
|
||||||
/DNOCOPYPROTECT /D "_CRT_SECURE_NO_DEPRECATE" -W0 $(ENGINEOPTS) \
|
/DNOCOPYPROTECT /D "_CRT_SECURE_NO_DEPRECATE" -W0 $(ENGINEOPTS) \
|
||||||
/I$(DXROOT)\include /DRENDERTYPEWIN=1
|
/I$(DXROOT)\include /DRENDERTYPEWIN=1
|
||||||
LIBS=user32.lib gdi32.lib shell32.lib dxguid.lib winmm.lib wsock32.lib comctl32.lib \
|
LIBS=user32.lib gdi32.lib shell32.lib dxguid.lib winmm.lib wsock32.lib comctl32.lib \
|
||||||
/NODEFAULTLIB:libFLAC.lib glu32.lib
|
/NODEFAULTLIB:libFLAC.lib /NODEFAULTLIB:glu32.lib /NODEFAULTLIB:LIBCMT.lib /NODEFAULTLIB:LIBCMTD.lib
|
||||||
|
|
||||||
|
LIBS=vorbisfile_static.lib vorbis_static.lib ogg_static.lib $(LIBS)
|
||||||
|
|
||||||
ASFLAGS=/nologo /coff
|
ASFLAGS=/nologo /coff
|
||||||
ASFLAGS=/nologo /coff
|
ASFLAGS=/nologo /coff
|
||||||
|
@ -61,7 +62,7 @@ AUDIOLIB_FX=$(OBJ)\mv_mix.$o \
|
||||||
$(OBJ)\mvreverb.$o \
|
$(OBJ)\mvreverb.$o \
|
||||||
$(OBJ)\pitch.$o \
|
$(OBJ)\pitch.$o \
|
||||||
$(OBJ)\multivoc.$o \
|
$(OBJ)\multivoc.$o \
|
||||||
# $(OBJ)\openal.$o \
|
$(OBJ)\openal.$o \
|
||||||
$(OBJ)\ll_man.$o \
|
$(OBJ)\ll_man.$o \
|
||||||
$(OBJ)\fx_man.$o \
|
$(OBJ)\fx_man.$o \
|
||||||
$(OBJ)\dsoundout.$o
|
$(OBJ)\dsoundout.$o
|
||||||
|
|
|
@ -328,7 +328,8 @@ extern short numanimwalls;
|
||||||
extern int probey;
|
extern int probey;
|
||||||
|
|
||||||
extern char typebuflen,typebuf[141];
|
extern char typebuflen,typebuf[141];
|
||||||
extern char *MusicPtr;extern int Musicsize;
|
extern char *MusicPtr;
|
||||||
|
extern int Musicsize;
|
||||||
extern int msx[2048],msy[2048];
|
extern int msx[2048],msy[2048];
|
||||||
extern short cyclers[MAXCYCLERS][6],numcyclers;
|
extern short cyclers[MAXCYCLERS][6],numcyclers;
|
||||||
extern char myname[32];
|
extern char myname[32];
|
||||||
|
|
|
@ -31,7 +31,7 @@ extern void SoundShutdown(void);
|
||||||
extern void MusicStartup(void);
|
extern void MusicStartup(void);
|
||||||
extern void MusicShutdown(void);
|
extern void MusicShutdown(void);
|
||||||
extern void intomenusounds(void);
|
extern void intomenusounds(void);
|
||||||
extern void playmusicMAP(const char *fn,const int sel);
|
extern int playmusicMAP(const char *fn, const int sel);
|
||||||
extern int loadsound(unsigned num);
|
extern int loadsound(unsigned num);
|
||||||
extern int xyzsound(int num,int i,int x,int y,int z);
|
extern int xyzsound(int num,int i,int x,int y,int z);
|
||||||
extern void sound(int num);
|
extern void sound(int num);
|
||||||
|
|
|
@ -43,6 +43,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
#include "scriptfile.h"
|
#include "scriptfile.h"
|
||||||
#include "grpscan.h"
|
#include "grpscan.h"
|
||||||
#include "gamedef.h"
|
#include "gamedef.h"
|
||||||
|
#include "kplib.h"
|
||||||
|
|
||||||
//#include "crc32.h"
|
//#include "crc32.h"
|
||||||
|
|
||||||
|
@ -7991,9 +7992,11 @@ static void nonsharedkeys(void)
|
||||||
music_select = 0;
|
music_select = 0;
|
||||||
if (map[(unsigned char)music_select].musicfn != NULL)
|
if (map[(unsigned char)music_select].musicfn != NULL)
|
||||||
{
|
{
|
||||||
Bsprintf(fta_quotes[26],"PLAYING %s",&map[(unsigned char)music_select].musicfn[0]);
|
if (playmusicMAP(&map[(unsigned char)music_select].musicfn[0],music_select))
|
||||||
|
Bsprintf(fta_quotes[26],"PLAYING %s",&map[(unsigned char)music_select].musicfn1[0]);
|
||||||
|
else
|
||||||
|
Bsprintf(fta_quotes[26],"PLAYING %s",&map[(unsigned char)music_select].musicfn1[0]);
|
||||||
FTA(26,g_player[myconnectindex].ps);
|
FTA(26,g_player[myconnectindex].ps);
|
||||||
playmusicMAP(&map[(unsigned char)music_select].musicfn[0],music_select);
|
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -8211,10 +8214,14 @@ FAKE_F3:
|
||||||
if (KB_KeyPressed(sc_F5) && ud.config.MusicDevice >= 0)
|
if (KB_KeyPressed(sc_F5) && ud.config.MusicDevice >= 0)
|
||||||
{
|
{
|
||||||
KB_ClearKeyDown(sc_F5);
|
KB_ClearKeyDown(sc_F5);
|
||||||
if (map[(unsigned char)music_select].musicfn != NULL)
|
if (map[(unsigned char)music_select].musicfn1 != NULL)
|
||||||
|
Bstrcpy(fta_quotes[26],&map[(unsigned char)music_select].musicfn1[0]);
|
||||||
|
else if (map[(unsigned char)music_select].musicfn != NULL)
|
||||||
|
{
|
||||||
Bstrcpy(fta_quotes[26],&map[(unsigned char)music_select].musicfn[0]);
|
Bstrcpy(fta_quotes[26],&map[(unsigned char)music_select].musicfn[0]);
|
||||||
|
Bstrcat(fta_quotes[26],". USE SHIFT-F5 TO CHANGE.");
|
||||||
|
}
|
||||||
else fta_quotes[26][0] = '\0';
|
else fta_quotes[26][0] = '\0';
|
||||||
Bstrcat(fta_quotes[26],". USE SHIFT-F5 TO CHANGE.");
|
|
||||||
FTA(26,g_player[myconnectindex].ps);
|
FTA(26,g_player[myconnectindex].ps);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8647,7 +8654,7 @@ int AL_DefineSound(int ID,char *name)
|
||||||
if (ID>=MAXSOUNDS)
|
if (ID>=MAXSOUNDS)
|
||||||
return 1;
|
return 1;
|
||||||
g_sounds[ID].filename1=makename(g_sounds[ID].filename1,name,g_sounds[ID].filename);
|
g_sounds[ID].filename1=makename(g_sounds[ID].filename1,name,g_sounds[ID].filename);
|
||||||
// initprintf("(%s)(%s)(%s)\n",g_sounds[ID].filename1,name,g_sounds[ID].filename);
|
initprintf("(%s)(%s)(%s)\n",g_sounds[ID].filename1,name,g_sounds[ID].filename);
|
||||||
// loadsound(ID);
|
// loadsound(ID);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -8695,7 +8702,7 @@ static int parsedefinitions_game(scriptfile *script, const int preload)
|
||||||
int tokn;
|
int tokn;
|
||||||
char *cmdtokptr;
|
char *cmdtokptr;
|
||||||
|
|
||||||
tokenlist grptokens[] =
|
tokenlist tokens[] =
|
||||||
{
|
{
|
||||||
{ "include", T_INCLUDE },
|
{ "include", T_INCLUDE },
|
||||||
{ "#include", T_INCLUDE },
|
{ "#include", T_INCLUDE },
|
||||||
|
@ -8714,7 +8721,7 @@ static int parsedefinitions_game(scriptfile *script, const int preload)
|
||||||
|
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
tokn = getatoken(script,grptokens,sizeof(grptokens)/sizeof(tokenlist));
|
tokn = getatoken(script,tokens,sizeof(tokens)/sizeof(tokenlist));
|
||||||
cmdtokptr = script->ltextptr;
|
cmdtokptr = script->ltextptr;
|
||||||
switch (tokn)
|
switch (tokn)
|
||||||
{
|
{
|
||||||
|
@ -8753,9 +8760,8 @@ static int parsedefinitions_game(scriptfile *script, const int preload)
|
||||||
char *fn;
|
char *fn;
|
||||||
if (!scriptfile_getstring(script,&fn))
|
if (!scriptfile_getstring(script,&fn))
|
||||||
{
|
{
|
||||||
scriptfile *included;
|
scriptfile *included = scriptfile_fromfile(fn);
|
||||||
|
|
||||||
included = scriptfile_fromfile(fn);
|
|
||||||
if (!included)
|
if (!included)
|
||||||
{
|
{
|
||||||
initprintf("Warning: Failed including %s on line %s:%d\n",
|
initprintf("Warning: Failed including %s on line %s:%d\n",
|
||||||
|
@ -8776,7 +8782,7 @@ static int parsedefinitions_game(scriptfile *script, const int preload)
|
||||||
case T_MUSIC:
|
case T_MUSIC:
|
||||||
{
|
{
|
||||||
char *tinttokptr = script->ltextptr;
|
char *tinttokptr = script->ltextptr;
|
||||||
char *ID=NULL,*ext="";
|
char *ID=NULL,*fn="",*tfn = NULL;
|
||||||
char *musicend;
|
char *musicend;
|
||||||
|
|
||||||
if (scriptfile_getbraces(script,&musicend)) break;
|
if (scriptfile_getbraces(script,&musicend)) break;
|
||||||
|
@ -8788,19 +8794,38 @@ static int parsedefinitions_game(scriptfile *script, const int preload)
|
||||||
scriptfile_getstring(script,&ID);
|
scriptfile_getstring(script,&ID);
|
||||||
break;
|
break;
|
||||||
case T_FILE:
|
case T_FILE:
|
||||||
scriptfile_getstring(script,&ext);
|
scriptfile_getstring(script,&fn);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!preload)
|
if (!preload)
|
||||||
{
|
{
|
||||||
|
int i;
|
||||||
if (ID==NULL)
|
if (ID==NULL)
|
||||||
{
|
{
|
||||||
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
|
#ifdef USE_OPENAL
|
||||||
if (AL_DefineMusic(ID,ext))
|
i = pathsearchmode;
|
||||||
|
pathsearchmode = 1;
|
||||||
|
if (findfrompath(fn,&tfn) < 0)
|
||||||
|
{
|
||||||
|
char buf[BMAX_PATH];
|
||||||
|
|
||||||
|
Bstrcpy(buf,fn);
|
||||||
|
kzfindfilestart(buf);
|
||||||
|
if (!kzfindfile(buf))
|
||||||
|
{
|
||||||
|
initprintf("Error: file '%s' does not exist\n",fn);
|
||||||
|
pathsearchmode = i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else Bfree(tfn);
|
||||||
|
pathsearchmode = i;
|
||||||
|
|
||||||
|
if (AL_DefineMusic(ID,fn))
|
||||||
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
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -8810,7 +8835,8 @@ static int parsedefinitions_game(scriptfile *script, const int preload)
|
||||||
case T_SOUND:
|
case T_SOUND:
|
||||||
{
|
{
|
||||||
char *tinttokptr = script->ltextptr;
|
char *tinttokptr = script->ltextptr;
|
||||||
char *name="";int num=-1;
|
char *fn="", *tfn = NULL;
|
||||||
|
int num=-1;
|
||||||
char *musicend;
|
char *musicend;
|
||||||
|
|
||||||
if (scriptfile_getbraces(script,&musicend)) break;
|
if (scriptfile_getbraces(script,&musicend)) break;
|
||||||
|
@ -8822,18 +8848,40 @@ static int parsedefinitions_game(scriptfile *script, const int preload)
|
||||||
scriptfile_getsymbol(script,&num);
|
scriptfile_getsymbol(script,&num);
|
||||||
break;
|
break;
|
||||||
case T_FILE:
|
case T_FILE:
|
||||||
scriptfile_getstring(script,&name);
|
scriptfile_getstring(script,&fn);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!preload)
|
if (!preload)
|
||||||
{
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
if (num==-1)
|
if (num==-1)
|
||||||
{
|
{
|
||||||
initprintf("Error: missing ID for sound definition near line %s:%d\n", script->filename, scriptfile_getlinum(script,tinttokptr));
|
initprintf("Error: missing ID for sound definition near line %s:%d\n", script->filename, scriptfile_getlinum(script,tinttokptr));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (AL_DefineSound(num,name))initprintf("Error: invalid sound ID on line %s:%d\n", script->filename, scriptfile_getlinum(script,tinttokptr));
|
|
||||||
|
i = pathsearchmode;
|
||||||
|
pathsearchmode = 1;
|
||||||
|
if (findfrompath(fn,&tfn) < 0)
|
||||||
|
{
|
||||||
|
char buf[BMAX_PATH];
|
||||||
|
|
||||||
|
Bstrcpy(buf,fn);
|
||||||
|
kzfindfilestart(buf);
|
||||||
|
if (!kzfindfile(buf))
|
||||||
|
{
|
||||||
|
initprintf("Error: file '%s' does not exist\n",fn);
|
||||||
|
pathsearchmode = i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else Bfree(tfn);
|
||||||
|
pathsearchmode = i;
|
||||||
|
|
||||||
|
if (AL_DefineSound(num,fn))
|
||||||
|
initprintf("Error: invalid sound ID on line %s:%d\n", script->filename, scriptfile_getlinum(script,tinttokptr));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -23,7 +23,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
#include "duke3d.h"
|
#include "duke3d.h"
|
||||||
|
|
||||||
char *MusicPtr=0;int Musicsize;
|
char *MusicPtr = NULL;
|
||||||
|
int Musicsize;
|
||||||
|
|
||||||
short global_random;
|
short global_random;
|
||||||
short neartagsector, neartagwall, neartagsprite;
|
short neartagsector, neartagwall, neartagsprite;
|
||||||
|
|
|
@ -134,7 +134,8 @@ typedef struct VoiceNode
|
||||||
void ( *DemandFeed )( char **ptr, unsigned int *length );
|
void ( *DemandFeed )( char **ptr, unsigned int *length );
|
||||||
|
|
||||||
struct sounddef OGGstream;
|
struct sounddef OGGstream;
|
||||||
char *bufsnd;
|
// char *bufsnd;
|
||||||
|
char bufsnd[0x8000*4];
|
||||||
int downsample;
|
int downsample;
|
||||||
|
|
||||||
short *LeftVolume;
|
short *LeftVolume;
|
||||||
|
|
|
@ -118,6 +118,10 @@ static void mixer_callback(int chan, void *stream, int len, void *udata)
|
||||||
|
|
||||||
/* len should equal _BufferSize, else this is screwed up */
|
/* len should equal _BufferSize, else this is screwed up */
|
||||||
|
|
||||||
|
#ifdef USE_OPENAL
|
||||||
|
AL_Update();
|
||||||
|
#endif
|
||||||
|
|
||||||
stptr = (Uint8 *)stream;
|
stptr = (Uint8 *)stream;
|
||||||
|
|
||||||
if (_remainder > 0)
|
if (_remainder > 0)
|
||||||
|
@ -139,10 +143,6 @@ static void mixer_callback(int chan, void *stream, int len, void *udata)
|
||||||
{
|
{
|
||||||
/* new buffer */
|
/* new buffer */
|
||||||
|
|
||||||
#ifdef USE_OPENAL
|
|
||||||
AL_Update();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
_CallBackFunc();
|
_CallBackFunc();
|
||||||
|
|
||||||
fxptr = (Uint8 *)(&_BufferStart[MV_MixPage *
|
fxptr = (Uint8 *)(&_BufferStart[MV_MixPage *
|
||||||
|
|
|
@ -1162,11 +1162,15 @@ void AudioUpdate(void) { MUSIC_Update(); }
|
||||||
|
|
||||||
void playmusic(const char *fn);
|
void playmusic(const char *fn);
|
||||||
|
|
||||||
void playmusicMAP(const char *fn,const int sel)
|
int playmusicMAP(const char *fn,const int sel)
|
||||||
{
|
{
|
||||||
Musicsize=0;
|
Musicsize=0;
|
||||||
if(map[sel].musicfn1)
|
if(map[sel].musicfn1 != NULL)
|
||||||
playmusic(map[sel].musicfn1);
|
playmusic(map[sel].musicfn1);
|
||||||
if(!Musicsize)
|
if(!Musicsize)
|
||||||
|
{
|
||||||
playmusic(fn);
|
playmusic(fn);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -375,8 +375,8 @@ void MV_PlayVoice(VoiceNode *voice)
|
||||||
flags = DisableInterrupts();
|
flags = DisableInterrupts();
|
||||||
LL_SortedInsertion(&VoiceList, voice, prev, next, VoiceNode, priority);
|
LL_SortedInsertion(&VoiceList, voice, prev, next, VoiceNode, priority);
|
||||||
|
|
||||||
if(!voice->bufsnd)voice->bufsnd=(char *)Bcalloc(0x8000*4,sizeof(char));
|
// 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
|
// if(!voice->bufsnd)initprintf("Attention. It gonna crash! Thank you."); // FIXME: change the msg
|
||||||
RestoreInterrupts(flags);
|
RestoreInterrupts(flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -392,7 +392,7 @@ void MV_StopVoice(VoiceNode *voice)
|
||||||
unsigned int flags;
|
unsigned int flags;
|
||||||
|
|
||||||
flags = DisableInterrupts();
|
flags = DisableInterrupts();
|
||||||
if(!voice->bufsnd)Bfree(voice->bufsnd);
|
// if(!voice->bufsnd)Bfree(voice->bufsnd);
|
||||||
// move the voice from the play list to the free list
|
// move the voice from the play list to the free list
|
||||||
LL_Remove(voice, next, prev);
|
LL_Remove(voice, next, prev);
|
||||||
LL_Add(&VoicePool, voice, next, prev);
|
LL_Add(&VoicePool, voice, next, prev);
|
||||||
|
@ -912,13 +912,14 @@ void downsample(char *ptr,int size,int factor)
|
||||||
{
|
{
|
||||||
short *pti=(short *)ptr;int i,j,sum;
|
short *pti=(short *)ptr;int i,j,sum;
|
||||||
|
|
||||||
for(i=0;i<size>>factor;i++)
|
for (i=0;i<size>>factor;i++)
|
||||||
{
|
{
|
||||||
sum=0;
|
sum=0;
|
||||||
for(j=0;j<1<<factor;j++)sum+=pti[(i<<factor)+j];
|
for (j=0;j<1<<factor;j++)sum+=pti[(i<<factor)+j];
|
||||||
pti[i]=sum>>factor;
|
pti[i]=sum>>factor;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
playbackstatus MV_GetNextOGGBlock(VoiceNode *voice)
|
playbackstatus MV_GetNextOGGBlock(VoiceNode *voice)
|
||||||
{
|
{
|
||||||
int sz;
|
int sz;
|
||||||
|
@ -948,24 +949,25 @@ playbackstatus MV_GetNextOGGBlock(VoiceNode *voice)
|
||||||
voice->length <<= 16;
|
voice->length <<= 16;
|
||||||
|
|
||||||
sz<<=voice->downsample+1;
|
sz<<=voice->downsample+1;
|
||||||
while(size<sz)
|
while (size<sz)
|
||||||
{
|
{
|
||||||
result=ov_read(&voice->OGGstream.oggStream,voice->bufsnd+(size>>voice->downsample),sz-size,0,2,1,§ion);
|
result=ov_read(&voice->OGGstream.oggStream,voice->bufsnd+(size>>voice->downsample),sz-size,0,2,1,§ion);
|
||||||
if(result> 0)
|
if (result> 0)
|
||||||
{
|
{
|
||||||
downsample(voice->bufsnd+(size>>voice->downsample),result,voice->downsample);
|
downsample(voice->bufsnd+(size>>voice->downsample),result,voice->downsample);
|
||||||
size+=result;
|
size+=result;
|
||||||
}else
|
}
|
||||||
if(result==0)
|
else if (result==0)
|
||||||
{
|
{
|
||||||
// initprintf("!repeat %d\n",voice->callbackval);
|
// initprintf("!repeat %d\n",voice->callbackval);
|
||||||
voice->BlockLength=0;
|
voice->BlockLength=0;
|
||||||
voice->length=size<<16;break;
|
voice->length=size<<16;break;
|
||||||
}else
|
}
|
||||||
{
|
else
|
||||||
initprintf("#%d\n",result);
|
{
|
||||||
break;
|
initprintf("#%d\n",result);
|
||||||
}
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
voice->sound=voice->bufsnd;
|
voice->sound=voice->bufsnd;
|
||||||
|
|
||||||
|
@ -1758,39 +1760,39 @@ int MV_SetMixMode(int numchannels, int samplebits)
|
||||||
ov_callbacks cb;
|
ov_callbacks cb;
|
||||||
size_t ReadOgg(void *ptr, size_t size1, size_t nmemb, void *datasource)
|
size_t ReadOgg(void *ptr, size_t size1, size_t nmemb, void *datasource)
|
||||||
{
|
{
|
||||||
sounddef *d=(sounddef *)datasource;
|
sounddef *d=(sounddef *)datasource;
|
||||||
size1*=nmemb;
|
size1*=nmemb;
|
||||||
if(d->pos>=d->size)return 0;
|
if (d->pos>=d->size)return 0;
|
||||||
if(d->pos+size1>=d->size)size1=d->size-d->pos;
|
if (d->pos+size1>=d->size)size1=d->size-d->pos;
|
||||||
Bmemcpy(ptr,(d->ptrsnd+d->pos),size1);
|
Bmemcpy(ptr,(d->ptrsnd+d->pos),size1);
|
||||||
d->pos+=size1;
|
d->pos+=size1;
|
||||||
return size1;
|
return size1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int SeekOgg(void *datasource,ogg_int64_t offset,int whence)
|
int SeekOgg(void *datasource,ogg_int64_t offset,int whence)
|
||||||
{
|
{
|
||||||
sounddef *d=(sounddef *)datasource;
|
sounddef *d=(sounddef *)datasource;
|
||||||
switch(whence)
|
switch (whence)
|
||||||
{
|
{
|
||||||
case SEEK_SET: whence=offset;break;
|
case SEEK_SET: whence=offset;break;
|
||||||
case SEEK_CUR: whence=d->pos+offset;break;
|
case SEEK_CUR: whence=d->pos+offset;break;
|
||||||
case SEEK_END: whence=d->size-offset-1;break;
|
case SEEK_END: whence=d->size-offset-1;break;
|
||||||
default: return -1;
|
default: return -1;
|
||||||
}
|
}
|
||||||
if(whence>=(int)d->size||whence<0)return -1;
|
if (whence>=(int)d->size||whence<0)return -1;
|
||||||
d->pos=whence;
|
d->pos=whence;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
long TellOgg(void *datasource)
|
long TellOgg(void *datasource)
|
||||||
{
|
{
|
||||||
sounddef *d=(sounddef *)datasource;
|
sounddef *d=(sounddef *)datasource;
|
||||||
return d->pos;
|
return d->pos;
|
||||||
}
|
}
|
||||||
|
|
||||||
int CloseOgg(void *datasource)
|
int CloseOgg(void *datasource)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*---------------------------------------------------------------------
|
/*---------------------------------------------------------------------
|
||||||
|
@ -2394,7 +2396,7 @@ int MV_PlayLoopedVOC(char *ptr, int loopstart, int loopend, int pitchoffset, int
|
||||||
Begin playback of sound data with the given sound levels and
|
Begin playback of sound data with the given sound levels and
|
||||||
priority.
|
priority.
|
||||||
---------------------------------------------------------------------*/
|
---------------------------------------------------------------------*/
|
||||||
VoiceNode *voice;
|
VoiceNode *voice;
|
||||||
|
|
||||||
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)
|
||||||
{
|
{
|
||||||
|
@ -2419,23 +2421,23 @@ int MV_PlayLoopedOGG(char *ptr, int loopstart, int loopend, int pitchoffset, int
|
||||||
voice->OGGstream.ptrsnd=ptr;
|
voice->OGGstream.ptrsnd=ptr;
|
||||||
voice->OGGstream.size=g_sounds[callbackval].soundsiz;
|
voice->OGGstream.size=g_sounds[callbackval].soundsiz;
|
||||||
voice->downsample=0;
|
voice->downsample=0;
|
||||||
if(ov_open_callbacks(&voice->OGGstream,&voice->OGGstream.oggStream,0,0,cb)<0)
|
if (ov_open_callbacks(&voice->OGGstream,&voice->OGGstream.oggStream,0,0,cb)<0)
|
||||||
{
|
{
|
||||||
MV_SetErrorCode(MV_InvalidOGGFile);
|
MV_SetErrorCode(MV_InvalidOGGFile);
|
||||||
return(MV_Error);
|
return(MV_Error);
|
||||||
}
|
}
|
||||||
|
|
||||||
vorbisInfo=ov_info(&voice->OGGstream.oggStream,-1);
|
vorbisInfo=ov_info(&voice->OGGstream.oggStream,-1);
|
||||||
if(!vorbisInfo)
|
if (!vorbisInfo)
|
||||||
{
|
{
|
||||||
MV_SetErrorCode(MV_InvalidOGGFile);
|
MV_SetErrorCode(MV_InvalidOGGFile);
|
||||||
return(MV_Error);
|
return(MV_Error);
|
||||||
}
|
}
|
||||||
|
|
||||||
while((uint64)(vorbisInfo->rate)/(1<<voice->downsample)*PITCH_GetScale(pitchoffset)/0x1000000/0x100)
|
while ((uint64)(vorbisInfo->rate)/(1<<voice->downsample)*PITCH_GetScale(pitchoffset)/0x1000000/0x100)
|
||||||
voice->downsample++;
|
voice->downsample++;
|
||||||
length=ov_pcm_total(&voice->OGGstream.oggStream,0);
|
length=ov_pcm_total(&voice->OGGstream.oggStream,0);
|
||||||
if(!length)length=0xffffff;
|
if (!length)length=0xffffff;
|
||||||
loopend=length=length>>voice->downsample;
|
loopend=length=length>>voice->downsample;
|
||||||
|
|
||||||
voice->wavetype = OGG;
|
voice->wavetype = OGG;
|
||||||
|
@ -2466,7 +2468,7 @@ int MV_PlayLoopedOGG(char *ptr, int loopstart, int loopend, int pitchoffset, int
|
||||||
}
|
}
|
||||||
|
|
||||||
MV_SetVoicePitch(voice, vorbisInfo->rate>>voice->downsample, pitchoffset);
|
MV_SetVoicePitch(voice, vorbisInfo->rate>>voice->downsample, pitchoffset);
|
||||||
if(vorbisInfo->channels==2)voice->downsample++;
|
if (vorbisInfo->channels==2)voice->downsample++;
|
||||||
MV_SetVoiceVolume(voice, vol, left, right);
|
MV_SetVoiceVolume(voice, vol, left, right);
|
||||||
MV_PlayVoice(voice);
|
MV_PlayVoice(voice);
|
||||||
|
|
||||||
|
@ -2873,6 +2875,7 @@ int MV_Init(int soundcard, int MixRate, int Voices, int numchannels, int sampleb
|
||||||
{
|
{
|
||||||
if (map[i].musicfn1 != NULL)
|
if (map[i].musicfn1 != NULL)
|
||||||
Bfree(map[i].musicfn1);
|
Bfree(map[i].musicfn1);
|
||||||
|
map[i].musicfn1 = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -367,7 +367,7 @@ int MUSIC_PlaySong
|
||||||
|
|
||||||
#ifdef USE_OPENAL
|
#ifdef USE_OPENAL
|
||||||
if (!openal_disabled)
|
if (!openal_disabled)
|
||||||
AL_PlaySong((char *)song,loopflag);
|
AL_PlaySong((unsigned char *)song,loopflag);
|
||||||
if(openal_disabled || AL_isntALmusic())
|
if(openal_disabled || AL_isntALmusic())
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
ALCdevice * device=NULL;
|
ALCdevice * device=NULL;
|
||||||
ALCcontext * context=NULL;
|
ALCcontext * context=NULL;
|
||||||
|
|
||||||
char *ALdoing="";
|
char *ALdoing = NULL;
|
||||||
int AL_Error;
|
int AL_Error;
|
||||||
int bufsize;
|
int bufsize;
|
||||||
int openal_disabled = 0;
|
int openal_disabled = 0;
|
||||||
|
@ -33,37 +33,36 @@ sounddef1 sounds1[2];
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
// Windows
|
// Windows
|
||||||
static HANDLE hALDLL;
|
static HANDLE hALDLL = NULL;
|
||||||
#else
|
#else
|
||||||
#include <dlfcn.h>
|
#include <dlfcn.h>
|
||||||
|
|
||||||
static void *alhandle = NULL;
|
static void *alhandle = NULL;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
char *aldriver = NULL;
|
static char *aldriver = NULL;
|
||||||
|
|
||||||
void (AL_APIENTRY * balGetSourcei)(ALuint sid, ALenum param, ALint* value);
|
static void (AL_APIENTRY * balGetSourcei)(ALuint sid, ALenum param, ALint* value);
|
||||||
void (AL_APIENTRY * balSourcef)(ALuint sid, ALenum param, ALfloat value);
|
static void (AL_APIENTRY * balSourcef)(ALuint sid, ALenum param, ALfloat value);
|
||||||
void (AL_APIENTRY * balSourcePlay)(ALuint sid);
|
static void (AL_APIENTRY * balSourcePlay)(ALuint sid);
|
||||||
void (AL_APIENTRY * balSourcePause)(ALuint sid);
|
static void (AL_APIENTRY * balSourcePause)(ALuint sid);
|
||||||
ALCenum(ALC_APIENTRY * balcGetError)(ALCdevice *device);
|
static ALCenum(ALC_APIENTRY * balcGetError)(ALCdevice *device);
|
||||||
ALenum(AL_APIENTRY * balGetError)(void);
|
static ALenum(AL_APIENTRY * balGetError)(void);
|
||||||
void (AL_APIENTRY * balBufferData)(ALuint bid, ALenum format, const ALvoid* data, ALsizei size, ALsizei freq);
|
static void (AL_APIENTRY * balBufferData)(ALuint bid, ALenum format, const ALvoid* data, ALsizei size, ALsizei freq);
|
||||||
void (AL_APIENTRY * balGenBuffers)(ALsizei n, ALuint* buffers);
|
static void (AL_APIENTRY * balGenBuffers)(ALsizei n, ALuint* buffers);
|
||||||
void (AL_APIENTRY * balGenSources)(ALsizei n, ALuint* sources);
|
static void (AL_APIENTRY * balGenSources)(ALsizei n, ALuint* sources);
|
||||||
void (AL_APIENTRY * balSourcei)(ALuint sid, ALenum param, ALint value);
|
static void (AL_APIENTRY * balSourcei)(ALuint sid, ALenum param, ALint value);
|
||||||
void (AL_APIENTRY * balSourceQueueBuffers)(ALuint sid, ALsizei numEntries, const ALuint *bids);
|
static void (AL_APIENTRY * balSourceQueueBuffers)(ALuint sid, ALsizei numEntries, const ALuint *bids);
|
||||||
void (AL_APIENTRY * balSourceStop)(ALuint sid);
|
static void (AL_APIENTRY * balSourceStop)(ALuint sid);
|
||||||
void (AL_APIENTRY * balSourceUnqueueBuffers)(ALuint sid, ALsizei numEntries, ALuint *bids);
|
static void (AL_APIENTRY * balSourceUnqueueBuffers)(ALuint sid, ALsizei numEntries, ALuint *bids);
|
||||||
void (AL_APIENTRY * bbalDeleteSources)(ALsizei n, const ALuint* sources);
|
static void (AL_APIENTRY * bbalDeleteSources)(ALsizei n, const ALuint* sources);
|
||||||
ALCboolean(ALC_APIENTRY * balcMakeContextCurrent)(ALCcontext *context);
|
static ALCboolean(ALC_APIENTRY * balcMakeContextCurrent)(ALCcontext *context);
|
||||||
void (AL_APIENTRY * balDeleteSources)(ALsizei n, const ALuint* sources);
|
static void (AL_APIENTRY * balDeleteSources)(ALsizei n, const ALuint* sources);
|
||||||
void (AL_APIENTRY * balDeleteBuffers)(ALsizei n, const ALuint* buffers);
|
static void (AL_APIENTRY * balDeleteBuffers)(ALsizei n, const ALuint* buffers);
|
||||||
void (ALC_APIENTRY * balcDestroyContext)(ALCcontext *context);
|
static void (ALC_APIENTRY * balcDestroyContext)(ALCcontext *context);
|
||||||
ALCboolean(ALC_APIENTRY * balcCloseDevice)(ALCdevice *device);
|
static ALCboolean(ALC_APIENTRY * balcCloseDevice)(ALCdevice *device);
|
||||||
ALCdevice *(ALC_APIENTRY * balcOpenDevice)(const ALCchar *devicename);
|
static ALCdevice *(ALC_APIENTRY * balcOpenDevice)(const ALCchar *devicename);
|
||||||
ALCcontext *(ALC_APIENTRY * balcCreateContext)(ALCdevice *device, const ALCint* attrlist);
|
static ALCcontext *(ALC_APIENTRY * balcCreateContext)(ALCdevice *device, const ALCint* attrlist);
|
||||||
const ALchar*(AL_APIENTRY * balGetString)(ALenum param);
|
static 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)
|
||||||
{
|
{
|
||||||
|
@ -83,20 +82,23 @@ static void * algetproc_(const char *s, int *err, int fatal)
|
||||||
#define ALGETPROC(s) algetproc_(s,&err,1)
|
#define ALGETPROC(s) algetproc_(s,&err,1)
|
||||||
#define ALGETPROCSOFT(s) algetproc_(s,&err,0)
|
#define ALGETPROCSOFT(s) algetproc_(s,&err,0)
|
||||||
|
|
||||||
int unloadaldriver(void)
|
static int unloadaldriver(void)
|
||||||
{
|
{
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
if (!hALDLL) return 0;
|
if (!hALDLL) return 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
free(aldriver);
|
if (aldriver)
|
||||||
|
free(aldriver);
|
||||||
aldriver = NULL;
|
aldriver = NULL;
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
FreeLibrary(hALDLL);
|
if (hALDLL)
|
||||||
|
FreeLibrary(hALDLL);
|
||||||
hALDLL = NULL;
|
hALDLL = NULL;
|
||||||
#else
|
#else
|
||||||
if (alhandle) dlclose(alhandle);
|
if (alhandle)
|
||||||
|
dlclose(alhandle);
|
||||||
alhandle = NULL;
|
alhandle = NULL;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -126,14 +128,15 @@ int unloadaldriver(void)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int loadaldriver(void)
|
static int loadaldriver(void)
|
||||||
{
|
{
|
||||||
void *t;
|
void *t;
|
||||||
int err=0;
|
int err=0;
|
||||||
char *driver;
|
char *driver;
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
if (hALDLL) return 0;
|
if (hALDLL)
|
||||||
|
return 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// if (!driver)
|
// if (!driver)
|
||||||
|
@ -149,7 +152,7 @@ int loadaldriver(void)
|
||||||
|
|
||||||
initprintf("Loading %s\n",driver);
|
initprintf("Loading %s\n",driver);
|
||||||
|
|
||||||
#if defined _WIN32
|
#ifdef _WIN32
|
||||||
hALDLL = LoadLibrary(driver);
|
hALDLL = LoadLibrary(driver);
|
||||||
if (!hALDLL) return -1;
|
if (!hALDLL) return -1;
|
||||||
#else
|
#else
|
||||||
|
@ -280,39 +283,39 @@ int AL_Init()
|
||||||
|
|
||||||
if (context)
|
if (context)
|
||||||
{
|
{
|
||||||
char *s,*t,*u,i;
|
// char *s,*t,*u,i;
|
||||||
|
|
||||||
balcMakeContextCurrent(context);check(1);
|
balcMakeContextCurrent(context);check(1);
|
||||||
initprintf("OpenAL Information:\n"
|
initprintf("OpenAL Information:\n"
|
||||||
" Version: %s\n"
|
" Version: %s\n"
|
||||||
" Vendor: %s\n"
|
" Vendor: %s\n"
|
||||||
" Renderer: %s\n"
|
" Renderer: %s\n"
|
||||||
" Extensions:\n"
|
// " Extensions:\n"
|
||||||
,balGetString(AL_VERSION),balGetString(AL_VENDOR),balGetString(AL_RENDERER));
|
,balGetString(AL_VERSION),balGetString(AL_VENDOR),balGetString(AL_RENDERER));
|
||||||
|
|
||||||
s = Bstrdup(balGetString(AL_EXTENSIONS));
|
/* s = Bstrdup(balGetString(AL_EXTENSIONS));
|
||||||
if (!s) initprintf(balGetString(AL_EXTENSIONS));
|
if (!s) initprintf(balGetString(AL_EXTENSIONS));
|
||||||
else
|
else
|
||||||
{
|
|
||||||
i = 0; t = u = s;
|
|
||||||
while (*t)
|
|
||||||
{
|
|
||||||
if (*t == ' ')
|
|
||||||
{
|
{
|
||||||
if (i&1)
|
i = 0; t = u = s;
|
||||||
|
while (*t)
|
||||||
{
|
{
|
||||||
*t = 0;
|
if (*t == ' ')
|
||||||
initprintf(" %s\n",u);
|
{
|
||||||
u = t+1;
|
if (i&1)
|
||||||
|
{
|
||||||
|
*t = 0;
|
||||||
|
initprintf(" %s\n",u);
|
||||||
|
u = t+1;
|
||||||
|
}
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
t++;
|
||||||
}
|
}
|
||||||
i++;
|
if (i&1) initprintf(" %s\n",u);
|
||||||
|
Bfree(s);
|
||||||
}
|
}
|
||||||
t++;
|
*/
|
||||||
}
|
|
||||||
if (i&1) initprintf(" %s\n",u);
|
|
||||||
Bfree(s);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
else initprintf("OpenAL initialization failed.\n");
|
else initprintf("OpenAL initialization failed.\n");
|
||||||
|
|
||||||
|
@ -425,9 +428,10 @@ void AL_Stop()
|
||||||
Bmemset(&music,0,sizeof(sounddef1));
|
Bmemset(&music,0,sizeof(sounddef1));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static char pcm[BUFFER_SIZE];
|
||||||
|
|
||||||
int stream(ALuint buffer)
|
int stream(ALuint buffer)
|
||||||
{
|
{
|
||||||
char pcm[BUFFER_SIZE];
|
|
||||||
ALsizei size=0;
|
ALsizei size=0;
|
||||||
int section,result;
|
int section,result;
|
||||||
|
|
||||||
|
@ -437,7 +441,8 @@ int stream(ALuint buffer)
|
||||||
if (result==0&&music.loop)ov_pcm_seek(&music.def.oggStream,0);else
|
if (result==0&&music.loop)ov_pcm_seek(&music.def.oggStream,0);else
|
||||||
if (result> 0)size+=result;else break;
|
if (result> 0)size+=result;else break;
|
||||||
}
|
}
|
||||||
if (!size)return 0;
|
if (!size)
|
||||||
|
return 0;
|
||||||
ALdoing="stream";
|
ALdoing="stream";
|
||||||
balBufferData(buffer,music.format,pcm,size,music.rate);
|
balBufferData(buffer,music.format,pcm,size,music.rate);
|
||||||
check(1);
|
check(1);
|
||||||
|
@ -448,14 +453,21 @@ void AL_PlaySong(char *ptr,int loop)
|
||||||
{
|
{
|
||||||
vorbis_info* vorbisInfo;
|
vorbis_info* vorbisInfo;
|
||||||
int bf=2,i;
|
int bf=2,i;
|
||||||
ALenum format;ALsizei size;ALsizei freq;ALvoid* data;
|
ALenum format;
|
||||||
|
ALsizei size;
|
||||||
|
ALsizei freq;
|
||||||
|
ALvoid* data;
|
||||||
|
|
||||||
if (!context)return;
|
if (!context)
|
||||||
|
return;
|
||||||
Bmemset(&music,0,sizeof(sounddef1));
|
Bmemset(&music,0,sizeof(sounddef1));
|
||||||
switch (*ptr)
|
switch (*ptr)
|
||||||
{
|
{
|
||||||
case 'O':music.type=1;break;
|
case 'O':
|
||||||
default: return;
|
music.type=1;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
music.def.size=Musicsize;
|
music.def.size=Musicsize;
|
||||||
music.loop=loop;
|
music.loop=loop;
|
||||||
|
@ -478,7 +490,8 @@ void AL_PlaySong(char *ptr,int loop)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
music.rate=vorbisInfo->rate;
|
music.rate=vorbisInfo->rate;
|
||||||
music.format=(vorbisInfo->channels==1)?AL_FORMAT_MONO16:AL_FORMAT_STEREO16;break;
|
music.format=(vorbisInfo->channels==1)?AL_FORMAT_MONO16:AL_FORMAT_STEREO16;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
ALdoing="Open";
|
ALdoing="Open";
|
||||||
|
@ -488,8 +501,10 @@ void AL_PlaySong(char *ptr,int loop)
|
||||||
|
|
||||||
switch (music.type)
|
switch (music.type)
|
||||||
{
|
{
|
||||||
case 1: stream(music.buffers[0]);
|
case 1:
|
||||||
if (!stream(music.buffers[1]))bf=1;
|
stream(music.buffers[0]);
|
||||||
|
if (!stream(music.buffers[1]))
|
||||||
|
bf=1;
|
||||||
balSourceQueueBuffers(music.source,bf,music.buffers);
|
balSourceQueueBuffers(music.source,bf,music.buffers);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -429,9 +429,9 @@ void MUSIC_Continue(void)
|
||||||
Mix_ResumeMusic();
|
Mix_ResumeMusic();
|
||||||
else if (music_songdata
|
else if (music_songdata
|
||||||
#ifdef USE_OPENAL
|
#ifdef USE_OPENAL
|
||||||
&& (openal_disabled || AL_isntALmusic())
|
&& (openal_disabled || AL_isntALmusic())
|
||||||
#endif
|
#endif
|
||||||
)
|
)
|
||||||
MUSIC_PlaySong((unsigned char *)music_songdata, MUSIC_PlayOnce);
|
MUSIC_PlaySong((unsigned char *)music_songdata, MUSIC_PlayOnce);
|
||||||
} // MUSIC_Continue
|
} // MUSIC_Continue
|
||||||
|
|
||||||
|
@ -512,7 +512,7 @@ void PlayMusic(char *_filename, int loopflag)
|
||||||
#ifdef USE_OPENAL
|
#ifdef USE_OPENAL
|
||||||
if (!openal_disabled)
|
if (!openal_disabled)
|
||||||
{
|
{
|
||||||
short fp;
|
int fp;
|
||||||
int l;
|
int l;
|
||||||
|
|
||||||
fp = kopen4load(_filename,0);
|
fp = kopen4load(_filename,0);
|
||||||
|
|
|
@ -279,7 +279,7 @@ static int getsound(unsigned int num)
|
||||||
if (ud.config.FXDevice < 0) return 0;
|
if (ud.config.FXDevice < 0) return 0;
|
||||||
|
|
||||||
if (!g_sounds[num].filename) return 0;
|
if (!g_sounds[num].filename) return 0;
|
||||||
if(g_sounds[num].filename1)fp = kopen4load(g_sounds[num].filename1,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)fp = kopen4load(g_sounds[num].filename,loadfromgrouponly);
|
||||||
if (fp == -1) return 0;
|
if (fp == -1) return 0;
|
||||||
|
|
||||||
|
|
|
@ -194,7 +194,7 @@ void intomenusounds(void)
|
||||||
void playmusic(const char *fn)
|
void playmusic(const char *fn)
|
||||||
{
|
{
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
short fp;
|
int fp;
|
||||||
int l;
|
int l;
|
||||||
|
|
||||||
if (fn == NULL) return;
|
if (fn == NULL) return;
|
||||||
|
@ -209,11 +209,12 @@ void playmusic(const char *fn)
|
||||||
l = kfilelength(fp);
|
l = kfilelength(fp);
|
||||||
MUSIC_StopSong();
|
MUSIC_StopSong();
|
||||||
Musicsize=0;
|
Musicsize=0;
|
||||||
if(!MusicPtr)MusicPtr=Bcalloc(1,l);
|
if(!MusicPtr)
|
||||||
else MusicPtr=Brealloc(MusicPtr,l);
|
MusicPtr=Bcalloc(1,l * sizeof(char));
|
||||||
|
else MusicPtr=Brealloc(MusicPtr,l * sizeof(char));
|
||||||
Musicsize=l;
|
Musicsize=l;
|
||||||
|
|
||||||
kread(fp, MusicPtr, l);
|
kread(fp, (unsigned char *)MusicPtr, l);
|
||||||
kclose(fp);
|
kclose(fp);
|
||||||
MUSIC_PlaySong((unsigned char *)MusicPtr, MUSIC_LoopSong);
|
MUSIC_PlaySong((unsigned char *)MusicPtr, MUSIC_LoopSong);
|
||||||
#else
|
#else
|
||||||
|
|
Loading…
Reference in a new issue