diff options
Diffstat (limited to 'sword2')
-rw-r--r-- | sword2/driver/d_sound.cpp | 15 | ||||
-rw-r--r-- | sword2/driver/d_sound.h | 2 |
2 files changed, 12 insertions, 5 deletions
diff --git a/sword2/driver/d_sound.cpp b/sword2/driver/d_sound.cpp index 04fc5b51ea..db45b18bec 100644 --- a/sword2/driver/d_sound.cpp +++ b/sword2/driver/d_sound.cpp @@ -72,16 +72,23 @@ Sound::Sound(Sword2Engine *vm) { _musicVol = 16; _musicMuted = false; - _converter = makeRateConverter(_music[0].getRate(), _vm->_mixer->getOutputRate(), _music[0].isStereo(), false); + for (int i = 0; i < MAXMUS; i++) + _music[i]._converter = makeRateConverter(_music[i].getRate(), _vm->_mixer->getOutputRate(), _music[i].isStereo(), false); _vm->_mixer->setupPremix(premix_proc, this); } Sound::~Sound() { + int i; + _vm->_mixer->setupPremix(0, 0); - delete _converter; - for (int i = 0; i < MAXFX; i++) + + for (i = 0; i < MAXMUS; i++) + delete _music[i]._converter; + + for (i = 0; i < MAXFX; i++) stopFxHandle(i); + if (_mutex) _vm->_system->deleteMutex(_mutex); } @@ -99,7 +106,7 @@ void Sound::streamMusic(int16 *data, uint len) { st_volume_t volume = _musicMuted ? 0 : _musicVolTable[_musicVol]; fpMus.seek(_music[i]._filePos, SEEK_SET); - _converter->flow(_music[i], data, len, volume, volume); + _music[i]._converter->flow(_music[i], data, len, volume, volume); } // DipMusic(); diff --git a/sword2/driver/d_sound.h b/sword2/driver/d_sound.h index 7efdf22479..bc1c487b39 100644 --- a/sword2/driver/d_sound.h +++ b/sword2/driver/d_sound.h @@ -49,6 +49,7 @@ struct FxHandle { class MusicHandle : public AudioStream { public: + RateConverter *_converter; bool _firstTime; bool _streaming; bool _paused; @@ -88,7 +89,6 @@ private: static int32 _musicVolTable[17]; MusicHandle _music[MAXMUS + 1]; char *savedMusicFilename; - RateConverter *_converter; bool _musicMuted; uint8 _musicVol; |