diff --git a/polymer/eduke32/source/sw/src/config.c b/polymer/eduke32/source/sw/src/config.c index 3c36c7bfe..88e0a26f6 100644 --- a/polymer/eduke32/source/sw/src/config.c +++ b/polymer/eduke32/source/sw/src/config.c @@ -551,7 +551,7 @@ int32_t CONFIG_ReadSetup(void) extern char ds[]; extern char PlayerNameArg[32]; - char oggtrackname[MAXOGGTRACKLENGTH] = {0}; + char waveformtrackname[MAXWAVEFORMTRACKLENGTH] = {0}; CONTROL_ClearAssignments(); CONFIG_SetDefaults(); @@ -590,9 +590,9 @@ int32_t CONFIG_ReadSetup(void) gs.FlipStereo = dummy; if (gs.FlipStereo) gs.FlipStereo = 1; - SCRIPT_GetString(scripthandle, "Sound Setup", "OggTrackName", oggtrackname); - if (oggtrackname[0] != '\0') - memcpy(gs.OggTrackName, oggtrackname, MAXOGGTRACKLENGTH); + SCRIPT_GetString(scripthandle, "Sound Setup", "WaveformTrackName", waveformtrackname); + if (waveformtrackname[0] != '\0') + memcpy(gs.WaveformTrackName, waveformtrackname, MAXWAVEFORMTRACKLENGTH); SCRIPT_GetNumber(scripthandle, "Setup", "ForceSetup",&ForceSetup); SCRIPT_GetNumber(scripthandle, "Controls","UseMouse",&UseMouse); @@ -652,7 +652,7 @@ void CONFIG_WriteSetup(void) SCRIPT_PutNumber(scripthandle, "Sound Setup", "MusicVolume",gs.MusicVolume,FALSE,FALSE); dummy = gs.FlipStereo; SCRIPT_PutNumber(scripthandle, "Sound Setup", "ReverseStereo",dummy,FALSE,FALSE); - SCRIPT_PutString(scripthandle, "Sound Setup", "OggTrackName", gs.OggTrackName); + SCRIPT_PutString(scripthandle, "Sound Setup", "WaveformTrackName", gs.WaveformTrackName); SCRIPT_PutNumber(scripthandle, "Setup", "ForceSetup",ForceSetup,FALSE,FALSE); SCRIPT_PutNumber(scripthandle, "Controls","UseMouse",UseMouse,FALSE,FALSE); diff --git a/polymer/eduke32/source/sw/src/game.c b/polymer/eduke32/source/sw/src/game.c index 2161ccd12..12fae548e 100644 --- a/polymer/eduke32/source/sw/src/game.c +++ b/polymer/eduke32/source/sw/src/game.c @@ -221,7 +221,7 @@ const GAME_SET gs_defaults = FALSE, // stats FALSE, // mouse aiming on FALSE, // play cd - "track??.ogg", // ogg track name + "Track??", // waveform track name }; GAME_SET gs; @@ -2681,8 +2681,6 @@ void EndGameSequence(void) { if (Level == 4 || Level == 20) { - //CDAudio_Stop(); - //CDAudio_Play(2,TRUE); // Play theme after game ends Level=0; } else diff --git a/polymer/eduke32/source/sw/src/game.h b/polymer/eduke32/source/sw/src/game.h index e5f16d5e8..07cfa5b6e 100644 --- a/polymer/eduke32/source/sw/src/game.h +++ b/polymer/eduke32/source/sw/src/game.h @@ -898,23 +898,6 @@ SWBOOL CON_AddCommand(const char *command, void (*function)(void)); void CON_ProcessUserCommand(void); void CON_InitConsole(void); -/////////////////////////////////////////////////////////////////////////////////////////// -// -// CD - RedBook Audio -// -/////////////////////////////////////////////////////////////////////////////////////////// - -void CDAudio_Eject(void); -uint8_t CDAudio_GetVolume(void); -void CDAudio_SetVolume(uint8_t volume); -void CDAudio_Play(uint8_t track, SWBOOL looping); -void CDAudio_Stop(void); -void CDAudio_Resume(void); -void CDAudio_Update(void); -SWBOOL CDAudio_Playing(void); -int CDAudio_Init(void); -void CDAudio_Shutdown(void); - /////////////////////////////////////////////////////////////////////////////////////////// // // Weapon diff --git a/polymer/eduke32/source/sw/src/gamedefs.h b/polymer/eduke32/source/sw/src/gamedefs.h index c7ff21b67..206bd582a 100644 --- a/polymer/eduke32/source/sw/src/gamedefs.h +++ b/polymer/eduke32/source/sw/src/gamedefs.h @@ -70,8 +70,8 @@ extern "C" { //#define MAXEXTERNALBUTTONS 6 -// max path+track length for OGG music files -#define MAXOGGTRACKLENGTH 256 +// max path+track length for waveform music files +#define MAXWAVEFORMTRACKLENGTH 256 // // modem string defines diff --git a/polymer/eduke32/source/sw/src/settings.h b/polymer/eduke32/source/sw/src/settings.h index 590ba6b55..43ccc2f3b 100644 --- a/polymer/eduke32/source/sw/src/settings.h +++ b/polymer/eduke32/source/sw/src/settings.h @@ -1,4 +1,4 @@ -//------------------------------------------------------------------------- + //------------------------------------------------------------------------- /* Copyright (C) 1997, 2005 - 3D Realms Entertainment @@ -68,7 +68,7 @@ typedef struct SWBOOL Stats; SWBOOL MouseAimingOn; // whether it was on or off - NOT the type of mouse aiming SWBOOL PlayCD; - char OggTrackName[MAXOGGTRACKLENGTH]; + char WaveformTrackName[MAXWAVEFORMTRACKLENGTH]; } GAME_SET, *GAME_SETp; extern const GAME_SET gs_defaults; diff --git a/polymer/eduke32/source/sw/src/sounds.c b/polymer/eduke32/source/sw/src/sounds.c index af464c7a7..6fd290f7b 100644 --- a/polymer/eduke32/source/sw/src/sounds.c +++ b/polymer/eduke32/source/sw/src/sounds.c @@ -74,7 +74,6 @@ uint8_t RedBookSong[40] = SWBOOL Use_SoundSpriteNum = FALSE; int16_t SoundSpriteNum = -1; // Always set this back to -1 for proper validity checking! -SWBOOL CDInitialized = FALSE; SWBOOL MusicInitialized = FALSE; SWBOOL FxInitialized = FALSE; @@ -116,8 +115,7 @@ typedef enum { SongTypeNone, SongTypeMIDI, - SongTypeVoc, - SongTypeCDA + SongTypeWave, } SongType_t; char *SongPtr = NULL; @@ -422,11 +420,7 @@ PlaySong(char *song_file_name, int cdaudio_track, SWBOOL loop, SWBOOL restart) if (!restart) { - if (SongType == SongTypeCDA && cdaudio_track == SongTrack) - { - return TRUE; - } - else if (SongType == SongTypeVoc) + if (SongType == SongTypeWave) { if (SongTrack > 0 && SongTrack == cdaudio_track) { @@ -451,53 +445,47 @@ PlaySong(char *song_file_name, int cdaudio_track, SWBOOL loop, SWBOOL restart) if (!SW_SHAREWARE) { - if (CD_GetCurrentDriver() != ASS_NoSound && CDInitialized) - { - int status; - status = CD_Play(cdaudio_track, TRUE); - if (status == CD_Ok) - { - SongType = SongTypeCDA; - SongTrack = cdaudio_track; - return TRUE; - } - - buildprintf("CD play error: %s\n", CD_ErrorString(status)); - } - if (cdaudio_track >= 0) { - char oggtrack[MAXOGGTRACKLENGTH]; - memcpy(oggtrack, gs.OggTrackName, MAXOGGTRACKLENGTH); + char waveformtrack[MAXWAVEFORMTRACKLENGTH]; + Bstrncpy(waveformtrack, gs.WaveformTrackName, MAXWAVEFORMTRACKLENGTH - 1); - char *numPos = strstr(oggtrack, "??"); + char *numPos = Bstrstr(waveformtrack, "??"); - if (numPos && (numPos-oggtrack) < MAXOGGTRACKLENGTH - 1) + if (numPos && (numPos-waveformtrack) < MAXWAVEFORMTRACKLENGTH - 2) { + static const char *tracktypes[] = { ".flac", ".ogg" }; + const size_t tracknamebaselen = Bstrlen(waveformtrack); + size_t i; + numPos[0] = '0' + (cdaudio_track / 10) % 10; numPos[1] = '0' + cdaudio_track % 10; - if (LoadSong(oggtrack)) + for (i = 0; i < ARRAY_SIZE(tracktypes); ++i) { - SongVoice = FX_PlayLoopedAuto(SongPtr, SongLength, 0, 0, 0, - 255, 255, 255, FX_MUSIC_PRIORITY, MUSIC_ID); - if (SongVoice > FX_Ok) + waveformtrack[tracknamebaselen] = '\0'; + Bstrncat(waveformtrack, tracktypes[i], MAXWAVEFORMTRACKLENGTH); + + if (LoadSong(waveformtrack)) { - SongType = SongTypeVoc; - SongTrack = cdaudio_track; - SongName = strdup(oggtrack); - return TRUE; + SongVoice = FX_PlayLoopedAuto(SongPtr, SongLength, 0, 0, 0, + 255, 255, 255, FX_MUSIC_PRIORITY, MUSIC_ID); + if (SongVoice > FX_Ok) + { + SongType = SongTypeWave; + SongTrack = cdaudio_track; + SongName = Bstrdup(waveformtrack); + return TRUE; + } } } - else - { - buildprintf("Can't play OGG music track: %s\n", oggtrack); - } + + buildprintf("Can't find CD track %i!\n", cdaudio_track); } else { - buildprintf("Make sure to have \"??\" as a placeholder for the track number in your OggTrackName!\n"); - buildprintf(" e.g. OggTrackName = \"MUSIC/Track??.ogg\"\n"); + buildprintf("Make sure to have \"??\" as a placeholder for the track number in your WaveformTrackName!\n"); + buildprintf(" e.g. WaveformTrackName = \"MUSIC/Track??\"\n"); } } } @@ -520,7 +508,7 @@ PlaySong(char *song_file_name, int cdaudio_track, SWBOOL loop, SWBOOL restart) 255, 255, 255, FX_MUSIC_PRIORITY, MUSIC_ID); if (SongVoice > FX_Ok) { - SongType = SongTypeVoc; + SongType = SongTypeWave; SongName = strdup(song_file_name); return TRUE; } @@ -541,7 +529,7 @@ StopSong(void) if (DemoMode) return; - if (SongType == SongTypeVoc && SongVoice >= 0) + if (SongType == SongTypeWave && SongVoice >= 0) { FX_StopSound(SongVoice); } @@ -549,10 +537,6 @@ StopSong(void) { MUSIC_StopSong(); } - else if (SongType == SongTypeCDA) - { - CD_Stop(); - } SongType = SongTypeNone; if (SongName) @@ -575,14 +559,10 @@ PauseSong(SWBOOL pauseon) { if (!gs.MusicOn) return; - if (SongType == SongTypeVoc && SongVoice >= 0) + if (SongType == SongTypeWave && SongVoice >= 0) { FX_PauseSound(SongVoice, pauseon); } - else if (SongType == SongTypeCDA) - { - CD_Pause(pauseon); - } } void @@ -1308,17 +1288,6 @@ void MusicStartup(void) devicetype = MusicDevice - 1; } - status = CD_Init(devicetype); - - if (status != CD_Ok) - { - buildprintf("CD error: %s\n", CD_ErrorString(status)); - } - else - { - CDInitialized = TRUE; - } - status = MUSIC_Init(devicetype, 0); if (status == MUSIC_Ok) @@ -1354,9 +1323,6 @@ MusicShutdown(void) { int32_t status; - if (CDInitialized) - CD_Shutdown(); - // if they chose None lets return if (MusicDevice < 0) return;