diff --git a/polymer/eduke32/eduke32.vcxproj b/polymer/eduke32/eduke32.vcxproj index 65760b9cd..903e88d6f 100644 --- a/polymer/eduke32/eduke32.vcxproj +++ b/polymer/eduke32/eduke32.vcxproj @@ -189,6 +189,7 @@ + @@ -232,7 +233,6 @@ - diff --git a/polymer/eduke32/eduke32.vcxproj.filters b/polymer/eduke32/eduke32.vcxproj.filters index 520c49165..caac5058e 100644 --- a/polymer/eduke32/eduke32.vcxproj.filters +++ b/polymer/eduke32/eduke32.vcxproj.filters @@ -249,9 +249,6 @@ jaudiolib\headers - - jaudiolib\headers - jaudiolib\headers @@ -540,6 +537,9 @@ build\headers + + jaudiolib\headers + diff --git a/polymer/eduke32/source/jaudiolib/include/drivers.h b/polymer/eduke32/source/jaudiolib/include/drivers.h index 69fceb5f0..93e67f281 100644 --- a/polymer/eduke32/source/jaudiolib/include/drivers.h +++ b/polymer/eduke32/source/jaudiolib/include/drivers.h @@ -32,7 +32,6 @@ typedef enum ASS_SDL, #endif ASS_NumSoundCards, - ASS_AutoDetect = -2 } soundcardnames; extern int32_t ASS_SoundDriver; diff --git a/polymer/eduke32/source/jaudiolib/include/fx_man.h b/polymer/eduke32/source/jaudiolib/include/fx_man.h index a254255bd..ca4216eed 100644 --- a/polymer/eduke32/source/jaudiolib/include/fx_man.h +++ b/polymer/eduke32/source/jaudiolib/include/fx_man.h @@ -34,6 +34,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "inttypes.h" #include "limits.h" #include "drivers.h" +#include "multivoc.h" #ifdef __cplusplus extern "C" { @@ -57,43 +58,61 @@ enum FX_LOOP_HOW #define FX_MUSIC_PRIORITY INT_MAX const char *FX_ErrorString(int32_t ErrorNumber); -int32_t FX_Init(int32_t SoundCard, int32_t numvoices, int32_t numchannels, unsigned mixrate, void *initdata); +int32_t FX_Init(int32_t numvoices, int32_t numchannels, unsigned mixrate, void *initdata); int32_t FX_Shutdown(void); -void FX_SetCallBack(void(*function)(uint32_t)); -void FX_SetVolume(int32_t volume); -int32_t FX_GetVolume(void); -void FX_SetReverseStereo(int32_t setting); -int32_t FX_GetReverseStereo(void); -void FX_SetReverb(int32_t reverb); -int32_t FX_GetMaxReverbDelay(void); -int32_t FX_GetReverbDelay(void); -void FX_SetReverbDelay(int32_t delay); -int32_t FX_PauseVoice(int32_t handle, int32_t pause); -int32_t FX_VoiceAvailable(int32_t priority); -int32_t FX_EndLooping(int32_t handle); -int32_t FX_SetPan(int32_t handle, int32_t vol, int32_t left, int32_t right); -int32_t FX_SetPitch(int32_t handle, int32_t pitchoffset); -int32_t FX_SetFrequency(int32_t handle, int32_t frequency); -int32_t FX_Play(char *ptr, uint32_t ptrlength, int32_t pitchoffset, int32_t vol, int32_t left, int32_t right, - int32_t priority, uint32_t callbackval); -int32_t FX_PlayLooped(char *ptr, uint32_t ptrlength, int32_t loopstart, int32_t loopend, int32_t pitchoffset, +int32_t FX_Play(char *ptr, uint32_t ptrlength, int32_t loopstart, int32_t loopend, int32_t pitchoffset, int32_t vol, int32_t left, int32_t right, int32_t priority, uint32_t callbackval); int32_t FX_Play3D(char *ptr, uint32_t ptrlength, int32_t loophow, int32_t pitchoffset, int32_t angle, int32_t distance, int32_t priority, uint32_t callbackval); -int32_t FX_Pan3D(int32_t handle, int32_t angle, int32_t distance); -int32_t FX_SoundActive(int32_t handle); -int32_t FX_SoundsPlaying(void); -int32_t FX_StopSound(int32_t handle); -int32_t FX_StopAllSounds(void); int32_t FX_SetPrintf(void(*function)(const char *, ...)); -int32_t FX_GetPosition(int32_t handle, int32_t *position); -int32_t FX_SetPosition(int32_t handle, int32_t position); +extern int32_t FX_ErrorCode; +#define FX_SetErrorCode(status) FX_ErrorCode = (status); + +FORCE_INLINE int FX_CheckMVErr(int32_t status) +{ + if (status != MV_Ok) + { + FX_SetErrorCode(FX_MultiVocError); + status = FX_Warning; + } + + return status; +} + +FORCE_INLINE void FX_SetCallBack(void(*function)(uint32_t)) { MV_SetCallBack(function); } +FORCE_INLINE void FX_SetVolume(int32_t volume) { MV_SetVolume(volume); } +FORCE_INLINE int32_t FX_GetVolume(void) { return MV_GetVolume(); } +FORCE_INLINE void FX_SetReverseStereo(int32_t setting) { MV_SetReverseStereo(setting); } +FORCE_INLINE int32_t FX_GetReverseStereo(void) { return MV_GetReverseStereo(); } +FORCE_INLINE void FX_SetReverb(int32_t reverb) { MV_SetReverb(reverb); } +FORCE_INLINE int32_t FX_GetMaxReverbDelay(void) { return MV_GetMaxReverbDelay(); } +FORCE_INLINE int32_t FX_GetReverbDelay(void) { return MV_GetReverbDelay(); } +FORCE_INLINE void FX_SetReverbDelay(int32_t delay) { MV_SetReverbDelay(delay); } +FORCE_INLINE int32_t FX_VoiceAvailable(int32_t priority) { return MV_VoiceAvailable(priority); } +FORCE_INLINE int32_t FX_PauseVoice(int32_t handle, int32_t pause) { return FX_CheckMVErr(MV_PauseVoice(handle, pause)); } +FORCE_INLINE int32_t FX_GetPosition(int32_t handle, int32_t *position) { return FX_CheckMVErr(MV_GetPosition(handle, position)); } +FORCE_INLINE int32_t FX_SetPosition(int32_t handle, int32_t position) { return FX_CheckMVErr(MV_SetPosition(handle, position)); } +FORCE_INLINE int32_t FX_EndLooping(int32_t handle) { return FX_CheckMVErr(MV_EndLooping(handle)); } +FORCE_INLINE int32_t FX_SetPan(int32_t handle, int32_t vol, int32_t left, int32_t right) +{ + return FX_CheckMVErr(MV_SetPan(handle, vol, left, right)); +} +FORCE_INLINE int32_t FX_SetPitch(int32_t handle, int32_t pitchoffset) { return FX_CheckMVErr(MV_SetPitch(handle, pitchoffset)); } +FORCE_INLINE int32_t FX_SetFrequency(int32_t handle, int32_t frequency) { return FX_CheckMVErr(MV_SetFrequency(handle, frequency)); } +FORCE_INLINE int32_t FX_Pan3D(int32_t handle, int32_t angle, int32_t distance) +{ + return FX_CheckMVErr(MV_Pan3D(handle, angle, distance)); +} +FORCE_INLINE int32_t FX_SoundActive(int32_t handle) { return MV_VoicePlaying(handle); } +FORCE_INLINE int32_t FX_SoundsPlaying(void) { return MV_VoicesPlaying(); } +FORCE_INLINE int32_t FX_StopSound(int32_t handle) { return FX_CheckMVErr(MV_Kill(handle)); } +FORCE_INLINE int32_t FX_StopAllSounds(void) { return FX_CheckMVErr(MV_KillAllVoices()); } #ifdef __cplusplus } diff --git a/polymer/eduke32/source/jaudiolib/src/multivoc.h b/polymer/eduke32/source/jaudiolib/include/multivoc.h similarity index 98% rename from polymer/eduke32/source/jaudiolib/src/multivoc.h rename to polymer/eduke32/source/jaudiolib/include/multivoc.h index 2f34033a2..bedbcc775 100644 --- a/polymer/eduke32/source/jaudiolib/src/multivoc.h +++ b/polymer/eduke32/source/jaudiolib/include/multivoc.h @@ -96,17 +96,14 @@ extern int32_t MV_ErrorCode; enum MV_Errors { + MV_Error = -1, MV_Ok = 0, MV_NotInstalled, MV_DriverError, MV_NoVoices, MV_NoMem, MV_VoiceNotFound, - MV_InvalidVOCFile, - MV_InvalidWAVFile, - MV_InvalidVorbisFile, - MV_InvalidFLACFile, - MV_InvalidXAFile, + MV_InvalidFile, }; extern void (*MV_Printf)(const char *fmt, ...); diff --git a/polymer/eduke32/source/jaudiolib/src/flac.c b/polymer/eduke32/source/jaudiolib/src/flac.c index 4c577d70d..82cd4c9e4 100644 --- a/polymer/eduke32/source/jaudiolib/src/flac.c +++ b/polymer/eduke32/source/jaudiolib/src/flac.c @@ -446,7 +446,7 @@ int32_t MV_PlayFLAC(char *ptr, uint32_t ptrlength, int32_t loopstart, int32_t lo fd = (flac_data *)calloc(1, sizeof(flac_data)); if (!fd) { - MV_SetErrorCode(MV_InvalidFLACFile); + MV_SetErrorCode(MV_InvalidFile); return MV_Error; } @@ -468,7 +468,7 @@ int32_t MV_PlayFLAC(char *ptr, uint32_t ptrlength, int32_t loopstart, int32_t lo (void *)fd) != FLAC__STREAM_DECODER_INIT_STATUS_OK) { MV_Printf("MV_PlayFLAC: %s\n", FLAC__stream_decoder_get_resolved_state_string(fd->stream)); - MV_SetErrorCode(MV_InvalidFLACFile); + MV_SetErrorCode(MV_InvalidFile); return MV_Error; } @@ -540,7 +540,7 @@ int32_t MV_PlayFLAC(char *ptr, uint32_t ptrlength, int32_t loopstart, int32_t lo FLAC__stream_decoder_finish(fd->stream); FLAC__stream_decoder_delete(fd->stream); free(fd); - MV_SetErrorCode(MV_InvalidFLACFile); + MV_SetErrorCode(MV_InvalidFile); return MV_Error; } diff --git a/polymer/eduke32/source/jaudiolib/src/formats.c b/polymer/eduke32/source/jaudiolib/src/formats.c index 923ec38c5..5ca53313a 100644 --- a/polymer/eduke32/source/jaudiolib/src/formats.c +++ b/polymer/eduke32/source/jaudiolib/src/formats.c @@ -347,7 +347,7 @@ int32_t MV_PlayWAV(char *ptr, uint32_t ptrlength, int32_t loopstart, int32_t loo if ((memcmp(riff.RIFF, "RIFF", 4) != 0) || (memcmp(riff.WAVE, "WAVE", 4) != 0) || (memcmp(riff.fmt, "fmt ", 4) != 0)) { - MV_SetErrorCode(MV_InvalidWAVFile); + MV_SetErrorCode(MV_InvalidFile); return MV_Error; } @@ -368,7 +368,7 @@ int32_t MV_PlayWAV(char *ptr, uint32_t ptrlength, int32_t loopstart, int32_t loo if (format.wFormatTag != 1 || (format.nChannels != 1 && format.nChannels != 2) || ((format.nBitsPerSample != 8) && (format.nBitsPerSample != 16)) || memcmp(data.DATA, "data", 4) != 0) { - MV_SetErrorCode(MV_InvalidWAVFile); + MV_SetErrorCode(MV_InvalidFile); return MV_Error; } @@ -455,7 +455,7 @@ int32_t MV_PlayVOC(char *ptr, uint32_t ptrlength, int32_t loopstart, int32_t loo // Make sure it looks like a valid VOC file. if (memcmp(ptr, "Creative Voice File", 19) != 0) { - MV_SetErrorCode(MV_InvalidVOCFile); + MV_SetErrorCode(MV_InvalidFile); return MV_Error; } diff --git a/polymer/eduke32/source/jaudiolib/src/fx_man.c b/polymer/eduke32/source/jaudiolib/src/fx_man.c index 90b597051..7b0f37762 100644 --- a/polymer/eduke32/source/jaudiolib/src/fx_man.c +++ b/polymer/eduke32/source/jaudiolib/src/fx_man.c @@ -41,8 +41,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. int32_t FX_ErrorCode = FX_Ok; int32_t FX_Installed = FALSE; -#define FX_SetErrorCode(status) FX_ErrorCode = (status); - const char *FX_ErrorString(int32_t ErrorNumber) { const char *ErrorString; @@ -54,8 +52,6 @@ const char *FX_ErrorString(int32_t ErrorNumber) case FX_Ok: ErrorString = "Fx ok."; break; - case FX_InvalidCard: ErrorString = "Invalid Sound Fx device."; break; - case FX_MultiVocError: ErrorString = MV_ErrorString(MV_Error); break; default: ErrorString = "Unknown Fx error code."; break; @@ -64,39 +60,19 @@ const char *FX_ErrorString(int32_t ErrorNumber) return ErrorString; } -static inline int32_t FX_CheckMVErr(int32_t status) -{ - if (status != MV_Ok) - { - FX_SetErrorCode(FX_MultiVocError); - status = FX_Warning; - } - - return status; -} - -int32_t FX_Init(int32_t SoundCard, int32_t numvoices, int32_t numchannels, unsigned mixrate, void *initdata) +int32_t FX_Init(int32_t numvoices, int32_t numchannels, unsigned mixrate, void *initdata) { if (FX_Installed) FX_Shutdown(); - if (SoundCard == ASS_AutoDetect) - { #if defined MIXERTYPEWIN - SoundCard = ASS_DirectSound; + int SoundCard = ASS_DirectSound; #elif defined MIXERTYPESDL - SoundCard = ASS_SDL; + int SoundCard = ASS_SDL; #else #warning No sound driver selected! - SoundCard = ASS_NoSound; + int SoundCard = ASS_NoSound; #endif - } - - if (SoundCard < 0 || SoundCard >= ASS_NumSoundCards) - { - FX_SetErrorCode(FX_InvalidCard); - return FX_Error; - } if (SoundDriver_IsSupported(SoundCard) == 0) { @@ -136,62 +112,12 @@ int32_t FX_Shutdown(void) return status; } -void FX_SetCallBack(void (*function)(uint32_t)) { MV_SetCallBack(function); } - -void FX_SetVolume(int32_t volume) { MV_SetVolume(volume); } - -int32_t FX_GetVolume(void) { return MV_GetVolume(); } - -void FX_SetReverseStereo(int32_t setting) { MV_SetReverseStereo(setting); } - -int32_t FX_GetReverseStereo(void) { return MV_GetReverseStereo(); } - -void FX_SetReverb(int32_t reverb) { MV_SetReverb(reverb); } - -int32_t FX_GetMaxReverbDelay(void) { return MV_GetMaxReverbDelay(); } - -int32_t FX_GetReverbDelay(void) { return MV_GetReverbDelay(); } - -void FX_SetReverbDelay(int32_t delay) { MV_SetReverbDelay(delay); } - -int32_t FX_VoiceAvailable(int32_t priority) { return MV_VoiceAvailable(priority); } - -int32_t FX_PauseVoice(int32_t handle, int32_t pause) { return FX_CheckMVErr(MV_PauseVoice(handle, pause)); } - -int32_t FX_GetPosition(int32_t handle, int32_t *position) { return FX_CheckMVErr(MV_GetPosition(handle, position)); } - -int32_t FX_SetPosition(int32_t handle, int32_t position) { return FX_CheckMVErr(MV_SetPosition(handle, position)); } - -int32_t FX_EndLooping(int32_t handle) { return FX_CheckMVErr(MV_EndLooping(handle)); } - -int32_t FX_SetPan(int32_t handle, int32_t vol, int32_t left, int32_t right) +static wavefmt_t FX_DetectFormat(char const * const ptr, uint32_t length) { - return FX_CheckMVErr(MV_SetPan(handle, vol, left, right)); -} - -int32_t FX_SetPitch(int32_t handle, int32_t pitchoffset) { return FX_CheckMVErr(MV_SetPitch(handle, pitchoffset)); } - -int32_t FX_SetFrequency(int32_t handle, int32_t frequency) { return FX_CheckMVErr(MV_SetFrequency(handle, frequency)); } - -int32_t FX_Pan3D(int32_t handle, int32_t angle, int32_t distance) -{ - return FX_CheckMVErr(MV_Pan3D(handle, angle, distance)); -} - -int32_t FX_SoundActive(int32_t handle) { return MV_VoicePlaying(handle); } - -int32_t FX_SoundsPlaying(void) { return MV_VoicesPlaying(); } - -int32_t FX_StopSound(int32_t handle) { return FX_CheckMVErr(MV_Kill(handle)); } - -int32_t FX_StopAllSounds(void) { return FX_CheckMVErr(MV_KillAllVoices()); } - -static wavefmt_t FX_AutoDetectFormat(const char *ptr, uint32_t length) -{ - wavefmt_t fmt = FMT_UNKNOWN; - if (length < 12) - return fmt; + return FMT_UNKNOWN; + + wavefmt_t fmt = FMT_UNKNOWN; switch (LITTLE32(*(int32_t const *)ptr)) { @@ -226,26 +152,18 @@ static wavefmt_t FX_AutoDetectFormat(const char *ptr, uint32_t length) return fmt; } -int32_t FX_Play(char *ptr, uint32_t length, int32_t pitchoffset, int32_t vol, - int32_t left, int32_t right, int32_t priority, uint32_t callbackval) -{ - return FX_PlayLooped(ptr, length, -1, -1, pitchoffset, vol, left, right, priority, callbackval); -} - -int32_t FX_PlayLooped(char *ptr, uint32_t length, int32_t loopstart, int32_t loopend, int32_t pitchoffset, +int32_t FX_Play(char *ptr, uint32_t length, int32_t loopstart, int32_t loopend, int32_t pitchoffset, int32_t vol, int32_t left, int32_t right, int32_t priority, uint32_t callbackval) { - int32_t handle = -1; - EDUKE32_STATIC_ASSERT(FMT_MAX == 7); static int32_t(*const func[FMT_MAX])(char *, uint32_t, int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, uint32_t) = { NULL, NULL, MV_PlayVOC, MV_PlayWAV, MV_PlayVorbis, MV_PlayFLAC, MV_PlayXA }; - wavefmt_t const fmt = FX_AutoDetectFormat(ptr, length); + wavefmt_t const fmt = FX_DetectFormat(ptr, length); - if (func[fmt]) - handle = func[fmt](ptr, length, loopstart, loopend, pitchoffset, vol, left, right, priority, callbackval); + int handle = + (func[fmt]) ? func[fmt](ptr, length, loopstart, loopend, pitchoffset, vol, left, right, priority, callbackval) : -1; if (handle <= MV_Ok) { @@ -259,17 +177,15 @@ int32_t FX_PlayLooped(char *ptr, uint32_t length, int32_t loopstart, int32_t loo int32_t FX_Play3D(char *ptr, uint32_t length, int32_t loophow, int32_t pitchoffset, int32_t angle, int32_t distance, int32_t priority, uint32_t callbackval) { - int32_t handle = -1; - EDUKE32_STATIC_ASSERT(FMT_MAX == 7); static int32_t (*const func[FMT_MAX])(char *, uint32_t, int32_t, int32_t, int32_t, int32_t, int32_t, uint32_t) = { NULL, NULL, MV_PlayVOC3D, MV_PlayWAV3D, MV_PlayVorbis3D, MV_PlayFLAC3D, MV_PlayXA3D }; - wavefmt_t const fmt = FX_AutoDetectFormat(ptr, length); + wavefmt_t const fmt = FX_DetectFormat(ptr, length); - if (func[fmt]) - handle = func[fmt](ptr, length, loophow, pitchoffset, angle, distance, priority, callbackval); + int handle = + (func[fmt]) ? func[fmt](ptr, length, loophow, pitchoffset, angle, distance, priority, callbackval) : -1; if (handle <= MV_Ok) { diff --git a/polymer/eduke32/source/jaudiolib/src/multivoc.c b/polymer/eduke32/source/jaudiolib/src/multivoc.c index a1aaa04c7..d57dc060d 100644 --- a/polymer/eduke32/source/jaudiolib/src/multivoc.c +++ b/polymer/eduke32/source/jaudiolib/src/multivoc.c @@ -43,8 +43,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "pitch.h" #include "multivoc.h" #include "_multivc.h" +#include "fx_man.h" -static void MV_Mix(VoiceNode *voice, int32_t buffer); static void MV_StopVoice(VoiceNode *voice); static void MV_ServiceVoc(void); @@ -52,8 +52,6 @@ static VoiceNode *MV_GetVoice(int32_t handle); static const int16_t *MV_GetVolumeTable(int32_t vol); -static void MV_CalcPanTable(void); - #define IS_QUIET(ptr) ((void const *)(ptr) == (void *)&MV_VolumeTable[0]) static int32_t MV_ReverbLevel; @@ -103,13 +101,13 @@ int32_t MV_ErrorCode = MV_NotInstalled; static int32_t lockdepth = 0; -static inline void DisableInterrupts(void) +FORCE_INLINE void DisableInterrupts(void) { if (lockdepth++ <= 0) SoundDriver_Lock(); } -static inline void RestoreInterrupts(void) +FORCE_INLINE void RestoreInterrupts(void) { if (--lockdepth <= 0) SoundDriver_Unlock(); @@ -133,22 +131,14 @@ const char *MV_ErrorString(int32_t ErrorNumber) return "Out of memory in Multivoc."; case MV_VoiceNotFound: return "No voice with matching handle found."; - case MV_InvalidVOCFile: - return "Invalid VOC file passed in to Multivoc."; - case MV_InvalidWAVFile: - return "Invalid WAV file passed in to Multivoc."; - case MV_InvalidVorbisFile: - return "Invalid OggVorbis file passed in to Multivoc."; - case MV_InvalidFLACFile: - return "Invalid FLAC file passed in to Multivoc."; - case MV_InvalidXAFile: - return "Invalid XA file passed in to Multivoc."; + case MV_InvalidFile: + return "Invalid file passed in to Multivoc."; default: return "Unknown Multivoc error code."; } } -static void MV_Mix(VoiceNode *voice, int32_t buffer) +static void MV_Mix(VoiceNode *voice, int const buffer) { /* cheap fix for a crash under 64-bit linux */ /* v v v v */ @@ -169,11 +159,11 @@ static void MV_Mix(VoiceNode *voice, int32_t buffer) } // Add this voice to the mix - while (length > 0) + do { const char *start = voice->sound; - uint32_t rate = voice->RateScale; - uint32_t position = voice->position; + uint32_t const rate = voice->RateScale; + uint32_t const position = voice->position; int32_t voclength; // Check if the last sample in this buffer would be @@ -210,7 +200,7 @@ static void MV_Mix(VoiceNode *voice, int32_t buffer) FixedPointBufferSize = voice->RateScale * (length - voice->channels); } } - } + } while (length > 0); } void MV_PlayVoice(VoiceNode *voice) @@ -297,11 +287,12 @@ static void MV_ServiceVoc(void) // Play any waiting voices //DisableInterrupts(); - VoiceNode *voice; - if (!VoiceList.next || (voice = VoiceList.next) == &VoiceList) + if (!VoiceList.next || VoiceList.next == &VoiceList) return; + VoiceNode *voice = VoiceList.next; + int iter = 0; VoiceNode *next; @@ -835,9 +826,7 @@ static void MV_StopPlayback(void) // Make sure all callbacks are done. DisableInterrupts(); - VoiceNode *voice, *next; - - for (voice = VoiceList.next; voice != &VoiceList; voice = next) + for (VoiceNode *voice = VoiceList.next, *next; voice != &VoiceList; voice = next) { next = voice->next; @@ -929,16 +918,13 @@ int32_t MV_Init(int32_t soundcard, int32_t MixRate, int32_t Voices, int32_t numc MV_Voices = (VoiceNode *)ptr; ptr += Voices * sizeof(VoiceNode); - // Set number of voices before calculating volume table MV_MaxVoices = Voices; LL_Reset((VoiceNode*) &VoiceList, next, prev); LL_Reset((VoiceNode*) &VoicePool, next, prev); for (int index = 0; index < Voices; index++) - { LL_Add((VoiceNode*) &VoicePool, &MV_Voices[ index ], next, prev); - } MV_SetReverseStereo(FALSE); diff --git a/polymer/eduke32/source/jaudiolib/src/vorbis.c b/polymer/eduke32/source/jaudiolib/src/vorbis.c index fd10f3af9..c7f946a0e 100644 --- a/polymer/eduke32/source/jaudiolib/src/vorbis.c +++ b/polymer/eduke32/source/jaudiolib/src/vorbis.c @@ -381,7 +381,7 @@ int32_t MV_PlayVorbis(char *ptr, uint32_t ptrlength, int32_t loopstart, int32_t if (!vd) { - MV_SetErrorCode(MV_InvalidVorbisFile); + MV_SetErrorCode(MV_InvalidFile); return MV_Error; } @@ -395,7 +395,7 @@ int32_t MV_PlayVorbis(char *ptr, uint32_t ptrlength, int32_t loopstart, int32_t if (status < 0) { MV_Printf("MV_PlayVorbis: err %d\n", status); - MV_SetErrorCode(MV_InvalidVorbisFile); + MV_SetErrorCode(MV_InvalidFile); return MV_Error; } @@ -405,7 +405,7 @@ int32_t MV_PlayVorbis(char *ptr, uint32_t ptrlength, int32_t loopstart, int32_t { ov_clear(&vd->vf); free(vd); - MV_SetErrorCode(MV_InvalidVorbisFile); + MV_SetErrorCode(MV_InvalidFile); return MV_Error; } @@ -413,7 +413,7 @@ int32_t MV_PlayVorbis(char *ptr, uint32_t ptrlength, int32_t loopstart, int32_t { ov_clear(&vd->vf); free(vd); - MV_SetErrorCode(MV_InvalidVorbisFile); + MV_SetErrorCode(MV_InvalidFile); return MV_Error; } diff --git a/polymer/eduke32/source/jaudiolib/src/xa.c b/polymer/eduke32/source/jaudiolib/src/xa.c index 13df0bcff..ad4c8d7cc 100644 --- a/polymer/eduke32/source/jaudiolib/src/xa.c +++ b/polymer/eduke32/source/jaudiolib/src/xa.c @@ -460,7 +460,7 @@ int32_t MV_PlayXA xad = (xa_data *) calloc( 1, sizeof(xa_data) ); if (!xad) { - MV_SetErrorCode( MV_InvalidXAFile ); + MV_SetErrorCode( MV_InvalidFile ); return MV_Error; } diff --git a/polymer/eduke32/source/sounds.c b/polymer/eduke32/source/sounds.c index 593aa19ac..1123c641e 100644 --- a/polymer/eduke32/source/sounds.c +++ b/polymer/eduke32/source/sounds.c @@ -53,7 +53,7 @@ void S_SoundStartup(void) initprintf("Initializing sound... "); - if (FX_Init(ASS_AutoDetect, ud.config.NumVoices, ud.config.NumChannels, ud.config.MixRate, initdata) != FX_Ok) + if (FX_Init(ud.config.NumVoices, ud.config.NumChannels, ud.config.MixRate, initdata) != FX_Ok) { initprintf("failed! %s\n", FX_ErrorString(FX_Error)); return; @@ -235,7 +235,7 @@ int32_t S_PlayMusic(const char *fn) else { int32_t const mvol = MASTER_VOLUME(ud.config.MusicVolume); - MusicVoice = FX_PlayLooped(MusicPtr, MusicLen, 0, 0, + MusicVoice = FX_Play(MusicPtr, MusicLen, 0, 0, 0, mvol, mvol, mvol, FX_MUSIC_PRIORITY, MUSIC_ID); if (MusicVoice > FX_Ok) @@ -630,7 +630,7 @@ int32_t S_PlaySound3D(int32_t num, int32_t i, const vec3_t *pos) if (repeatp && !ambsfxp) { - voice = FX_PlayLooped(g_sounds[num].ptr, g_sounds[num].soundsiz, 0, -1, + voice = FX_Play(g_sounds[num].ptr, g_sounds[num].soundsiz, 0, -1, pitch, FX_VOLUME(sndist>>6), FX_VOLUME(sndist>>6), 0, // XXX: why is 'right' 0? g_sounds[num].pr, (num * MAXSOUNDINSTANCES) + j); } @@ -703,7 +703,7 @@ int32_t S_PlaySound(int32_t num) } if (g_sounds[num].m & SF_LOOP) - voice = FX_PlayLooped(g_sounds[num].ptr, g_sounds[num].soundsiz, 0, -1, + voice = FX_Play(g_sounds[num].ptr, g_sounds[num].soundsiz, 0, -1, pitch,FX_VOLUME(LOUDESTVOLUME), FX_VOLUME(LOUDESTVOLUME), FX_VOLUME(LOUDESTVOLUME), g_sounds[num].soundsiz, (num * MAXSOUNDINSTANCES) + j); else diff --git a/polymer/eduke32/source/sounds_mapster32.c b/polymer/eduke32/source/sounds_mapster32.c index cdbe3c7ae..4ba7bb211 100644 --- a/polymer/eduke32/source/sounds_mapster32.c +++ b/polymer/eduke32/source/sounds_mapster32.c @@ -73,19 +73,16 @@ void S_Callback(uint32_t); int32_t S_SoundStartup(void) { int32_t status; - int32_t fxdevicetype; void *initdata = 0; // TODO: read config int32_t FXVolume=220, /*NumVoices=32,*/ NumChannels=2, ReverseStereo=0; - fxdevicetype = ASS_AutoDetect; - #ifdef MIXERTYPEWIN initdata = (void *) win_gethwnd(); // used for DirectSound #endif - status = FX_Init(fxdevicetype, NumVoices, NumChannels, MixRate, initdata); + status = FX_Init(NumVoices, NumChannels, MixRate, initdata); if (status == FX_Ok) { FX_SetVolume(FXVolume); @@ -260,7 +257,7 @@ int32_t S_PlaySound3D(int32_t num, int32_t i, const vec3_t *pos) if (g_sounds[num].num > 0) return -1; - voice = FX_PlayLooped(g_sounds[num].ptr, g_sounds[num].soundsiz, 0, -1, + voice = FX_Play(g_sounds[num].ptr, g_sounds[num].soundsiz, 0, -1, pitch, sndist>>6, sndist>>6, 0, g_sounds[num].pr, num); } else @@ -319,7 +316,7 @@ void S_PlaySound(int32_t num) if (g_sounds[num].m & SF_LOOP) { - voice = FX_PlayLooped(g_sounds[num].ptr, g_sounds[num].soundsiz, 0, -1, + voice = FX_Play(g_sounds[num].ptr, g_sounds[num].soundsiz, 0, -1, pitch,LOUDESTVOLUME,LOUDESTVOLUME,LOUDESTVOLUME,g_sounds[num].soundsiz,num); } else