ACCESS: Implement newMusic()

This commit is contained in:
Strangerke 2014-11-02 12:00:50 +01:00 committed by Paul Gilbert
parent c038452588
commit 335acfac89
2 changed files with 18 additions and 1 deletions

View File

@ -30,6 +30,7 @@ namespace Access {
SoundManager::SoundManager(AccessEngine *vm, Audio::Mixer *mixer) :
_vm(vm), _mixer(mixer) {
_music = nullptr;
_tempMusic = nullptr;
_musicRepeat = false;
_playingSound = false;
_isVoice = false;
@ -37,6 +38,8 @@ SoundManager::SoundManager(AccessEngine *vm, Audio::Mixer *mixer) :
SoundManager::~SoundManager() {
clearSounds();
delete _music;
delete _tempMusic;
}
void SoundManager::clearSounds() {
@ -95,7 +98,20 @@ void SoundManager::freeSounds() {
}
void SoundManager::newMusic(int musicId, int mode) {
warning("TODO: newMusic");
if (mode == 1) {
stopSong();
freeMusic();
_music = _tempMusic;
_tempMusic = nullptr;
_musicRepeat = true;
if (_music)
midiPlay();
} else {
_musicRepeat = (mode == 2);
_tempMusic = _music;
stopSong();
_music = loadSound(97, musicId);
}
}
void SoundManager::freeMusic() {

View File

@ -46,6 +46,7 @@ public:
Common::Array<Resource *> _soundTable;
Common::Array<int> _soundPriority;
Resource *_music;
Resource *_tempMusic;
bool _musicRepeat;
bool _playingSound;
bool _isVoice;