aboutsummaryrefslogtreecommitdiff
path: root/sky
diff options
context:
space:
mode:
authorRobert Göffringmann2003-07-07 16:40:27 +0000
committerRobert Göffringmann2003-07-07 16:40:27 +0000
commitb53435dfce518d81e1c4590e7afeb5442734554b (patch)
tree42968f3536e37cbe5fa88f3d3036d8c6bb55d24f /sky
parent2e35b6b3304f961f293b10ccf0a5617fe75b17fa (diff)
downloadscummvm-rg350-b53435dfce518d81e1c4590e7afeb5442734554b.tar.gz
scummvm-rg350-b53435dfce518d81e1c4590e7afeb5442734554b.tar.bz2
scummvm-rg350-b53435dfce518d81e1c4590e7afeb5442734554b.zip
applied patch #766751 (BASS: Waiting for floppy intro music to finish) and fixed music bug (jukebox at St. James didn't stop playing)
svn-id: r8843
Diffstat (limited to 'sky')
-rw-r--r--sky/intro.cpp15
-rw-r--r--sky/music/adlibchannel.cpp5
-rw-r--r--sky/music/adlibchannel.h1
-rw-r--r--sky/music/gmchannel.cpp5
-rw-r--r--sky/music/gmchannel.h1
-rw-r--r--sky/music/musicbase.cpp16
-rw-r--r--sky/music/musicbase.h2
7 files changed, 40 insertions, 5 deletions
diff --git a/sky/intro.cpp b/sky/intro.cpp
index 93b2f5a26b..8bc8dcb4dc 100644
--- a/sky/intro.cpp
+++ b/sky/intro.cpp
@@ -32,6 +32,7 @@
_mixer->stopAll();
#define CHECK_ESC if (_key_pressed == 27) { _skyScreen->stopSequence(); REMOVE_INTRO return false; }
#define WAIT_SEQUENCE while (_skyScreen->sequenceRunning()) { checkCommands(commandPtr); delay(50); CHECK_ESC }
+#define WAIT_MUSIC while (_skyMusic->musicIsPlaying()) { delay(50); CHECK_ESC }
#define INTRO_TEXT_WIDTH 128
@@ -348,10 +349,22 @@ bool SkyState::intro(void) {
commandPtr = (uint32 *)anim5Commands;
- WAIT_SEQUENCE;
_skyDisk->prefetchFile(FN_6_PAL);
_skyDisk->prefetchFile(FN_6_LOG);
_skyDisk->prefetchFile(FN_6A);
+
+ WAIT_SEQUENCE;
+
+ // There is no synchronization mechanism between the music and
+ // the graphics. Which means that there is no guarantee that
+ // they both end at the same time. So just to be safe, wait
+ // for the music to stop before continuing with the final part.
+ //
+ // This part of the intro looks pretty nice even as a static
+ // image, so it makes sense to do the waiting before fading
+ // down the palette.
+
+ WAIT_MUSIC;
_skyScreen->fnFadeDown(0);
_skyScreen->showScreen(FN_6_LOG);
diff --git a/sky/music/adlibchannel.cpp b/sky/music/adlibchannel.cpp
index a6922af634..6a320969d5 100644
--- a/sky/music/adlibchannel.cpp
+++ b/sky/music/adlibchannel.cpp
@@ -61,6 +61,11 @@ SkyAdlibChannel::SkyAdlibChannel(uint8 *pMusicData, uint16 startOfData)
_musicVolume = 0x100;
}
+bool SkyAdlibChannel::isActive(void) {
+
+ return _channelData.channelActive != 0;
+}
+
void SkyAdlibChannel::updateVolume(uint16 pVolume) {
_musicVolume = pVolume;
diff --git a/sky/music/adlibchannel.h b/sky/music/adlibchannel.h
index 586f92466a..8ca72e8a58 100644
--- a/sky/music/adlibchannel.h
+++ b/sky/music/adlibchannel.h
@@ -64,6 +64,7 @@ public:
virtual void stopNote(void);
virtual uint8 process(uint16 aktTime);
virtual void updateVolume(uint16 pVolume);
+ virtual bool isActive(void);
private:
uint8 *_musicData;
uint16 _musicVolume;
diff --git a/sky/music/gmchannel.cpp b/sky/music/gmchannel.cpp
index 5d09a75ecf..c47d07ba82 100644
--- a/sky/music/gmchannel.cpp
+++ b/sky/music/gmchannel.cpp
@@ -63,6 +63,11 @@ SkyGmChannel::SkyGmChannel(uint8 *pMusicData, uint16 startOfData, MidiDriver *pM
_musicVolume = 0x100;
}
+bool SkyGmChannel::isActive(void) {
+
+ return _channelData.channelActive != 0;
+}
+
void SkyGmChannel::updateVolume(uint16 pVolume) {
_musicVolume = pVolume;
diff --git a/sky/music/gmchannel.h b/sky/music/gmchannel.h
index 693eabf3d0..0ec0ed6a7c 100644
--- a/sky/music/gmchannel.h
+++ b/sky/music/gmchannel.h
@@ -42,6 +42,7 @@ public:
virtual void stopNote(void);
virtual uint8 process(uint16 aktTime);
virtual void updateVolume(uint16 pVolume);
+ virtual bool isActive(void);
private:
byte *_mt32_to_gm;
static uint8 _veloTab[128];
diff --git a/sky/music/musicbase.cpp b/sky/music/musicbase.cpp
index 733e948e50..327e216c3e 100644
--- a/sky/music/musicbase.cpp
+++ b/sky/music/musicbase.cpp
@@ -57,6 +57,14 @@ void SkyMusicBase::loadSection(uint8 pSection)
_system->unlock_mutex(_mutex);
}
+bool SkyMusicBase::musicIsPlaying(void)
+{
+ for (uint8 cnt = 0; cnt < _numberOfChannels; cnt++)
+ if (_channels[cnt]->isActive())
+ return true;
+ return false;
+}
+
void SkyMusicBase::musicCommand(uint16 command)
{
if (_musicData == NULL) {
@@ -128,10 +136,10 @@ void SkyMusicBase::loadNewMusic(void)
error("Music %d requested but doesn't exist in file.\n", _onNextPoll.musicToProcess);
return;
}
- if (_currentMusic != 0) stopMusic();
+ if (_currentMusic != 0)
+ stopMusic();
_currentMusic = _onNextPoll.musicToProcess;
- _onNextPoll.musicToProcess = 0;
if (_currentMusic != 0) {
musicPos = (_musicData[_musicDataLoc+2]<<8) | _musicData[_musicDataLoc+1];
@@ -153,8 +161,8 @@ void SkyMusicBase::pollMusic(void)
uint8 newTempo;
if (_onNextPoll.doReInit) startDriver();
if (_onNextPoll.doStopMusic) stopMusic();
- if (_onNextPoll.musicToProcess == _currentMusic) _onNextPoll.musicToProcess = 0;
- if (_onNextPoll.musicToProcess) loadNewMusic();
+ if (_onNextPoll.musicToProcess != _currentMusic)
+ loadNewMusic();
_aktTime += _tempo;
diff --git a/sky/music/musicbase.h b/sky/music/musicbase.h
index 418e13dfd2..db69647f5d 100644
--- a/sky/music/musicbase.h
+++ b/sky/music/musicbase.h
@@ -38,6 +38,7 @@ public:
virtual void stopNote(void) = 0;
virtual uint8 process(uint16 aktTime) = 0;
virtual void updateVolume(uint16 pVolume) = 0;
+ virtual bool isActive(void) = 0;
private:
};
@@ -48,6 +49,7 @@ public:
void loadSection(uint8 pSection);
void musicCommand(uint16 command);
void startMusic(uint16 param) { _onNextPoll.musicToProcess = param & 0xF; }; // 4
+ bool musicIsPlaying(void);
virtual void setVolume(uint8 volume) = 0;
uint8 giveVolume(void) { return (uint8)_musicVolume; };
uint8 giveCurrentMusic(void) { return _currentMusic; };