diff options
-rw-r--r-- | sword2/driver/d_sound.cpp | 30 | ||||
-rw-r--r-- | sword2/driver/d_sound.h | 3 |
2 files changed, 14 insertions, 19 deletions
diff --git a/sword2/driver/d_sound.cpp b/sword2/driver/d_sound.cpp index b5cf40d9c2..04fc5b51ea 100644 --- a/sword2/driver/d_sound.cpp +++ b/sword2/driver/d_sound.cpp @@ -49,7 +49,7 @@ static File fpMus; #define GetCompressedAmplitude(n) ((n) & 7) static void premix_proc(void *param, int16 *data, uint len) { - ((Sound *) param)->fxServer(data, len); + ((Sound *) param)->streamMusic(data, len); } Sound::Sound(Sword2Engine *vm) { @@ -86,13 +86,23 @@ Sound::~Sound() { _vm->_system->deleteMutex(_mutex); } -void Sound::fxServer(int16 *data, uint len) { +void Sound::streamMusic(int16 *data, uint len) { Common::StackLock lock(_mutex); if (!_soundOn) return; - updateCompSampleStreaming(data, len); + for (int i = 0; i < MAXMUS; i++) { + if (!_music[i]._streaming || _music[i]._paused) + continue; + + st_volume_t volume = _musicMuted ? 0 : _musicVolTable[_musicVol]; + + fpMus.seek(_music[i]._filePos, SEEK_SET); + _converter->flow(_music[i], data, len, volume, volume); + } + + // DipMusic(); if (!_music[0]._streaming && !_music[1]._streaming && fpMus.isOpen()) fpMus.close(); @@ -516,20 +526,6 @@ int32 Sound::streamCompMusic(const char *filename, uint32 musicId, bool looping) return _music[primaryStream].play(filename, musicId, looping); } -void Sound::updateCompSampleStreaming(int16 *data, uint len) { - for (int i = 0; i < MAXMUS; i++) { - if (!_music[i]._streaming || _music[i]._paused) - continue; - - st_volume_t volume = _musicMuted ? 0 : _musicVolTable[_musicVol]; - - fpMus.seek(_music[i]._filePos, SEEK_SET); - _converter->flow(_music[i], data, len, volume, volume); - } - - // DipMusic(); -} - int32 Sound::dipMusic(void) { // disable this func for now return RD_OK; diff --git a/sword2/driver/d_sound.h b/sword2/driver/d_sound.h index ef10dd79e4..7efdf22479 100644 --- a/sword2/driver/d_sound.h +++ b/sword2/driver/d_sound.h @@ -92,7 +92,6 @@ private: bool _musicMuted; uint8 _musicVol; - void updateCompSampleStreaming(int16 *data, uint len); int32 dipMusic(void); PlayingSoundHandle _soundHandleSpeech; @@ -113,7 +112,7 @@ public: Sound(Sword2Engine *vm); ~Sound(); - void fxServer(int16 *data, uint len); + void streamMusic(int16 *data, uint len); void buildPanTable(bool reverse); bool getWavInfo(uint8 *data, WavInfo *wavInfo); |