diff --git a/src/game/intro.cpp b/src/game/intro.cpp index babcee46f..49ebd15c2 100644 --- a/src/game/intro.cpp +++ b/src/game/intro.cpp @@ -538,7 +538,10 @@ global void ShowIntro(const Intro *intro) CallbackMusicOn(); StopMusic(); // FIXME: should this be GameMusic? - PlayMusic(MenuMusic); + if (CDMode == "off") + { + PlayMusic(MenuMusic); + } } /** diff --git a/src/include/sound.h b/src/include/sound.h index cc6d97287..855470753 100644 --- a/src/include/sound.h +++ b/src/include/sound.h @@ -123,6 +123,8 @@ extern void PlayMusic(const char* name); /// Stop music playing extern void StopMusic(void); +extern int PlayCDRom(const char* name); + /// Turn music stopped callback on #define CallbackMusicOn() \ CallbackMusic=1; diff --git a/src/sound/music.cpp b/src/sound/music.cpp index 1bb175dae..327b27137 100644 --- a/src/sound/music.cpp +++ b/src/sound/music.cpp @@ -64,8 +64,8 @@ global Sample* MusicSample; /// Music samples #endif -#if defined(USE_SDLCD) || defined(USE_LIBCDA) || defined(USE_CDDA) global char *CDMode = ":off"; /// cd play mode, ":off" ":random" or ":all" +#if defined(USE_SDLCD) || defined(USE_LIBCDA) || defined(USE_CDDA) global int CDTrack = 0; /// Current cd track #endif @@ -74,7 +74,6 @@ global SDL_CD *CDRom; /// SDL cdrom device #elif defined(USE_LIBCDA) global int NumCDTracks; /// Number of tracks on the cd #elif defined(USE_CDDA) -// FIXME: fill up global int NumCDTracks; global int CDDrive; global struct cdrom_tochdr CDchdr; @@ -240,7 +239,7 @@ local Sample* LoadMod(const char* name,int flags __attribute__((unused))) ** ** @return True if name is handled by the cdrom module. */ -local int PlayCDRom(const char* name) +global int PlayCDRom(const char* name) { // Old mode off, starting cdrom play. if (!strcmp(CDMode, ":off")) { @@ -294,7 +293,7 @@ local int PlayCDRom(const char* name) ** ** @return True if name is handled by the cdrom module. */ -local int PlayCDRom(const char* name) +global int PlayCDRom(const char* name) { int i; int data_cd; @@ -441,6 +440,7 @@ global void PlayMusic(const char* name) Sample* sample; #endif +/* #if defined(USE_SDLCD) || defined(USE_LIBCDA) || defined(USE_CDDA) if (PlayCDRom(name)) { return; @@ -449,6 +449,7 @@ global void PlayMusic(const char* name) return; } #endif +*/ if (MusicOff) { return; diff --git a/src/sound/script_sound.cpp b/src/sound/script_sound.cpp index 5641cfc63..752796cbf 100644 --- a/src/sound/script_sound.cpp +++ b/src/sound/script_sound.cpp @@ -379,7 +379,7 @@ local SCM CclSetCdMode(SCM mode) char *str; if ( !gh_null_p(mode) ) { - PlayMusic(str = gh_scm2newstr(mode,NULL)); + PlayCDRom(str = gh_scm2newstr(mode,NULL)); free(str); } #endif diff --git a/src/sound/sound_server.cpp b/src/sound/sound_server.cpp index 76fc9a4d8..677dbdcf9 100644 --- a/src/sound/sound_server.cpp +++ b/src/sound/sound_server.cpp @@ -1200,7 +1200,7 @@ global int InitSound(void) DebugLevel0Fn("FIXME: must write non GLIB hash functions\n"); #endif - if( TitleMusic ) { + if( TitleMusic && (CDMode == "off") ) { PlayMusic(TitleMusic); } diff --git a/src/stratagus/stratagus.cpp b/src/stratagus/stratagus.cpp index 6a76be45a..2562a6928 100644 --- a/src/stratagus/stratagus.cpp +++ b/src/stratagus/stratagus.cpp @@ -1073,7 +1073,9 @@ global void MenuLoop(char* filename, WorldMap* map) NetPlayers = 0; // Start new music for menus? // FIXME: If second loop? - if( !PlayingMusic && strcmp(TitleMusic,MenuMusic) ) { + + if( !PlayingMusic && strcmp(TitleMusic,MenuMusic) + && (CDMode == "off") ) { PlayMusic(MenuMusic); } EnableRedraw=RedrawMenu; diff --git a/src/ui/menus.cpp b/src/ui/menus.cpp index e04f8c9ef..2790bec9e 100644 --- a/src/ui/menus.cpp +++ b/src/ui/menus.cpp @@ -1797,7 +1797,7 @@ local void SetCdPower(Menuitem *mi __attribute__((unused))) #ifdef USE_WIN32 SDL_CDResume(CDRom); #endif - PlayMusic(":random"); + PlayCDRom(":random"); } else { // Stop Playing CD SDL_CDPause(CDRom); @@ -1809,7 +1809,7 @@ local void SetCdPower(Menuitem *mi __attribute__((unused))) #elif defined(USE_LIBCDA) // Start Playing CD if (!strcmp(":off", CDMode) || !strcmp(":stopped", CDMode)) { - PlayMusic(":random"); + PlayCDRom(":random"); } else { // Stop Playing CD cd_pause(); @@ -1818,7 +1818,7 @@ local void SetCdPower(Menuitem *mi __attribute__((unused))) #elif defined(USE_CDDA) // Start Playing CD if (!strcmp(":off", CDMode) || !strcmp(":stopped", CDMode)) { - PlayMusic(":random"); + PlayCDRom(":random"); } else { // Stop Playing CD StopMusic();