aboutsummaryrefslogtreecommitdiff
path: root/sky/music
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/music
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/music')
-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
6 files changed, 26 insertions, 4 deletions
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; };