diff options
author | Robert Göffringmann | 2005-12-05 05:02:43 +0000 |
---|---|---|
committer | Robert Göffringmann | 2005-12-05 05:02:43 +0000 |
commit | e59eed409e40db61ec158218738713d453ffeef2 (patch) | |
tree | c6f5102c0d5efb2a2c6800394a2cf3769a45fff5 /sky/music | |
parent | 858cfbdd0762e2e93f1ba5669b59921a209ca064 (diff) | |
download | scummvm-rg350-e59eed409e40db61ec158218738713d453ffeef2.tar.gz scummvm-rg350-e59eed409e40db61ec158218738713d453ffeef2.tar.bz2 scummvm-rg350-e59eed409e40db61ec158218738713d453ffeef2.zip |
some cleanup, engine returns to the launcher now instead of calling OSystem::quit.
I suppose it leaks memory though...
svn-id: r19743
Diffstat (limited to 'sky/music')
-rw-r--r-- | sky/music/adlibchannel.cpp | 2 | ||||
-rw-r--r-- | sky/music/adlibmusic.cpp | 10 | ||||
-rw-r--r-- | sky/music/adlibmusic.h | 1 | ||||
-rw-r--r-- | sky/music/gmmusic.cpp | 5 | ||||
-rw-r--r-- | sky/music/gmmusic.h | 1 | ||||
-rw-r--r-- | sky/music/musicbase.cpp | 43 | ||||
-rw-r--r-- | sky/music/musicbase.h | 12 |
7 files changed, 7 insertions, 67 deletions
diff --git a/sky/music/adlibchannel.cpp b/sky/music/adlibchannel.cpp index c0cba9508f..7705f66e70 100644 --- a/sky/music/adlibchannel.cpp +++ b/sky/music/adlibchannel.cpp @@ -84,7 +84,7 @@ bool AdlibChannel::isActive(void) { void AdlibChannel::updateVolume(uint16 pVolume) { - _musicVolume = pVolume; + _musicVolume = pVolume * 3; } /* This class uses the same area for the register mirror as the original diff --git a/sky/music/adlibmusic.cpp b/sky/music/adlibmusic.cpp index c308791f22..cfa608c4e6 100644 --- a/sky/music/adlibmusic.cpp +++ b/sky/music/adlibmusic.cpp @@ -41,14 +41,6 @@ AdlibMusic::AdlibMusic(Audio::Mixer *pMixer, Disk *pDisk) AdlibMusic::~AdlibMusic(void) { _mixer->setupPremix(0); -// YM3812Shutdown(); -} - -void AdlibMusic::setVolume(uint8 volume) { - - _musicVolume = volume; - for (uint8 cnt = 0; cnt < _numberOfChannels; cnt++) - _channels[cnt]->updateVolume(volume | 128); } void AdlibMusic::premixerCall(int16 *data, uint len) { @@ -111,7 +103,7 @@ void AdlibMusic::setupChannels(uint8 *channelData) { for (uint8 cnt = 0; cnt < _numberOfChannels; cnt++) { uint16 chDataStart = ((channelData[(cnt << 1) | 1] << 8) | channelData[cnt << 1]) + _musicDataLoc; _channels[cnt] = new AdlibChannel(_opl, _musicData, chDataStart); - _channels[cnt]->updateVolume(_musicVolume | 128); + _channels[cnt]->updateVolume(_musicVolume); } } diff --git a/sky/music/adlibmusic.h b/sky/music/adlibmusic.h index db6685b3d0..307e5e7e35 100644 --- a/sky/music/adlibmusic.h +++ b/sky/music/adlibmusic.h @@ -36,7 +36,6 @@ class AdlibMusic : public AudioStream, public MusicBase { public: AdlibMusic(Audio::Mixer *pMixer, Disk *pDisk); ~AdlibMusic(void); - virtual void setVolume(uint8 volume); // AudioStream API int readBuffer(int16 *buffer, const int numSamples) { diff --git a/sky/music/gmmusic.cpp b/sky/music/gmmusic.cpp index 56a25728df..94b1247300 100644 --- a/sky/music/gmmusic.cpp +++ b/sky/music/gmmusic.cpp @@ -58,11 +58,6 @@ GmMusic::~GmMusic(void) { delete _midiDrv; } -void GmMusic::setVolume(uint8 volume) { - - setFMVolume(volume); -} - void GmMusic::timerCall(void) { _timerCount += _midiDrv->getBaseTempo(); if (_timerCount > (1000000 / 50)) { diff --git a/sky/music/gmmusic.h b/sky/music/gmmusic.h index 3d23141ac0..9acd1f135f 100644 --- a/sky/music/gmmusic.h +++ b/sky/music/gmmusic.h @@ -32,7 +32,6 @@ class GmMusic : public MusicBase { public: GmMusic(MidiDriver *pMidiDrv, Disk *pDisk); ~GmMusic(void); - virtual void setVolume(uint8 volume); private: static void passTimerFunc(void *param); void timerCall(void); diff --git a/sky/music/musicbase.cpp b/sky/music/musicbase.cpp index 209a46d263..66995d674a 100644 --- a/sky/music/musicbase.cpp +++ b/sky/music/musicbase.cpp @@ -37,6 +37,7 @@ MusicBase::MusicBase(Disk *pDisk) { MusicBase::~MusicBase(void) { + stopMusic(); if (_musicData) free(_musicData); } @@ -71,47 +72,7 @@ bool MusicBase::musicIsPlaying(void) { return false; } -void MusicBase::musicCommand(uint16 command) { - - if (_musicData == NULL) { - debug(1,"Got music command but driver is not yet loaded"); - return ; - } - if ((command >> 8) > _allowedCommands) { - debug(1,"got musicCommand %d while expecting <= %d", command >> 8, _allowedCommands); - return ; - } - switch(command >> 8) { - case 0: - debug(1,"Music: got call to startAdlibDriver(). Not necessary in this implementation."); - break; - case 1: - debug(1,"Music: got call to stopDriver(). Not necessary in this implementation."); - break; - case 2: - debug(1,"Music: got call to SetTempo(). Tempo is fixed in this implementation."); - break; - case 3: - debug(1,"Music: ignored direct call to driverPoll()."); - break; - case 4: - startMusic(command & 0xFF); - break; - case 6: - reinitFM(); - break; - case 7: - stopMusic(); - break; - case 13: - setFMVolume(command & 0xFF); - break; - default: - debug(1,"musicCommand %d ignored.",command >> 8); - } -} - -void MusicBase::setFMVolume(uint16 param) { +void MusicBase::setVolume(uint16 param) { _musicVolume = param; for (uint8 cnt = 0; cnt < _numberOfChannels; cnt++) diff --git a/sky/music/musicbase.h b/sky/music/musicbase.h index 9a73844bc0..bf5f8e326b 100644 --- a/sky/music/musicbase.h +++ b/sky/music/musicbase.h @@ -52,13 +52,12 @@ public: MusicBase(Disk *pDisk); virtual ~MusicBase(void); void loadSection(uint8 pSection); - void musicCommand(uint16 command); void startMusic(uint16 param) { _onNextPoll.musicToProcess = param & 0xF; }; // 4 void stopMusic(); // 7 bool musicIsPlaying(void); - virtual void setVolume(uint8 volume) = 0; uint8 giveVolume(void) { return (uint8)_musicVolume; }; uint8 giveCurrentMusic(void) { return _currentMusic; }; + void setVolume(uint16 param); protected: @@ -80,16 +79,11 @@ protected: virtual void setupPointers(void) = 0; virtual void setupChannels(uint8 *channelData) = 0; + virtual void startDriver(void) = 0; void updateTempo(void); void loadNewMusic(void); - //- functions from CommandTable @0x90 (the main interface) - virtual void startDriver(void) = 0; // 0 - void StopDriver(void); // 1 - void setTempo(uint16 newTempo); // 2 - void pollMusic(); // 3 - void reinitFM(void) { _onNextPoll.doReInit = true; }; // 6 - void setFMVolume(uint16 param); // 13 + void pollMusic(void); }; } // End of namespace Sky |