diff options
author | Strangerke | 2014-12-01 08:46:32 +0100 |
---|---|---|
committer | Paul Gilbert | 2014-12-12 22:54:42 -0500 |
commit | f364782d05cf0772bf2eaa71ea418650e0d9bf27 (patch) | |
tree | 9a9de01d1563d7c3d1cff2a2487b30ee1df0807a | |
parent | 6e8f29c15b433e517b06c17fc63d082e7c5069d9 (diff) | |
download | scummvm-rg350-f364782d05cf0772bf2eaa71ea418650e0d9bf27.tar.gz scummvm-rg350-f364782d05cf0772bf2eaa71ea418650e0d9bf27.tar.bz2 scummvm-rg350-f364782d05cf0772bf2eaa71ea418650e0d9bf27.zip |
ACCESS: Some rework in MusicManager
-rw-r--r-- | engines/access/room.cpp | 5 | ||||
-rw-r--r-- | engines/access/sound.cpp | 10 | ||||
-rw-r--r-- | engines/access/sound.h | 10 |
3 files changed, 16 insertions, 9 deletions
diff --git a/engines/access/room.cpp b/engines/access/room.cpp index 7ef3d6937d..8ef61a9d68 100644 --- a/engines/access/room.cpp +++ b/engines/access/room.cpp @@ -152,8 +152,7 @@ void Room::doRoom() { void Room::clearRoom() { if (_vm->_midi->_music) { _vm->_midi->stopSong(); - delete _vm->_midi->_music; - _vm->_midi->_music = nullptr; + _vm->_midi->freeMusic(); } _vm->_sound->freeSounds(); @@ -183,7 +182,7 @@ void Room::loadRoomData(const byte *roomData) { _vm->_midi->freeMusic(); if (roomInfo._musicFile._fileNum != -1) { - _vm->_midi->_music = _vm->_files->loadFile(roomInfo._musicFile); + _vm->_midi->loadMusic(roomInfo._musicFile); _vm->_midi->midiPlay(); _vm->_midi->_musicRepeat = true; } diff --git a/engines/access/sound.cpp b/engines/access/sound.cpp index a24dd1a24b..316ac54d42 100644 --- a/engines/access/sound.cpp +++ b/engines/access/sound.cpp @@ -172,8 +172,12 @@ void MusicManager::stopSong() { // TODO } -Resource *MusicManager::loadMusic(int fileNum, int subfile) { - return _vm->_files->loadFile(fileNum, subfile); +void MusicManager::loadMusic(int fileNum, int subfile) { + _music = _vm->_files->loadFile(fileNum, subfile); +} + +void MusicManager::loadMusic(FileIdent file) { + _music = _vm->_files->loadFile(file); } void MusicManager::newMusic(int musicId, int mode) { @@ -189,7 +193,7 @@ void MusicManager::newMusic(int musicId, int mode) { _musicRepeat = (mode == 2); _tempMusic = _music; stopSong(); - _music = loadMusic(97, musicId); + loadMusic(97, musicId); } } diff --git a/engines/access/sound.h b/engines/access/sound.h index b14ce7c685..827a00f8b5 100644 --- a/engines/access/sound.h +++ b/engines/access/sound.h @@ -75,13 +75,14 @@ private: AccessEngine *_vm; Audio::Mixer *_mixer; - Resource *loadMusic(int fileNum, int subfile); + Resource *_tempMusic; public: - Resource *_music; - Resource *_tempMusic; bool _musicRepeat; bool _playingSound; + + Resource *_music; + public: MusicManager(AccessEngine *vm, Audio::Mixer *mixer); ~MusicManager(); @@ -97,6 +98,9 @@ public: void newMusic(int musicId, int mode); void freeMusic(); + + void loadMusic(int fileNum, int subfile); + void loadMusic(FileIdent file); }; } // End of namespace Access |