git-svn-id: https://svn.eduke32.com/eduke32@637 1a8010ca-5511-0410-912e-c29ae57300e0

This commit is contained in:
terminx 2008-03-08 07:46:30 +00:00
parent bc0f8369e6
commit 6b956dfe2a
12 changed files with 1037 additions and 1037 deletions

View file

@ -53,16 +53,12 @@ ifeq ($(PLATFORM),LINUX)
OBJ=obj
EOBJ=eobj
NASMFLAGS+= -f elf
ifeq ($(USE_OPENAL),1)
LIBS+= -lvorbisfile -lvorbis -logg
endif
else
ifeq ($(PLATFORM),WINDOWS)
OBJ=obj_win
EOBJ=eobj_win
ifeq ($(USE_OPENAL),1)
LIBS+= -L$(ALROOT)/lib -lvorbisfile -lvorbis -logg
endif
else
OBJ=obj
EOBJ=eobj

View file

@ -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));
break;
}
#ifdef USE_OPENAL
if (AL_DefineMusic(ID,ext))
initprintf("Error: invalid music ID on line %s:%d\n", script->filename, scriptfile_getlinum(script,tinttokptr));
#endif
}
break;

View file

@ -88,9 +88,7 @@ typedef enum
VOC,
DemandFeed,
WAV,
#ifdef USE_OPENAL
OGG
#endif
} wavedata;
typedef enum
@ -134,11 +132,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

@ -705,7 +705,6 @@ int FX_PlayWAV
Begin playback of sound data with the given volume and priority.
---------------------------------------------------------------------*/
#ifdef USE_OPENAL
int FX_PlayOGG
(
char *ptr,
@ -730,7 +729,6 @@ int FX_PlayOGG
return(handle);
}
#endif
/*---------------------------------------------------------------------
Function: FX_PlayWAV
@ -766,7 +764,7 @@ int FX_PlayLoopedWAV
return(handle);
}
#ifdef USE_OPENAL
int FX_PlayLoopedOGG
(
char *ptr,
@ -795,7 +793,7 @@ int FX_PlayLoopedOGG
return(handle);
}
#endif
/*---------------------------------------------------------------------
Function: FX_PlayVOC3D
@ -826,7 +824,7 @@ int FX_PlayVOC3D
return(handle);
}
#ifdef USE_OPENAL
int FX_PlayOGG3D
(
char *ptr,
@ -850,7 +848,6 @@ int FX_PlayOGG3D
return(handle);
}
#endif
/*---------------------------------------------------------------------
Function: FX_PlayWAV3D

View file

@ -206,11 +206,9 @@ 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;
@ -918,7 +916,7 @@ playbackstatus MV_GetNextWAVBlock(VoiceNode *voice)
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;
@ -982,7 +980,7 @@ playbackstatus MV_GetNextOGGBlock(VoiceNode *voice)
return(KeepPlaying);
}
#endif
/*---------------------------------------------------------------------
Function: MV_ServiceRecord
@ -2406,7 +2404,7 @@ int MV_PlayLoopedVOC(char *ptr, int loopstart, int loopend, int pitchoffset, int
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;
@ -2546,7 +2544,7 @@ int MV_PlayOGG3D(char *ptr, int pitchoffset, int angle, int distance, int priori
return(status);
}
#endif
/*---------------------------------------------------------------------
Function: MV_CreateVolumeTable
@ -2886,11 +2884,11 @@ int MV_Init(int soundcard, int MixRate, int Voices, int numchannels, int sampleb
Bfree(map[i].musicfn1);
}
for (i=MAXSOUNDS-1;i>=0;i--)
/* for (i=MAXSOUNDS-1;i>=0;i--)
{
if (g_sounds[i].filename1 != NULL)
Bfree(g_sounds[i].filename1);
}
} */
}
#endif
#if defined(_WIN32)

View file

@ -50,9 +50,7 @@ enum MV_Errors
MV_DPMI_Error,
MV_InvalidVOCFile,
MV_InvalidWAVFile,
#ifdef USE_OPENAL
MV_InvalidOGGFile,
#endif
MV_InvalidMixMode,
MV_IrqFailure,
MV_DMAFailure,

View file

@ -341,7 +341,7 @@ int MUSIC_StopSong
{
#ifdef USE_OPENAL
if (!openal_disabled)
AL_stop();
AL_Stop();
#endif
MUSIC_StopFade();
MIDI_StopSong();

View file

@ -261,7 +261,7 @@ int AL_Init()
{
if (loadaldriver())
{
initprintf("Failed loading OpenAL driver.\n");
initprintf("Failed loading OpenAL driver.\nDownload OpenAL 1.1 or greater from http://www.openal.org/downloads.html.");
openal_disabled = 1;
return 1;
@ -282,7 +282,7 @@ int AL_Init()
initprintf("OpenAL Information:\n"
" Version: %s\n"
" Vendor: %s\n\n",balGetString(AL_VERSION),balGetString(AL_VENDOR));
} else initprintf("OpenAL initialisation failed. Try http://www.openal.org/\n");
} else initprintf("OpenAL initialization failed.\n");
ALdoing="Open";
balGenBuffers(16, sounds1[1].buffers);
@ -317,7 +317,7 @@ sounddef1 music;
extern int Musicsize;
void AL_stop();
void AL_Stop();
int update();
int stream(ALuint buffer);
void open1(char *ptr,int sizef,char loop);
@ -326,7 +326,7 @@ void open1(char *ptr,int sizef,char loop);
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 AL_Update() {if(music.def.size&&!update(0))AL_Stop();}
int AL_isntALmusic() {return !music.def.size;}
void AL_SetMusicVolume(int volume)
@ -371,7 +371,7 @@ int update()
return active;
}
void AL_stop()
void AL_Stop()
{
int queued=0;ALuint buffer;

View file

@ -9,7 +9,7 @@ void AL_Update();
char *AL_ErrorString(int code);
char *ALC_ErrorString(int code);
void AL_stop();
void AL_Stop();
int AL_isntALmusic();
void AL_PlaySong(char *song,int loopflag);
void AL_Pause();

View file

@ -54,6 +54,10 @@ Adapted to work with JonoF's port by James Bentler (bentler@cs.umn.edu)
#include <SDL_mixer.h>
#include "music.h"
#ifdef USE_OPENAL
#include "openal.h"
#endif
#define __FX_TRUE (1 == 1)
#define __FX_FALSE (!__FX_TRUE)
@ -376,6 +380,11 @@ void MUSIC_SetVolume(int volume)
volume = max(0, volume);
volume = min(volume, 255);
#ifdef USE_OPENAL
if (!openal_disabled)
AL_SetMusicVolume(volume);
#endif
Mix_VolumeMusic(volume >> 1); // convert 0-255 to 0-128.
} // MUSIC_SetVolume
@ -412,6 +421,10 @@ int MUSIC_SongPlaying(void)
void MUSIC_Continue(void)
{
#ifdef USE_OPENAL
if (!openal_disabled)
AL_Continue();
#endif
if (Mix_PausedMusic())
Mix_ResumeMusic();
else if (music_songdata)
@ -421,12 +434,20 @@ void MUSIC_Continue(void)
void MUSIC_Pause(void)
{
#ifdef USE_OPENAL
if (!openal_disabled)
AL_Pause();
#endif
Mix_PauseMusic();
} // MUSIC_Pause
int MUSIC_StopSong(void)
{
#ifdef USE_OPENAL
if (!openal_disabled)
AL_Stop();
#endif
//if (!fx_initialized)
if (!Mix_QuerySpec(NULL, NULL, NULL))
{
@ -450,7 +471,12 @@ int MUSIC_StopSong(void)
int MUSIC_PlaySong(unsigned char *song, int loopflag)
{
//SDL_RWops *rw;
#ifdef USE_OPENAL
if (!openal_disabled)
AL_PlaySong((char *)song,loopflag);
if(openal_disabled || AL_isntALmusic())
#endif
{
MUSIC_StopSong();
music_songdata = (char *)song;
@ -468,7 +494,7 @@ int MUSIC_PlaySong(unsigned char *song, int loopflag)
music_musicchunk = Mix_LoadMUS_RW(rw);
Mix_PlayMusic(music_musicchunk, (loopflag == MUSIC_PlayOnce) ? 0 : -1);
*/
}
return(MUSIC_Ok);
} // MUSIC_PlaySong

View file

@ -1605,7 +1605,8 @@ int enterlevel(int g)
FX_StopAllSounds();
clearsoundlocks();
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)
{

View file

@ -392,14 +392,10 @@ 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 (!openal_disabled)
{
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);
@ -408,13 +404,9 @@ 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 (!openal_disabled)
{
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);
}
@ -477,17 +469,13 @@ 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 (!openal_disabled)
{
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);
@ -499,13 +487,9 @@ 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 (!openal_disabled)
{
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);
}