diff --git a/polymer/eduke32/source/duke3d.h b/polymer/eduke32/source/duke3d.h index 6adca470a..58e62d406 100644 --- a/polymer/eduke32/source/duke3d.h +++ b/polymer/eduke32/source/duke3d.h @@ -801,10 +801,8 @@ enum events { enum gamevarflags { - MAXGAMEVARS = 2048, // must be a power of two - MAXGAMEARRAYS = 256, // must be lower than MAXGAMEVARS + MAXGAMEVARS = 2048, // must be a power of two MAXVARLABEL = 26, - MAXARRAYLABEL = 26, GAMEVAR_FLAG_NORMAL = 0, // normal GAMEVAR_FLAG_PERPLAYER = 1, // per-player variable GAMEVAR_FLAG_PERACTOR = 2, // per-actor variable @@ -814,10 +812,17 @@ enum gamevarflags { GAMEVAR_FLAG_NODEFAULT = 1024, // don't reset on actor spawn GAMEVAR_FLAG_SYSTEM = 2048, // cannot change mode flags...(only default value) GAMEVAR_FLAG_READONLY = 4096, // values are read-only (no setvar allowed) - GAMEVAR_FLAG_INTPTR = 8192, // plValue is a pointer to an int + GAMEVAR_FLAG_INTPTR = 8192, // plValue is a pointer to an int GAMEVAR_FLAG_SYNCCHECK = 16384, // check event sync when translating - GAMEVAR_FLAG_SHORTPTR = 32768, // plValue is a pointer to a short - GAMEVAR_FLAG_CHARPTR = 65536 // plValue is a pointer to a char + GAMEVAR_FLAG_SHORTPTR = 32768, // plValue is a pointer to a short + GAMEVAR_FLAG_CHARPTR = 65536, // plValue is a pointer to a char +}; + +enum gamearrayflags { + MAXGAMEARRAYS = (MAXGAMEVARS>>2), // must be lower than MAXGAMEVARS + MAXARRAYLABEL = MAXVARLABEL, + GAMEARRAY_FLAG_NORMAL = 0, + GAMEARRAY_FLAG_NORESET = 1, }; typedef struct { @@ -828,12 +833,14 @@ typedef struct { char *szLabel; char bReset; } gamevar_t; + typedef struct { char *szLabel; - int *plValues; // array of values + intptr_t *plValues; // array of values int size; char bReset; } gamearray_t; + extern gamevar_t aGameVars[MAXGAMEVARS]; extern gamearray_t aGameArrays[MAXGAMEARRAYS]; extern int iGameVarCount; diff --git a/polymer/eduke32/source/funct.h b/polymer/eduke32/source/funct.h index 71e3961bc..2b223d67d 100644 --- a/polymer/eduke32/source/funct.h +++ b/polymer/eduke32/source/funct.h @@ -31,7 +31,7 @@ extern void SoundShutdown(void); extern void MusicStartup(void); extern void MusicShutdown(void); extern void intomenusounds(void); -extern int playmusicMAP(const char *fn, const int sel); +extern int playmusic(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); diff --git a/polymer/eduke32/source/game.c b/polymer/eduke32/source/game.c index 9c42f9966..559bcc6de 100644 --- a/polymer/eduke32/source/game.c +++ b/polymer/eduke32/source/game.c @@ -54,7 +54,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include #include extern int getversionfromwebsite(char *buffer); -#define BUILDDATE 20080321 +#define BUILDDATE 20080401 #define UPDATEINTERVAL 604800 // 1w #endif @@ -7994,7 +7994,7 @@ static void nonsharedkeys(void) music_select = 0; if (map[(unsigned char)music_select].musicfn != NULL) { - if (playmusicMAP(&map[(unsigned char)music_select].musicfn[0],music_select)) + if (playmusic(&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].musicfn[0]); @@ -8695,7 +8695,7 @@ static int AL_DefineMusic(char *ID,char *name) map[sel].musicfn1=makename(map[sel].musicfn1,name,ID); // initprintf("%-15s | ",ID); // initprintf("%3d %2d %2d | %s\n",sel,ep,lev,map[sel].musicfn1); -// playmusicMAP(ID,sel); +// playmusic(ID,sel); return 0; } @@ -9460,7 +9460,7 @@ static void Logo(void) if (logoflags & LOGO_FLAG_PLAYMUSIC) { music_select = -1; // hack - playmusicMAP(&env_music_fn[0][0],MAXVOLUMES*MAXLEVELS); + playmusic(&env_music_fn[0][0],MAXVOLUMES*MAXLEVELS); } if (!NAM) diff --git a/polymer/eduke32/source/gameexec.c b/polymer/eduke32/source/gameexec.c index 3b5d31780..fabcc1130 100644 --- a/polymer/eduke32/source/gameexec.c +++ b/polymer/eduke32/source/gameexec.c @@ -6996,7 +6996,7 @@ static int parse(void) insptr++; music_select=(ud.volume_number*MAXLEVELS)+(*(insptr++)); if (map[(unsigned char)music_select].musicfn != NULL) - playmusicMAP(&map[(unsigned char)music_select].musicfn[0],music_select); + playmusic(&map[(unsigned char)music_select].musicfn[0],music_select); break; case CON_GETTEXTURECEILING: diff --git a/polymer/eduke32/source/gamevars.c b/polymer/eduke32/source/gamevars.c index e09d0d7e2..f7ea9c7f9 100755 --- a/polymer/eduke32/source/gamevars.c +++ b/polymer/eduke32/source/gamevars.c @@ -30,7 +30,7 @@ extern int g_i,g_p; static void ResetPointerVars(void); -static void FreeGameVars(void) +static void FreeGameVars(void) /* called from ReadGameVars() and ResetGameVars() */ { // call this function as many times as needed. int i; @@ -323,7 +323,7 @@ void DumpGameVars(FILE *fp) fprintf(fp,"\n// end of game definitions\n"); } -void ResetGameVars(void) +void ResetGameVars(void) /* this is called during a new game and nowhere else */ { int i; diff --git a/polymer/eduke32/source/jaudiolib/audiolib_fxstub.c b/polymer/eduke32/source/jaudiolib/audiolib_fxstub.c index b723f51f0..2121d81ce 100644 --- a/polymer/eduke32/source/jaudiolib/audiolib_fxstub.c +++ b/polymer/eduke32/source/jaudiolib/audiolib_fxstub.c @@ -1,364 +1,393 @@ -//------------------------------------------------------------------------- -/* -Duke Nukem Copyright (C) 1996, 2003 3D Realms Entertainment - -This file is part of Duke Nukem 3D version 1.5 - Atomic Edition - -Duke Nukem 3D is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program 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 General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - - Dummy AudioLib stub implementation by Jonathon Fowler (jonof@edgenetwk.com) -*/ -//------------------------------------------------------------------------- - -#include "fx_man.h" - - -#define TRUE ( 1 == 1 ) -#define FALSE ( !TRUE ) - - -int FX_ErrorCode = FX_Ok; - -#define FX_SetErrorCode( status ) \ - FX_ErrorCode = ( status ); - - - -/*--------------------------------------------------------------------- - Function: FX_ErrorString - - Returns a pointer to the error message associated with an error - number. A -1 returns a pointer the current error. ----------------------------------------------------------------------*/ - -char *FX_ErrorString -( - int ErrorNumber -) - -{ - char *ErrorString; - - switch (ErrorNumber) - { - case FX_Warning : - case FX_Error : - ErrorString = FX_ErrorString(FX_ErrorCode); - break; - - case FX_Ok : - ErrorString = "Fx ok."; - break; - - case FX_ASSVersion : - ErrorString = "Apogee Sound System Version 0 " - "Programmed by Jim Dose\n" - "(c) Copyright 1995 James R. Dose. All Rights Reserved.\n"; - break; - - default : - ErrorString = "Unknown Fx error code."; - break; - } - - return(ErrorString); -} - - -/*--------------------------------------------------------------------- - Function: FX_Init - - Selects which sound device to use. ----------------------------------------------------------------------*/ - -int FX_Init -( - int SoundCard, - int numvoices, - int numchannels, - int samplebits, - unsigned mixrate -) - -{ - return(FX_Ok); -} - - -/*--------------------------------------------------------------------- - Function: FX_Shutdown - - Terminates use of sound device. ----------------------------------------------------------------------*/ - -int FX_Shutdown -( - void -) - -{ - return(FX_Ok); -} - - -/*--------------------------------------------------------------------- - Function: FX_SetCallback - - Sets the function to call when a voice is done. ----------------------------------------------------------------------*/ - -int FX_SetCallBack -( - void(*function)(unsigned int) -) - -{ - return(FX_Ok); -} - - -/*--------------------------------------------------------------------- - Function: FX_SetVolume - - Sets the volume of the current sound device. ----------------------------------------------------------------------*/ - -void FX_SetVolume -( - int volume -) - -{} - - -/*--------------------------------------------------------------------- - Function: FX_SetReverseStereo - - Set the orientation of the left and right channels. ----------------------------------------------------------------------*/ - -void FX_SetReverseStereo -( - int setting -) - -{} - - -/*--------------------------------------------------------------------- - Function: FX_GetReverseStereo - - Returns the orientation of the left and right channels. ----------------------------------------------------------------------*/ - -int FX_GetReverseStereo -( - void -) - -{ - return 0; -} - - -/*--------------------------------------------------------------------- - Function: FX_SetReverb - - Sets the reverb level. ----------------------------------------------------------------------*/ - -void FX_SetReverb -( - int reverb -) - -{} - - -/*--------------------------------------------------------------------- - Function: FX_SetReverbDelay - - Sets the delay level of reverb to add to mix. ----------------------------------------------------------------------*/ - -void FX_SetReverbDelay -( - int delay -) - -{} - - -/*--------------------------------------------------------------------- - Function: FX_VoiceAvailable - - Checks if a voice can be play at the specified priority. ----------------------------------------------------------------------*/ - -int FX_VoiceAvailable -( - int priority -) - -{ - return 0; -} - - -/*--------------------------------------------------------------------- - Function: FX_PlayLoopedVOC - - Begin playback of sound data with the given volume and priority. ----------------------------------------------------------------------*/ - -int FX_PlayLoopedVOC -( - char *ptr, - int loopstart, - int loopend, - int pitchoffset, - int vol, - int left, - int right, - int priority, - unsigned int callbackval -) - -{ - return(0); -} - - -/*--------------------------------------------------------------------- - Function: FX_PlayWAV - - Begin playback of sound data with the given volume and priority. ----------------------------------------------------------------------*/ - -int FX_PlayLoopedWAV -( - char *ptr, - int loopstart, - int loopend, - int pitchoffset, - int vol, - int left, - int right, - int priority, - unsigned int callbackval -) - -{ - return(0); -} - - -/*--------------------------------------------------------------------- - Function: FX_PlayVOC3D - - Begin playback of sound data at specified angle and distance - from listener. ----------------------------------------------------------------------*/ - -int FX_PlayVOC3D -( - char *ptr, - int pitchoffset, - int angle, - int distance, - int priority, - unsigned int callbackval -) - -{ - return(0); -} - - -/*--------------------------------------------------------------------- - Function: FX_PlayWAV3D - - Begin playback of sound data at specified angle and distance - from listener. ----------------------------------------------------------------------*/ - -int FX_PlayWAV3D -( - char *ptr, - int pitchoffset, - int angle, - int distance, - int priority, - unsigned int callbackval -) - -{ - return(0); -} - - -/*--------------------------------------------------------------------- - Function: FX_Pan3D - - Set the angle and distance from the listener of the voice associated - with the specified handle. ----------------------------------------------------------------------*/ - -int FX_Pan3D -( - int handle, - int angle, - int distance -) - -{ - return(0); -} - - -/*--------------------------------------------------------------------- - Function: FX_StopSound - - Halts playback of a specific voice ----------------------------------------------------------------------*/ - -int FX_StopSound -( - int handle -) - -{ - return(FX_Ok); -} - - -/*--------------------------------------------------------------------- - Function: FX_StopAllSounds - - Halts playback of all sounds. ----------------------------------------------------------------------*/ - -int FX_StopAllSounds -( - void -) - -{ - return(FX_Ok); -} - - -void AudioUpdate(void) { } +//------------------------------------------------------------------------- +/* +Duke Nukem Copyright (C) 1996, 2003 3D Realms Entertainment + +This file is part of Duke Nukem 3D version 1.5 - Atomic Edition + +Duke Nukem 3D is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program 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 General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + Dummy AudioLib stub implementation by Jonathon Fowler (jonof@edgenetwk.com) +*/ +//------------------------------------------------------------------------- + +#include "fx_man.h" + + +#define TRUE ( 1 == 1 ) +#define FALSE ( !TRUE ) + + +int FX_ErrorCode = FX_Ok; + +#define FX_SetErrorCode( status ) \ + FX_ErrorCode = ( status ); + + + +/*--------------------------------------------------------------------- + Function: FX_ErrorString + + Returns a pointer to the error message associated with an error + number. A -1 returns a pointer the current error. +---------------------------------------------------------------------*/ + +char *FX_ErrorString +( + int ErrorNumber +) + +{ + char *ErrorString; + + switch (ErrorNumber) + { + case FX_Warning : + case FX_Error : + ErrorString = FX_ErrorString(FX_ErrorCode); + break; + + case FX_Ok : + ErrorString = "Fx ok."; + break; + + case FX_ASSVersion : + ErrorString = "Apogee Sound System Version 0 " + "Programmed by Jim Dose\n" + "(c) Copyright 1995 James R. Dose. All Rights Reserved.\n"; + break; + + default : + ErrorString = "Unknown Fx error code."; + break; + } + + return(ErrorString); +} + + +/*--------------------------------------------------------------------- + Function: FX_Init + + Selects which sound device to use. +---------------------------------------------------------------------*/ + +int FX_Init +( + int SoundCard, + int numvoices, + int numchannels, + int samplebits, + unsigned mixrate +) + +{ + return(FX_Ok); +} + + +/*--------------------------------------------------------------------- + Function: FX_Shutdown + + Terminates use of sound device. +---------------------------------------------------------------------*/ + +int FX_Shutdown +( + void +) + +{ + return(FX_Ok); +} + + +/*--------------------------------------------------------------------- + Function: FX_SetCallback + + Sets the function to call when a voice is done. +---------------------------------------------------------------------*/ + +int FX_SetCallBack +( + void(*function)(unsigned int) +) + +{ + return(FX_Ok); +} + + +/*--------------------------------------------------------------------- + Function: FX_SetVolume + + Sets the volume of the current sound device. +---------------------------------------------------------------------*/ + +void FX_SetVolume +( + int volume +) + +{} + + +/*--------------------------------------------------------------------- + Function: FX_SetReverseStereo + + Set the orientation of the left and right channels. +---------------------------------------------------------------------*/ + +void FX_SetReverseStereo +( + int setting +) + +{} + + +/*--------------------------------------------------------------------- + Function: FX_GetReverseStereo + + Returns the orientation of the left and right channels. +---------------------------------------------------------------------*/ + +int FX_GetReverseStereo +( + void +) + +{ + return 0; +} + + +/*--------------------------------------------------------------------- + Function: FX_SetReverb + + Sets the reverb level. +---------------------------------------------------------------------*/ + +void FX_SetReverb +( + int reverb +) + +{} + + +/*--------------------------------------------------------------------- + Function: FX_SetReverbDelay + + Sets the delay level of reverb to add to mix. +---------------------------------------------------------------------*/ + +void FX_SetReverbDelay +( + int delay +) + +{} + + +/*--------------------------------------------------------------------- + Function: FX_VoiceAvailable + + Checks if a voice can be play at the specified priority. +---------------------------------------------------------------------*/ + +int FX_VoiceAvailable +( + int priority +) + +{ + return 0; +} + + +/*--------------------------------------------------------------------- + Function: FX_PlayLoopedVOC + + Begin playback of sound data with the given volume and priority. +---------------------------------------------------------------------*/ + +int FX_PlayLoopedVOC +( + char *ptr, + int loopstart, + int loopend, + int pitchoffset, + int vol, + int left, + int right, + int priority, + unsigned int callbackval +) + +{ + return(0); +} + + +/*--------------------------------------------------------------------- + Function: FX_PlayWAV + + Begin playback of sound data with the given volume and priority. +---------------------------------------------------------------------*/ + +int FX_PlayLoopedWAV +( + char *ptr, + int loopstart, + int loopend, + int pitchoffset, + int vol, + int left, + int right, + int priority, + unsigned int callbackval +) + +{ + return(0); +} + + +/*--------------------------------------------------------------------- + Function: FX_PlayVOC3D + + Begin playback of sound data at specified angle and distance + from listener. +---------------------------------------------------------------------*/ + +int FX_PlayVOC3D +( + char *ptr, + int pitchoffset, + int angle, + int distance, + int priority, + unsigned int callbackval +) + +{ + return(0); +} + + +/*--------------------------------------------------------------------- + Function: FX_PlayWAV3D + + Begin playback of sound data at specified angle and distance + from listener. +---------------------------------------------------------------------*/ + +int FX_PlayWAV3D +( + char *ptr, + int pitchoffset, + int angle, + int distance, + int priority, + unsigned int callbackval +) + +{ + return(0); +} + + +/*--------------------------------------------------------------------- + Function: FX_Pan3D + + Set the angle and distance from the listener of the voice associated + with the specified handle. +---------------------------------------------------------------------*/ + +int FX_Pan3D +( + int handle, + int angle, + int distance +) + +{ + return(0); +} + + +/*--------------------------------------------------------------------- + Function: FX_StopSound + + Halts playback of a specific voice +---------------------------------------------------------------------*/ + +int FX_StopSound +( + int handle +) + +{ + return(FX_Ok); +} + + +/*--------------------------------------------------------------------- + Function: FX_StopAllSounds + + Halts playback of all sounds. +---------------------------------------------------------------------*/ + +int FX_StopAllSounds +( + void +) + +{ + return(FX_Ok); +} + + +void AudioUpdate(void) { } + +int FX_PlayLoopedOGG +( + char *ptr, + int loopstart, + int loopend, + int pitchoffset, + int vol, + int left, + int right, + int priority, + unsigned int callbackval +) +{ + return(0); +} + +int FX_PlayOGG3D +( + char *ptr, + int pitchoffset, + int angle, + int distance, + int priority, + unsigned int callbackval +) +{ + return(0); +} \ No newline at end of file diff --git a/polymer/eduke32/source/jaudiolib/fx_man.c b/polymer/eduke32/source/jaudiolib/fx_man.c index e8e6c7692..21b8a34e0 100644 --- a/polymer/eduke32/source/jaudiolib/fx_man.c +++ b/polymer/eduke32/source/jaudiolib/fx_man.c @@ -1,1176 +1,1162 @@ -/* -Copyright (C) 1994-1995 Apogee Software, Ltd. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program 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 General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -Modifications for JonoF's port by Jonathon Fowler (jonof@edgenetwk.com) -*/ -/********************************************************************** - module: FX_MAN.C - - author: James R. Dose - date: March 17, 1994 - - Device independant sound effect routines. - - (c) Copyright 1994 James R. Dose. All Rights Reserved. -**********************************************************************/ - -#include -#include -#include -#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; - -int FX_SoundDevice = -1; -int FX_ErrorCode = FX_Ok; -int FX_Installed = FALSE; - -#define FX_SetErrorCode( status ) \ - FX_ErrorCode = ( status ); - -/*--------------------------------------------------------------------- - Function: FX_ErrorString - - Returns a pointer to the error message associated with an error - number. A -1 returns a pointer the current error. ----------------------------------------------------------------------*/ - -char *FX_ErrorString -( - int ErrorNumber -) - -{ - char *ErrorString; - - switch (ErrorNumber) - { - case FX_Warning : - case FX_Error : - ErrorString = FX_ErrorString(FX_ErrorCode); - break; - - case FX_Ok : - ErrorString = "Fx ok."; - break; - - case FX_ASSVersion : - ErrorString = "Apogee Sound System Version 0 " - "Programmed by Jim Dose\n" - "(c) Copyright 1995 James R. Dose. All Rights Reserved.\n"; - break; - - case FX_BlasterError : - case FX_SoundCardError : - ErrorString = "Sound device error."; - break; - - case FX_InvalidCard : - ErrorString = "Invalid Sound Fx device."; - break; - - case FX_MultiVocError : - ErrorString = MV_ErrorString(MV_Error); - break; - - case FX_DPMI_Error : - ErrorString = "DPMI Error in FX_MAN."; - break; - - default : - ErrorString = "Unknown Fx error code."; - break; - } - - return(ErrorString); -} - - -#if 0 -/*--------------------------------------------------------------------- - Function: FX_SetupCard - - Sets the configuration of a sound device. ----------------------------------------------------------------------*/ - -int FX_SetupCard -( - int SoundCard, - fx_device *device -) - -{ - int status; - int DeviceStatus; - - FX_SoundDevice = SoundCard; - - status = FX_Ok; - FX_SetErrorCode(FX_Ok); - - switch (SoundCard) - { - case SoundBlaster : - DeviceStatus = BLASTER_Init(); - if (DeviceStatus != BLASTER_Ok) - { - FX_SetErrorCode(FX_SoundCardError); - status = FX_Error; - break; - } - - device->MaxVoices = 32; - BLASTER_GetCardInfo(&device->MaxSampleBits, &device->MaxChannels); - break; - - default : - FX_SetErrorCode(FX_InvalidCard); - status = FX_Error; - } - return(status); -} -#endif - - -#if 0 -/*--------------------------------------------------------------------- - Function: FX_GetBlasterSettings - - Returns the current BLASTER environment variable settings. ----------------------------------------------------------------------*/ - -int FX_GetBlasterSettings -( - fx_blaster_config *blaster -) - -{ - int status; - BLASTER_CONFIG Blaster; - - FX_SetErrorCode(FX_Ok); - - status = BLASTER_GetEnv(&Blaster); - if (status != BLASTER_Ok) - { - FX_SetErrorCode(FX_BlasterError); - return(FX_Error); - } - - blaster->Type = Blaster.Type; - blaster->Address = Blaster.Address; - blaster->Interrupt = Blaster.Interrupt; - blaster->Dma8 = Blaster.Dma8; - blaster->Dma16 = Blaster.Dma16; - blaster->Midi = Blaster.Midi; - blaster->Emu = Blaster.Emu; - - return(FX_Ok); -} -#endif - - -#if 0 -/*--------------------------------------------------------------------- - Function: FX_SetupSoundBlaster - - Handles manual setup of the Sound Blaster information. ----------------------------------------------------------------------*/ - -int FX_SetupSoundBlaster -( - fx_blaster_config blaster, - int *MaxVoices, - int *MaxSampleBits, - int *MaxChannels -) - -{ - int DeviceStatus; - BLASTER_CONFIG Blaster; - - FX_SetErrorCode(FX_Ok); - - FX_SoundDevice = SoundBlaster; - - Blaster.Type = blaster.Type; - Blaster.Address = blaster.Address; - Blaster.Interrupt = blaster.Interrupt; - Blaster.Dma8 = blaster.Dma8; - Blaster.Dma16 = blaster.Dma16; - Blaster.Midi = blaster.Midi; - Blaster.Emu = blaster.Emu; - - BLASTER_SetCardSettings(Blaster); - - DeviceStatus = BLASTER_Init(); - if (DeviceStatus != BLASTER_Ok) - { - FX_SetErrorCode(FX_SoundCardError); - return(FX_Error); - } - - *MaxVoices = 8; - BLASTER_GetCardInfo(MaxSampleBits, MaxChannels); - - return(FX_Ok); -} -#endif - - -/*--------------------------------------------------------------------- - Function: FX_Init - - Selects which sound device to use. ----------------------------------------------------------------------*/ - -int FX_Init -( - int SoundCard, - int numvoices, - int numchannels, - int samplebits, - unsigned mixrate -) - -{ - int status; - int devicestatus; - - if (FX_Installed) - { - FX_Shutdown(); - } - - FX_MixRate = mixrate; - - status = FX_Ok; - FX_SoundDevice = SoundCard; - - devicestatus = MV_Init(SoundCard, FX_MixRate, numvoices, - numchannels, samplebits); - if (devicestatus != MV_Ok) - { - FX_SetErrorCode(FX_MultiVocError); - status = FX_Error; - } - - if (status == FX_Ok) - { - FX_Installed = TRUE; - } - - return(status); -} - - -/*--------------------------------------------------------------------- - Function: FX_Shutdown - - Terminates use of sound device. ----------------------------------------------------------------------*/ - -int FX_Shutdown -( - void -) - -{ - int status; - - if (!FX_Installed) - { - return(FX_Ok); - } - - status = MV_Shutdown(); - if (status != MV_Ok) - { - FX_SetErrorCode(FX_MultiVocError); - status = FX_Error; - } - - FX_Installed = FALSE; - - return(status); -} - - -/*--------------------------------------------------------------------- - Function: FX_SetCallback - - Sets the function to call when a voice is done. ----------------------------------------------------------------------*/ - -int FX_SetCallBack -( - void(*function)(unsigned int) -) - -{ - MV_SetCallBack(function); - - return(FX_Ok); -} - - -/*--------------------------------------------------------------------- - Function: FX_SetVolume - - Sets the volume of the current sound device. ----------------------------------------------------------------------*/ - -void FX_SetVolume -( - int volume -) - -{ - MV_SetVolume(volume); -} - - -/*--------------------------------------------------------------------- - Function: FX_GetVolume - - Returns the volume of the current sound device. ----------------------------------------------------------------------*/ - -int FX_GetVolume -( - void -) - -{ - return MV_GetVolume(); -} - - -/*--------------------------------------------------------------------- - Function: FX_SetReverseStereo - - Set the orientation of the left and right channels. ----------------------------------------------------------------------*/ - -void FX_SetReverseStereo -( - int setting -) - -{ - MV_SetReverseStereo(setting); -} - - -/*--------------------------------------------------------------------- - Function: FX_GetReverseStereo - - Returns the orientation of the left and right channels. ----------------------------------------------------------------------*/ - -int FX_GetReverseStereo -( - void -) - -{ - return MV_GetReverseStereo(); -} - - -/*--------------------------------------------------------------------- - Function: FX_SetReverb - - Sets the reverb level. ----------------------------------------------------------------------*/ - -void FX_SetReverb -( - int reverb -) - -{ - MV_SetReverb(reverb); -} - - -/*--------------------------------------------------------------------- - Function: FX_SetFastReverb - - Sets the reverb level. ----------------------------------------------------------------------*/ - -void FX_SetFastReverb -( - int reverb -) - -{ - MV_SetFastReverb(reverb); -} - - -/*--------------------------------------------------------------------- - Function: FX_GetMaxReverbDelay - - Returns the maximum delay time for reverb. ----------------------------------------------------------------------*/ - -int FX_GetMaxReverbDelay -( - void -) - -{ - return MV_GetMaxReverbDelay(); -} - - -/*--------------------------------------------------------------------- - Function: FX_GetReverbDelay - - Returns the current delay time for reverb. ----------------------------------------------------------------------*/ - -int FX_GetReverbDelay -( - void -) - -{ - return MV_GetReverbDelay(); -} - - -/*--------------------------------------------------------------------- - Function: FX_SetReverbDelay - - Sets the delay level of reverb to add to mix. ----------------------------------------------------------------------*/ - -void FX_SetReverbDelay -( - int delay -) - -{ - MV_SetReverbDelay(delay); -} - - -/*--------------------------------------------------------------------- - Function: FX_VoiceAvailable - - Checks if a voice can be play at the specified priority. ----------------------------------------------------------------------*/ - -int FX_VoiceAvailable -( - int priority -) - -{ - return MV_VoiceAvailable(priority); -} - -/*--------------------------------------------------------------------- - Function: FX_EndLooping - - Stops the voice associated with the specified handle from looping - without stoping the sound. ----------------------------------------------------------------------*/ - -int FX_EndLooping -( - int handle -) - -{ - int status; - - status = MV_EndLooping(handle); - if (status == MV_Error) - { - FX_SetErrorCode(FX_MultiVocError); - status = FX_Warning; - } - - return(status); -} - -/*--------------------------------------------------------------------- - Function: FX_SetPan - - Sets the stereo and mono volume level of the voice associated - with the specified handle. ----------------------------------------------------------------------*/ - -int FX_SetPan -( - int handle, - int vol, - int left, - int right -) - -{ - int status; - - status = MV_SetPan(handle, vol, left, right); - if (status == MV_Error) - { - FX_SetErrorCode(FX_MultiVocError); - status = FX_Warning; - } - - return(status); -} - - -/*--------------------------------------------------------------------- - Function: FX_SetPitch - - Sets the pitch of the voice associated with the specified handle. ----------------------------------------------------------------------*/ - -int FX_SetPitch -( - int handle, - int pitchoffset -) - -{ - int status; - - status = MV_SetPitch(handle, pitchoffset); - if (status == MV_Error) - { - FX_SetErrorCode(FX_MultiVocError); - status = FX_Warning; - } - - return(status); -} - - -/*--------------------------------------------------------------------- - Function: FX_SetFrequency - - Sets the frequency of the voice associated with the specified handle. ----------------------------------------------------------------------*/ - -int FX_SetFrequency -( - int handle, - int frequency -) - -{ - int status; - - status = MV_SetFrequency(handle, frequency); - if (status == MV_Error) - { - FX_SetErrorCode(FX_MultiVocError); - status = FX_Warning; - } - - return(status); -} - - -/*--------------------------------------------------------------------- - Function: FX_PlayVOC - - Begin playback of sound data with the given volume and priority. ----------------------------------------------------------------------*/ - -int FX_PlayVOC -( - char *ptr, - int pitchoffset, - int vol, - int left, - int right, - int priority, - unsigned int callbackval -) - -{ - int handle; - - handle = MV_PlayVOC(ptr, pitchoffset, vol, left, right, - priority, callbackval); - if (handle < MV_Ok) - { - FX_SetErrorCode(FX_MultiVocError); - handle = FX_Warning; - } - - return(handle); -} - - -/*--------------------------------------------------------------------- - Function: FX_PlayLoopedVOC - - Begin playback of sound data with the given volume and priority. ----------------------------------------------------------------------*/ - -int FX_PlayLoopedVOC -( - char *ptr, - int loopstart, - int loopend, - int pitchoffset, - int vol, - int left, - int right, - int priority, - unsigned int callbackval -) - -{ - int handle; - - handle = MV_PlayLoopedVOC(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); -} - - -/*--------------------------------------------------------------------- - Function: FX_PlayWAV - - Begin playback of sound data with the given volume and priority. ----------------------------------------------------------------------*/ - -int FX_PlayWAV -( - char *ptr, - int pitchoffset, - int vol, - int left, - int right, - int priority, - unsigned int callbackval -) - -{ - int handle; - - handle = MV_PlayWAV(ptr, pitchoffset, vol, left, right, - priority, callbackval); - if (handle < MV_Ok) - { - FX_SetErrorCode(FX_MultiVocError); - handle = FX_Warning; - } - - return(handle); -} - -/*--------------------------------------------------------------------- - Function: FX_PlayOGG - - Begin playback of sound data with the given volume and priority. ----------------------------------------------------------------------*/ -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); -} - -/*--------------------------------------------------------------------- - Function: FX_PlayWAV - - Begin playback of sound data with the given volume and priority. ----------------------------------------------------------------------*/ - -int FX_PlayLoopedWAV -( - char *ptr, - int loopstart, - int loopend, - int pitchoffset, - int vol, - int left, - int right, - int priority, - unsigned int callbackval -) - -{ - int handle; - - handle = MV_PlayLoopedWAV(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); -} - -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); -} - -/*--------------------------------------------------------------------- - Function: FX_PlayVOC3D - - Begin playback of sound data at specified angle and distance - from listener. ----------------------------------------------------------------------*/ - -int FX_PlayVOC3D -( - char *ptr, - int pitchoffset, - int angle, - int distance, - int priority, - unsigned int callbackval -) - -{ - int handle; - - handle = MV_PlayVOC3D(ptr, pitchoffset, angle, distance, - priority, callbackval); - if (handle < MV_Ok) - { - FX_SetErrorCode(FX_MultiVocError); - handle = FX_Warning; - } - - return(handle); -} - -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); -} - -/*--------------------------------------------------------------------- - Function: FX_PlayWAV3D - - Begin playback of sound data at specified angle and distance - from listener. ----------------------------------------------------------------------*/ - -int FX_PlayWAV3D -( - char *ptr, - int pitchoffset, - int angle, - int distance, - int priority, - unsigned int callbackval -) - -{ - int handle; - - handle = MV_PlayWAV3D(ptr, pitchoffset, angle, distance, - priority, callbackval); - if (handle < MV_Ok) - { - FX_SetErrorCode(FX_MultiVocError); - handle = FX_Warning; - } - - return(handle); -} - - -/*--------------------------------------------------------------------- - Function: FX_PlayRaw - - Begin playback of raw sound data with the given volume and priority. ----------------------------------------------------------------------*/ - -int FX_PlayRaw -( - char *ptr, - unsigned int length, - unsigned rate, - int pitchoffset, - int vol, - int left, - int right, - int priority, - unsigned int callbackval -) - -{ - int handle; - - handle = MV_PlayRaw(ptr, length, rate, pitchoffset, - vol, left, right, priority, callbackval); - if (handle < MV_Ok) - { - FX_SetErrorCode(FX_MultiVocError); - handle = FX_Warning; - } - - return(handle); -} - - -/*--------------------------------------------------------------------- - Function: FX_PlayLoopedRaw - - Begin playback of raw sound data with the given volume and priority. ----------------------------------------------------------------------*/ - -int FX_PlayLoopedRaw -( - char *ptr, - unsigned int length, - char *loopstart, - char *loopend, - unsigned rate, - int pitchoffset, - int vol, - int left, - int right, - int priority, - unsigned int callbackval -) - -{ - int handle; - - handle = MV_PlayLoopedRaw(ptr, length, loopstart, loopend, - rate, pitchoffset, vol, left, right, priority, callbackval); - if (handle < MV_Ok) - { - FX_SetErrorCode(FX_MultiVocError); - handle = FX_Warning; - } - - return(handle); -} - - -/*--------------------------------------------------------------------- - Function: FX_Pan3D - - Set the angle and distance from the listener of the voice associated - with the specified handle. ----------------------------------------------------------------------*/ - -int FX_Pan3D -( - int handle, - int angle, - int distance -) - -{ - int status; - - status = MV_Pan3D(handle, angle, distance); - if (status != MV_Ok) - { - FX_SetErrorCode(FX_MultiVocError); - status = FX_Warning; - } - - return(status); -} - - -/*--------------------------------------------------------------------- - Function: FX_SoundActive - - Tests if the specified sound is currently playing. ----------------------------------------------------------------------*/ - -int FX_SoundActive -( - int handle -) - -{ - return(MV_VoicePlaying(handle)); -} - - -/*--------------------------------------------------------------------- - Function: FX_SoundsPlaying - - Reports the number of voices playing. ----------------------------------------------------------------------*/ - -int FX_SoundsPlaying -( - void -) - -{ - return(MV_VoicesPlaying()); -} - - -/*--------------------------------------------------------------------- - Function: FX_StopSound - - Halts playback of a specific voice ----------------------------------------------------------------------*/ - -int FX_StopSound -( - int handle -) - -{ - int status; - - status = MV_Kill(handle); - if (status != MV_Ok) - { - FX_SetErrorCode(FX_MultiVocError); - return(FX_Warning); - } - - return(FX_Ok); -} - - -/*--------------------------------------------------------------------- - Function: FX_StopAllSounds - - Halts playback of all sounds. ----------------------------------------------------------------------*/ - -int FX_StopAllSounds -( - void -) - -{ - int status; - - status = MV_KillAllVoices(); - if (status != MV_Ok) - { - FX_SetErrorCode(FX_MultiVocError); - return(FX_Warning); - } - - return(FX_Ok); -} - - -/*--------------------------------------------------------------------- - Function: FX_StartDemandFeedPlayback - - Plays a digitized sound from a user controlled buffering system. ----------------------------------------------------------------------*/ - -int FX_StartDemandFeedPlayback -( - void(*function)(char **ptr, unsigned int *length), - int rate, - int pitchoffset, - int vol, - int left, - int right, - int priority, - unsigned int callbackval -) - -{ - int handle; - - handle = MV_StartDemandFeedPlayback(function, rate, - pitchoffset, vol, left, right, priority, callbackval); - if (handle < MV_Ok) - { - FX_SetErrorCode(FX_MultiVocError); - handle = FX_Warning; - } - - return(handle); -} - -#if 0 -/*--------------------------------------------------------------------- - Function: FX_StartRecording - - Starts the sound recording engine. ----------------------------------------------------------------------*/ - -int FX_StartRecording -( - int MixRate, - void(*function)(char *ptr, int length) -) - -{ - int status; - - switch (FX_SoundDevice) - { - case SoundBlaster : - status = MV_StartRecording(MixRate, function); - if (status != MV_Ok) - { - FX_SetErrorCode(FX_MultiVocError); - status = FX_Warning; - } - else - { - status = FX_Ok; - } - break; - - default : - FX_SetErrorCode(FX_InvalidCard); - status = FX_Warning; - break; - } - - return(status); -} -#endif - -#if 0 -/*--------------------------------------------------------------------- - Function: FX_StopRecord - - Stops the sound record engine. ----------------------------------------------------------------------*/ - -void FX_StopRecord -( - void -) - -{ - // Stop sound playback - switch (FX_SoundDevice) - { - case SoundBlaster : - MV_StopRecord(); - break; - } -} -#endif - -extern void MUSIC_Update(void); -void AudioUpdate(void) { MUSIC_Update(); } - -void playmusic(const char *fn); - -int playmusicMAP(const char *fn,const int sel) -{ - Musicsize=0; - if(map[sel].musicfn1 != NULL) - playmusic(map[sel].musicfn1); - if(!Musicsize) - { - playmusic(fn); - return 0; - } - return 1; -} +/* +Copyright (C) 1994-1995 Apogee Software, Ltd. + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program 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 General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +Modifications for JonoF's port by Jonathon Fowler (jonof@edgenetwk.com) +*/ +/********************************************************************** + module: FX_MAN.C + + author: James R. Dose + date: March 17, 1994 + + Device independant sound effect routines. + + (c) Copyright 1994 James R. Dose. All Rights Reserved. +**********************************************************************/ + +#include +#include +#include +#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; + +int FX_SoundDevice = -1; +int FX_ErrorCode = FX_Ok; +int FX_Installed = FALSE; + +#define FX_SetErrorCode( status ) \ + FX_ErrorCode = ( status ); + +/*--------------------------------------------------------------------- + Function: FX_ErrorString + + Returns a pointer to the error message associated with an error + number. A -1 returns a pointer the current error. +---------------------------------------------------------------------*/ + +char *FX_ErrorString +( + int ErrorNumber +) + +{ + char *ErrorString; + + switch (ErrorNumber) + { + case FX_Warning : + case FX_Error : + ErrorString = FX_ErrorString(FX_ErrorCode); + break; + + case FX_Ok : + ErrorString = "Fx ok."; + break; + + case FX_ASSVersion : + ErrorString = "Apogee Sound System Version 0 " + "Programmed by Jim Dose\n" + "(c) Copyright 1995 James R. Dose. All Rights Reserved.\n"; + break; + + case FX_BlasterError : + case FX_SoundCardError : + ErrorString = "Sound device error."; + break; + + case FX_InvalidCard : + ErrorString = "Invalid Sound Fx device."; + break; + + case FX_MultiVocError : + ErrorString = MV_ErrorString(MV_Error); + break; + + case FX_DPMI_Error : + ErrorString = "DPMI Error in FX_MAN."; + break; + + default : + ErrorString = "Unknown Fx error code."; + break; + } + + return(ErrorString); +} + + +#if 0 +/*--------------------------------------------------------------------- + Function: FX_SetupCard + + Sets the configuration of a sound device. +---------------------------------------------------------------------*/ + +int FX_SetupCard +( + int SoundCard, + fx_device *device +) + +{ + int status; + int DeviceStatus; + + FX_SoundDevice = SoundCard; + + status = FX_Ok; + FX_SetErrorCode(FX_Ok); + + switch (SoundCard) + { + case SoundBlaster : + DeviceStatus = BLASTER_Init(); + if (DeviceStatus != BLASTER_Ok) + { + FX_SetErrorCode(FX_SoundCardError); + status = FX_Error; + break; + } + + device->MaxVoices = 32; + BLASTER_GetCardInfo(&device->MaxSampleBits, &device->MaxChannels); + break; + + default : + FX_SetErrorCode(FX_InvalidCard); + status = FX_Error; + } + return(status); +} +#endif + + +#if 0 +/*--------------------------------------------------------------------- + Function: FX_GetBlasterSettings + + Returns the current BLASTER environment variable settings. +---------------------------------------------------------------------*/ + +int FX_GetBlasterSettings +( + fx_blaster_config *blaster +) + +{ + int status; + BLASTER_CONFIG Blaster; + + FX_SetErrorCode(FX_Ok); + + status = BLASTER_GetEnv(&Blaster); + if (status != BLASTER_Ok) + { + FX_SetErrorCode(FX_BlasterError); + return(FX_Error); + } + + blaster->Type = Blaster.Type; + blaster->Address = Blaster.Address; + blaster->Interrupt = Blaster.Interrupt; + blaster->Dma8 = Blaster.Dma8; + blaster->Dma16 = Blaster.Dma16; + blaster->Midi = Blaster.Midi; + blaster->Emu = Blaster.Emu; + + return(FX_Ok); +} +#endif + + +#if 0 +/*--------------------------------------------------------------------- + Function: FX_SetupSoundBlaster + + Handles manual setup of the Sound Blaster information. +---------------------------------------------------------------------*/ + +int FX_SetupSoundBlaster +( + fx_blaster_config blaster, + int *MaxVoices, + int *MaxSampleBits, + int *MaxChannels +) + +{ + int DeviceStatus; + BLASTER_CONFIG Blaster; + + FX_SetErrorCode(FX_Ok); + + FX_SoundDevice = SoundBlaster; + + Blaster.Type = blaster.Type; + Blaster.Address = blaster.Address; + Blaster.Interrupt = blaster.Interrupt; + Blaster.Dma8 = blaster.Dma8; + Blaster.Dma16 = blaster.Dma16; + Blaster.Midi = blaster.Midi; + Blaster.Emu = blaster.Emu; + + BLASTER_SetCardSettings(Blaster); + + DeviceStatus = BLASTER_Init(); + if (DeviceStatus != BLASTER_Ok) + { + FX_SetErrorCode(FX_SoundCardError); + return(FX_Error); + } + + *MaxVoices = 8; + BLASTER_GetCardInfo(MaxSampleBits, MaxChannels); + + return(FX_Ok); +} +#endif + + +/*--------------------------------------------------------------------- + Function: FX_Init + + Selects which sound device to use. +---------------------------------------------------------------------*/ + +int FX_Init +( + int SoundCard, + int numvoices, + int numchannels, + int samplebits, + unsigned mixrate +) + +{ + int status; + int devicestatus; + + if (FX_Installed) + { + FX_Shutdown(); + } + + FX_MixRate = mixrate; + + status = FX_Ok; + FX_SoundDevice = SoundCard; + + devicestatus = MV_Init(SoundCard, FX_MixRate, numvoices, + numchannels, samplebits); + if (devicestatus != MV_Ok) + { + FX_SetErrorCode(FX_MultiVocError); + status = FX_Error; + } + + if (status == FX_Ok) + { + FX_Installed = TRUE; + } + + return(status); +} + + +/*--------------------------------------------------------------------- + Function: FX_Shutdown + + Terminates use of sound device. +---------------------------------------------------------------------*/ + +int FX_Shutdown +( + void +) + +{ + int status; + + if (!FX_Installed) + { + return(FX_Ok); + } + + status = MV_Shutdown(); + if (status != MV_Ok) + { + FX_SetErrorCode(FX_MultiVocError); + status = FX_Error; + } + + FX_Installed = FALSE; + + return(status); +} + + +/*--------------------------------------------------------------------- + Function: FX_SetCallback + + Sets the function to call when a voice is done. +---------------------------------------------------------------------*/ + +int FX_SetCallBack +( + void(*function)(unsigned int) +) + +{ + MV_SetCallBack(function); + + return(FX_Ok); +} + + +/*--------------------------------------------------------------------- + Function: FX_SetVolume + + Sets the volume of the current sound device. +---------------------------------------------------------------------*/ + +void FX_SetVolume +( + int volume +) + +{ + MV_SetVolume(volume); +} + + +/*--------------------------------------------------------------------- + Function: FX_GetVolume + + Returns the volume of the current sound device. +---------------------------------------------------------------------*/ + +int FX_GetVolume +( + void +) + +{ + return MV_GetVolume(); +} + + +/*--------------------------------------------------------------------- + Function: FX_SetReverseStereo + + Set the orientation of the left and right channels. +---------------------------------------------------------------------*/ + +void FX_SetReverseStereo +( + int setting +) + +{ + MV_SetReverseStereo(setting); +} + + +/*--------------------------------------------------------------------- + Function: FX_GetReverseStereo + + Returns the orientation of the left and right channels. +---------------------------------------------------------------------*/ + +int FX_GetReverseStereo +( + void +) + +{ + return MV_GetReverseStereo(); +} + + +/*--------------------------------------------------------------------- + Function: FX_SetReverb + + Sets the reverb level. +---------------------------------------------------------------------*/ + +void FX_SetReverb +( + int reverb +) + +{ + MV_SetReverb(reverb); +} + + +/*--------------------------------------------------------------------- + Function: FX_SetFastReverb + + Sets the reverb level. +---------------------------------------------------------------------*/ + +void FX_SetFastReverb +( + int reverb +) + +{ + MV_SetFastReverb(reverb); +} + + +/*--------------------------------------------------------------------- + Function: FX_GetMaxReverbDelay + + Returns the maximum delay time for reverb. +---------------------------------------------------------------------*/ + +int FX_GetMaxReverbDelay +( + void +) + +{ + return MV_GetMaxReverbDelay(); +} + + +/*--------------------------------------------------------------------- + Function: FX_GetReverbDelay + + Returns the current delay time for reverb. +---------------------------------------------------------------------*/ + +int FX_GetReverbDelay +( + void +) + +{ + return MV_GetReverbDelay(); +} + + +/*--------------------------------------------------------------------- + Function: FX_SetReverbDelay + + Sets the delay level of reverb to add to mix. +---------------------------------------------------------------------*/ + +void FX_SetReverbDelay +( + int delay +) + +{ + MV_SetReverbDelay(delay); +} + + +/*--------------------------------------------------------------------- + Function: FX_VoiceAvailable + + Checks if a voice can be play at the specified priority. +---------------------------------------------------------------------*/ + +int FX_VoiceAvailable +( + int priority +) + +{ + return MV_VoiceAvailable(priority); +} + +/*--------------------------------------------------------------------- + Function: FX_EndLooping + + Stops the voice associated with the specified handle from looping + without stoping the sound. +---------------------------------------------------------------------*/ + +int FX_EndLooping +( + int handle +) + +{ + int status; + + status = MV_EndLooping(handle); + if (status == MV_Error) + { + FX_SetErrorCode(FX_MultiVocError); + status = FX_Warning; + } + + return(status); +} + +/*--------------------------------------------------------------------- + Function: FX_SetPan + + Sets the stereo and mono volume level of the voice associated + with the specified handle. +---------------------------------------------------------------------*/ + +int FX_SetPan +( + int handle, + int vol, + int left, + int right +) + +{ + int status; + + status = MV_SetPan(handle, vol, left, right); + if (status == MV_Error) + { + FX_SetErrorCode(FX_MultiVocError); + status = FX_Warning; + } + + return(status); +} + + +/*--------------------------------------------------------------------- + Function: FX_SetPitch + + Sets the pitch of the voice associated with the specified handle. +---------------------------------------------------------------------*/ + +int FX_SetPitch +( + int handle, + int pitchoffset +) + +{ + int status; + + status = MV_SetPitch(handle, pitchoffset); + if (status == MV_Error) + { + FX_SetErrorCode(FX_MultiVocError); + status = FX_Warning; + } + + return(status); +} + + +/*--------------------------------------------------------------------- + Function: FX_SetFrequency + + Sets the frequency of the voice associated with the specified handle. +---------------------------------------------------------------------*/ + +int FX_SetFrequency +( + int handle, + int frequency +) + +{ + int status; + + status = MV_SetFrequency(handle, frequency); + if (status == MV_Error) + { + FX_SetErrorCode(FX_MultiVocError); + status = FX_Warning; + } + + return(status); +} + + +/*--------------------------------------------------------------------- + Function: FX_PlayVOC + + Begin playback of sound data with the given volume and priority. +---------------------------------------------------------------------*/ + +int FX_PlayVOC +( + char *ptr, + int pitchoffset, + int vol, + int left, + int right, + int priority, + unsigned int callbackval +) + +{ + int handle; + + handle = MV_PlayVOC(ptr, pitchoffset, vol, left, right, + priority, callbackval); + if (handle < MV_Ok) + { + FX_SetErrorCode(FX_MultiVocError); + handle = FX_Warning; + } + + return(handle); +} + + +/*--------------------------------------------------------------------- + Function: FX_PlayLoopedVOC + + Begin playback of sound data with the given volume and priority. +---------------------------------------------------------------------*/ + +int FX_PlayLoopedVOC +( + char *ptr, + int loopstart, + int loopend, + int pitchoffset, + int vol, + int left, + int right, + int priority, + unsigned int callbackval +) + +{ + int handle; + + handle = MV_PlayLoopedVOC(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); +} + + +/*--------------------------------------------------------------------- + Function: FX_PlayWAV + + Begin playback of sound data with the given volume and priority. +---------------------------------------------------------------------*/ + +int FX_PlayWAV +( + char *ptr, + int pitchoffset, + int vol, + int left, + int right, + int priority, + unsigned int callbackval +) + +{ + int handle; + + handle = MV_PlayWAV(ptr, pitchoffset, vol, left, right, + priority, callbackval); + if (handle < MV_Ok) + { + FX_SetErrorCode(FX_MultiVocError); + handle = FX_Warning; + } + + return(handle); +} + +/*--------------------------------------------------------------------- + Function: FX_PlayOGG + + Begin playback of sound data with the given volume and priority. +---------------------------------------------------------------------*/ + +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); +} + +/*--------------------------------------------------------------------- + Function: FX_PlayWAV + + Begin playback of sound data with the given volume and priority. +---------------------------------------------------------------------*/ + +int FX_PlayLoopedWAV +( + char *ptr, + int loopstart, + int loopend, + int pitchoffset, + int vol, + int left, + int right, + int priority, + unsigned int callbackval +) + +{ + int handle; + + handle = MV_PlayLoopedWAV(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); +} + +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); +} + +/*--------------------------------------------------------------------- + Function: FX_PlayVOC3D + + Begin playback of sound data at specified angle and distance + from listener. +---------------------------------------------------------------------*/ + +int FX_PlayVOC3D +( + char *ptr, + int pitchoffset, + int angle, + int distance, + int priority, + unsigned int callbackval +) + +{ + int handle; + + handle = MV_PlayVOC3D(ptr, pitchoffset, angle, distance, + priority, callbackval); + if (handle < MV_Ok) + { + FX_SetErrorCode(FX_MultiVocError); + handle = FX_Warning; + } + + return(handle); +} + +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); +} + +/*--------------------------------------------------------------------- + Function: FX_PlayWAV3D + + Begin playback of sound data at specified angle and distance + from listener. +---------------------------------------------------------------------*/ + +int FX_PlayWAV3D +( + char *ptr, + int pitchoffset, + int angle, + int distance, + int priority, + unsigned int callbackval +) + +{ + int handle; + + handle = MV_PlayWAV3D(ptr, pitchoffset, angle, distance, + priority, callbackval); + if (handle < MV_Ok) + { + FX_SetErrorCode(FX_MultiVocError); + handle = FX_Warning; + } + + return(handle); +} + + +/*--------------------------------------------------------------------- + Function: FX_PlayRaw + + Begin playback of raw sound data with the given volume and priority. +---------------------------------------------------------------------*/ + +int FX_PlayRaw +( + char *ptr, + unsigned int length, + unsigned rate, + int pitchoffset, + int vol, + int left, + int right, + int priority, + unsigned int callbackval +) + +{ + int handle; + + handle = MV_PlayRaw(ptr, length, rate, pitchoffset, + vol, left, right, priority, callbackval); + if (handle < MV_Ok) + { + FX_SetErrorCode(FX_MultiVocError); + handle = FX_Warning; + } + + return(handle); +} + + +/*--------------------------------------------------------------------- + Function: FX_PlayLoopedRaw + + Begin playback of raw sound data with the given volume and priority. +---------------------------------------------------------------------*/ + +int FX_PlayLoopedRaw +( + char *ptr, + unsigned int length, + char *loopstart, + char *loopend, + unsigned rate, + int pitchoffset, + int vol, + int left, + int right, + int priority, + unsigned int callbackval +) + +{ + int handle; + + handle = MV_PlayLoopedRaw(ptr, length, loopstart, loopend, + rate, pitchoffset, vol, left, right, priority, callbackval); + if (handle < MV_Ok) + { + FX_SetErrorCode(FX_MultiVocError); + handle = FX_Warning; + } + + return(handle); +} + + +/*--------------------------------------------------------------------- + Function: FX_Pan3D + + Set the angle and distance from the listener of the voice associated + with the specified handle. +---------------------------------------------------------------------*/ + +int FX_Pan3D +( + int handle, + int angle, + int distance +) + +{ + int status; + + status = MV_Pan3D(handle, angle, distance); + if (status != MV_Ok) + { + FX_SetErrorCode(FX_MultiVocError); + status = FX_Warning; + } + + return(status); +} + + +/*--------------------------------------------------------------------- + Function: FX_SoundActive + + Tests if the specified sound is currently playing. +---------------------------------------------------------------------*/ + +int FX_SoundActive +( + int handle +) + +{ + return(MV_VoicePlaying(handle)); +} + + +/*--------------------------------------------------------------------- + Function: FX_SoundsPlaying + + Reports the number of voices playing. +---------------------------------------------------------------------*/ + +int FX_SoundsPlaying +( + void +) + +{ + return(MV_VoicesPlaying()); +} + + +/*--------------------------------------------------------------------- + Function: FX_StopSound + + Halts playback of a specific voice +---------------------------------------------------------------------*/ + +int FX_StopSound +( + int handle +) + +{ + int status; + + status = MV_Kill(handle); + if (status != MV_Ok) + { + FX_SetErrorCode(FX_MultiVocError); + return(FX_Warning); + } + + return(FX_Ok); +} + + +/*--------------------------------------------------------------------- + Function: FX_StopAllSounds + + Halts playback of all sounds. +---------------------------------------------------------------------*/ + +int FX_StopAllSounds +( + void +) + +{ + int status; + + status = MV_KillAllVoices(); + if (status != MV_Ok) + { + FX_SetErrorCode(FX_MultiVocError); + return(FX_Warning); + } + + return(FX_Ok); +} + + +/*--------------------------------------------------------------------- + Function: FX_StartDemandFeedPlayback + + Plays a digitized sound from a user controlled buffering system. +---------------------------------------------------------------------*/ + +int FX_StartDemandFeedPlayback +( + void(*function)(char **ptr, unsigned int *length), + int rate, + int pitchoffset, + int vol, + int left, + int right, + int priority, + unsigned int callbackval +) + +{ + int handle; + + handle = MV_StartDemandFeedPlayback(function, rate, + pitchoffset, vol, left, right, priority, callbackval); + if (handle < MV_Ok) + { + FX_SetErrorCode(FX_MultiVocError); + handle = FX_Warning; + } + + return(handle); +} + +#if 0 +/*--------------------------------------------------------------------- + Function: FX_StartRecording + + Starts the sound recording engine. +---------------------------------------------------------------------*/ + +int FX_StartRecording +( + int MixRate, + void(*function)(char *ptr, int length) +) + +{ + int status; + + switch (FX_SoundDevice) + { + case SoundBlaster : + status = MV_StartRecording(MixRate, function); + if (status != MV_Ok) + { + FX_SetErrorCode(FX_MultiVocError); + status = FX_Warning; + } + else + { + status = FX_Ok; + } + break; + + default : + FX_SetErrorCode(FX_InvalidCard); + status = FX_Warning; + break; + } + + return(status); +} +#endif + +#if 0 +/*--------------------------------------------------------------------- + Function: FX_StopRecord + + Stops the sound record engine. +---------------------------------------------------------------------*/ + +void FX_StopRecord +( + void +) + +{ + // Stop sound playback + switch (FX_SoundDevice) + { + case SoundBlaster : + MV_StopRecord(); + break; + } +} +#endif + +extern void MUSIC_Update(void); +void AudioUpdate(void) { MUSIC_Update(); } diff --git a/polymer/eduke32/source/menus.c b/polymer/eduke32/source/menus.c index 040b6950e..84d26b8df 100644 --- a/polymer/eduke32/source/menus.c +++ b/polymer/eduke32/source/menus.c @@ -4239,9 +4239,9 @@ cheat_for_port_credits: if (ud.recstat != 2 && g_player[myconnectindex].ps->gm&MODE_GAME) { if (map[(unsigned char)music_select].musicfn != NULL) - playmusicMAP(&map[(unsigned char)music_select].musicfn[0],music_select); + playmusic(&map[(unsigned char)music_select].musicfn[0],music_select); } - else playmusicMAP(&env_music_fn[0][0],MAXVOLUMES*MAXLEVELS); + else playmusic(&env_music_fn[0][0],MAXVOLUMES*MAXLEVELS); MUSIC_Continue(); } diff --git a/polymer/eduke32/source/osdcmds.c b/polymer/eduke32/source/osdcmds.c index c74ead0f5..9dadc08b4 100644 --- a/polymer/eduke32/source/osdcmds.c +++ b/polymer/eduke32/source/osdcmds.c @@ -366,9 +366,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) - playmusicMAP(&map[(unsigned char)music_select].musicfn[0],music_select); + playmusic(&map[(unsigned char)music_select].musicfn[0],music_select); } - else playmusicMAP(&env_music_fn[0][0],MAXVOLUMES*MAXLEVELS); + else playmusic(&env_music_fn[0][0],MAXVOLUMES*MAXLEVELS); } return OSDCMD_OK; diff --git a/polymer/eduke32/source/premap.c b/polymer/eduke32/source/premap.c index bd1ce6668..946a3d982 100644 --- a/polymer/eduke32/source/premap.c +++ b/polymer/eduke32/source/premap.c @@ -402,7 +402,7 @@ void cacheit(void) return; MUSIC_StopSong(); - playmusicMAP(&env_music_fn[2][0],MAXVOLUMES*MAXLEVELS+2); // loadmus + playmusic(&env_music_fn[2][0],MAXVOLUMES*MAXLEVELS+2); // loadmus starttime = getticks(); @@ -1185,7 +1185,7 @@ void newgame(int vn,int ln,int sk) if (ln == 0 && vn == 3 && ud.multimode < 2 && ud.lockout == 0) { - playmusicMAP(&env_music_fn[1][0],MAXVOLUMES*MAXLEVELS+1); + playmusic(&env_music_fn[1][0],MAXVOLUMES*MAXLEVELS+1); flushperms(); setview(0,0,xdim-1,ydim-1); @@ -1761,7 +1761,7 @@ int enterlevel(int g) { music_select = (ud.volume_number*MAXLEVELS) + ud.level_number; if (map[(unsigned char)music_select].musicfn != NULL) - playmusicMAP(&map[(unsigned char)music_select].musicfn[0],music_select); + playmusic(&map[(unsigned char)music_select].musicfn[0],music_select); } if ((g&MODE_GAME) || (g&MODE_EOL)) diff --git a/polymer/eduke32/source/savegame.c b/polymer/eduke32/source/savegame.c index 044d11e81..5de575d1f 100644 --- a/polymer/eduke32/source/savegame.c +++ b/polymer/eduke32/source/savegame.c @@ -415,7 +415,7 @@ int loadplayer(int spot) if (map[(unsigned char)music_select].musicfn != NULL && (i != music_select || env_music_fn[2][0])) { MUSIC_StopSong(); - playmusicMAP(&map[(unsigned char)music_select].musicfn[0],music_select); + playmusic(&map[(unsigned char)music_select].musicfn[0],music_select); } g_player[myconnectindex].ps->gm = MODE_GAME; diff --git a/polymer/eduke32/source/sounds.c b/polymer/eduke32/source/sounds.c index 01e0e1962..835756bdc 100644 --- a/polymer/eduke32/source/sounds.c +++ b/polymer/eduke32/source/sounds.c @@ -193,7 +193,7 @@ void intomenusounds(void) menunum %= 17; } -void playmusic(const char *fn) +void _playmusic(const char *fn) { #if defined(_WIN32) int fp, l; @@ -228,6 +228,19 @@ void playmusic(const char *fn) #endif } +int playmusic(const char *fn, const int sel) +{ + Musicsize=0; + if(map[sel].musicfn1 != NULL) + _playmusic(map[sel].musicfn1); + if(!Musicsize) + { + _playmusic(fn); + return 0; + } + return 1; +} + int loadsound(unsigned int num) { int fp = -1, l;