SW: Rip out nonexistent calls to AudioLib CD playback functions.

git-svn-id: https://svn.eduke32.com/eduke32@5212 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
hendricks266 2015-05-19 22:05:45 +00:00
parent 93d6d61180
commit 895e829411
6 changed files with 41 additions and 94 deletions

View file

@ -551,7 +551,7 @@ int32_t CONFIG_ReadSetup(void)
extern char ds[]; extern char ds[];
extern char PlayerNameArg[32]; extern char PlayerNameArg[32];
char oggtrackname[MAXOGGTRACKLENGTH] = {0}; char waveformtrackname[MAXWAVEFORMTRACKLENGTH] = {0};
CONTROL_ClearAssignments(); CONTROL_ClearAssignments();
CONFIG_SetDefaults(); CONFIG_SetDefaults();
@ -590,9 +590,9 @@ int32_t CONFIG_ReadSetup(void)
gs.FlipStereo = dummy; gs.FlipStereo = dummy;
if (gs.FlipStereo) gs.FlipStereo = 1; if (gs.FlipStereo) gs.FlipStereo = 1;
SCRIPT_GetString(scripthandle, "Sound Setup", "OggTrackName", oggtrackname); SCRIPT_GetString(scripthandle, "Sound Setup", "WaveformTrackName", waveformtrackname);
if (oggtrackname[0] != '\0') if (waveformtrackname[0] != '\0')
memcpy(gs.OggTrackName, oggtrackname, MAXOGGTRACKLENGTH); memcpy(gs.WaveformTrackName, waveformtrackname, MAXWAVEFORMTRACKLENGTH);
SCRIPT_GetNumber(scripthandle, "Setup", "ForceSetup",&ForceSetup); SCRIPT_GetNumber(scripthandle, "Setup", "ForceSetup",&ForceSetup);
SCRIPT_GetNumber(scripthandle, "Controls","UseMouse",&UseMouse); SCRIPT_GetNumber(scripthandle, "Controls","UseMouse",&UseMouse);
@ -652,7 +652,7 @@ void CONFIG_WriteSetup(void)
SCRIPT_PutNumber(scripthandle, "Sound Setup", "MusicVolume",gs.MusicVolume,FALSE,FALSE); SCRIPT_PutNumber(scripthandle, "Sound Setup", "MusicVolume",gs.MusicVolume,FALSE,FALSE);
dummy = gs.FlipStereo; dummy = gs.FlipStereo;
SCRIPT_PutNumber(scripthandle, "Sound Setup", "ReverseStereo",dummy,FALSE,FALSE); 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, "Setup", "ForceSetup",ForceSetup,FALSE,FALSE);
SCRIPT_PutNumber(scripthandle, "Controls","UseMouse",UseMouse,FALSE,FALSE); SCRIPT_PutNumber(scripthandle, "Controls","UseMouse",UseMouse,FALSE,FALSE);

View file

@ -221,7 +221,7 @@ const GAME_SET gs_defaults =
FALSE, // stats FALSE, // stats
FALSE, // mouse aiming on FALSE, // mouse aiming on
FALSE, // play cd FALSE, // play cd
"track??.ogg", // ogg track name "Track??", // waveform track name
}; };
GAME_SET gs; GAME_SET gs;
@ -2681,8 +2681,6 @@ void EndGameSequence(void)
{ {
if (Level == 4 || Level == 20) if (Level == 4 || Level == 20)
{ {
//CDAudio_Stop();
//CDAudio_Play(2,TRUE); // Play theme after game ends
Level=0; Level=0;
} }
else else

View file

@ -898,23 +898,6 @@ SWBOOL CON_AddCommand(const char *command, void (*function)(void));
void CON_ProcessUserCommand(void); void CON_ProcessUserCommand(void);
void CON_InitConsole(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 // Weapon

View file

@ -70,8 +70,8 @@ extern "C" {
//#define MAXEXTERNALBUTTONS 6 //#define MAXEXTERNALBUTTONS 6
// max path+track length for OGG music files // max path+track length for waveform music files
#define MAXOGGTRACKLENGTH 256 #define MAXWAVEFORMTRACKLENGTH 256
// //
// modem string defines // modem string defines

View file

@ -1,4 +1,4 @@
//------------------------------------------------------------------------- //-------------------------------------------------------------------------
/* /*
Copyright (C) 1997, 2005 - 3D Realms Entertainment Copyright (C) 1997, 2005 - 3D Realms Entertainment
@ -68,7 +68,7 @@ typedef struct
SWBOOL Stats; SWBOOL Stats;
SWBOOL MouseAimingOn; // whether it was on or off - NOT the type of mouse aiming SWBOOL MouseAimingOn; // whether it was on or off - NOT the type of mouse aiming
SWBOOL PlayCD; SWBOOL PlayCD;
char OggTrackName[MAXOGGTRACKLENGTH]; char WaveformTrackName[MAXWAVEFORMTRACKLENGTH];
} GAME_SET, *GAME_SETp; } GAME_SET, *GAME_SETp;
extern const GAME_SET gs_defaults; extern const GAME_SET gs_defaults;

View file

@ -74,7 +74,6 @@ uint8_t RedBookSong[40] =
SWBOOL Use_SoundSpriteNum = FALSE; SWBOOL Use_SoundSpriteNum = FALSE;
int16_t SoundSpriteNum = -1; // Always set this back to -1 for proper validity checking! int16_t SoundSpriteNum = -1; // Always set this back to -1 for proper validity checking!
SWBOOL CDInitialized = FALSE;
SWBOOL MusicInitialized = FALSE; SWBOOL MusicInitialized = FALSE;
SWBOOL FxInitialized = FALSE; SWBOOL FxInitialized = FALSE;
@ -116,8 +115,7 @@ typedef enum
{ {
SongTypeNone, SongTypeNone,
SongTypeMIDI, SongTypeMIDI,
SongTypeVoc, SongTypeWave,
SongTypeCDA
} SongType_t; } SongType_t;
char *SongPtr = NULL; char *SongPtr = NULL;
@ -422,11 +420,7 @@ PlaySong(char *song_file_name, int cdaudio_track, SWBOOL loop, SWBOOL restart)
if (!restart) if (!restart)
{ {
if (SongType == SongTypeCDA && cdaudio_track == SongTrack) if (SongType == SongTypeWave)
{
return TRUE;
}
else if (SongType == SongTypeVoc)
{ {
if (SongTrack > 0 && SongTrack == cdaudio_track) 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 (!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) if (cdaudio_track >= 0)
{ {
char oggtrack[MAXOGGTRACKLENGTH]; char waveformtrack[MAXWAVEFORMTRACKLENGTH];
memcpy(oggtrack, gs.OggTrackName, MAXOGGTRACKLENGTH); 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[0] = '0' + (cdaudio_track / 10) % 10;
numPos[1] = '0' + cdaudio_track % 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, waveformtrack[tracknamebaselen] = '\0';
255, 255, 255, FX_MUSIC_PRIORITY, MUSIC_ID); Bstrncat(waveformtrack, tracktypes[i], MAXWAVEFORMTRACKLENGTH);
if (SongVoice > FX_Ok)
if (LoadSong(waveformtrack))
{ {
SongType = SongTypeVoc; SongVoice = FX_PlayLoopedAuto(SongPtr, SongLength, 0, 0, 0,
SongTrack = cdaudio_track; 255, 255, 255, FX_MUSIC_PRIORITY, MUSIC_ID);
SongName = strdup(oggtrack); if (SongVoice > FX_Ok)
return TRUE; {
SongType = SongTypeWave;
SongTrack = cdaudio_track;
SongName = Bstrdup(waveformtrack);
return TRUE;
}
} }
} }
else
{ buildprintf("Can't find CD track %i!\n", cdaudio_track);
buildprintf("Can't play OGG music track: %s\n", oggtrack);
}
} }
else else
{ {
buildprintf("Make sure to have \"??\" as a placeholder for the track number in your OggTrackName!\n"); buildprintf("Make sure to have \"??\" as a placeholder for the track number in your WaveformTrackName!\n");
buildprintf(" e.g. OggTrackName = \"MUSIC/Track??.ogg\"\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); 255, 255, 255, FX_MUSIC_PRIORITY, MUSIC_ID);
if (SongVoice > FX_Ok) if (SongVoice > FX_Ok)
{ {
SongType = SongTypeVoc; SongType = SongTypeWave;
SongName = strdup(song_file_name); SongName = strdup(song_file_name);
return TRUE; return TRUE;
} }
@ -541,7 +529,7 @@ StopSong(void)
if (DemoMode) if (DemoMode)
return; return;
if (SongType == SongTypeVoc && SongVoice >= 0) if (SongType == SongTypeWave && SongVoice >= 0)
{ {
FX_StopSound(SongVoice); FX_StopSound(SongVoice);
} }
@ -549,10 +537,6 @@ StopSong(void)
{ {
MUSIC_StopSong(); MUSIC_StopSong();
} }
else if (SongType == SongTypeCDA)
{
CD_Stop();
}
SongType = SongTypeNone; SongType = SongTypeNone;
if (SongName) if (SongName)
@ -575,14 +559,10 @@ PauseSong(SWBOOL pauseon)
{ {
if (!gs.MusicOn) return; if (!gs.MusicOn) return;
if (SongType == SongTypeVoc && SongVoice >= 0) if (SongType == SongTypeWave && SongVoice >= 0)
{ {
FX_PauseSound(SongVoice, pauseon); FX_PauseSound(SongVoice, pauseon);
} }
else if (SongType == SongTypeCDA)
{
CD_Pause(pauseon);
}
} }
void void
@ -1308,17 +1288,6 @@ void MusicStartup(void)
devicetype = MusicDevice - 1; 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); status = MUSIC_Init(devicetype, 0);
if (status == MUSIC_Ok) if (status == MUSIC_Ok)
@ -1354,9 +1323,6 @@ MusicShutdown(void)
{ {
int32_t status; int32_t status;
if (CDInitialized)
CD_Shutdown();
// if they chose None lets return // if they chose None lets return
if (MusicDevice < 0) if (MusicDevice < 0)
return; return;