CHEWY: Remove the overriden music buffer added for bug #13672

The MOD player loads the entirety of a song in memory, so we don't need
to add another music buffer
This commit is contained in:
Filippos Karapetis 2022-07-10 15:40:48 +03:00
parent ab495b4e6f
commit 79af8bad9d
3 changed files with 2 additions and 16 deletions

View File

@ -723,7 +723,6 @@ void flic_cut(int16 nr) {
}
g_engine->_sound->stopMusic();
g_engine->_sound->disposeMusicBuffer();
_G(out)->fadeOut();
_G(out)->cls();
break;

View File

@ -130,13 +130,7 @@ void Sound::playMusic(int16 num, bool loop) {
delete[] data;
}
void Sound::playMusic(uint8 *data, uint32 size, uint8 volume, bool handleBuffer) {
if (handleBuffer) {
_overridenMusicBuffer = new uint8[size];
memcpy(_overridenMusicBuffer, data, size);
data = _overridenMusicBuffer;
}
void Sound::playMusic(uint8 *data, uint32 size, uint8 volume) {
TMFStream *stream = new TMFStream(new Common::MemoryReadStream(data, size), 0);
_curMusic = -1;
@ -156,11 +150,6 @@ void Sound::stopMusic() {
_mixer->stopHandle(_musicHandle);
}
void Sound::disposeMusicBuffer() {
delete[] _overridenMusicBuffer;
_overridenMusicBuffer = nullptr;
}
bool Sound::isMusicActive() const {
return _mixer->isSoundHandleActive(_musicHandle);
}

View File

@ -60,11 +60,10 @@ public:
void setSoundChannelBalance(uint channel, int8 balance);
void playMusic(int16 num, bool loop = false);
void playMusic(uint8 *data, uint32 size, uint8 volume = 63, bool handleBuffer = false);
void playMusic(uint8 *data, uint32 size, uint8 volume = 63);
void pauseMusic();
void resumeMusic();
void stopMusic();
void disposeMusicBuffer();
bool isMusicActive() const;
void setUserMusicVolume(uint volume);
int getUserMusicVolume() const;
@ -121,7 +120,6 @@ private:
SoundResource *_speechRes;
SoundResource *_soundRes;
uint8 *_overridenMusicBuffer = nullptr;
};
} // End of namespace Chewy