diff options
author | Benjamin Haisch | 2009-05-13 12:17:53 +0000 |
---|---|---|
committer | Willem Jan Palenstijn | 2011-11-20 22:43:07 +0100 |
commit | 041fe21417d107dd558212ba70004d71d02e0355 (patch) | |
tree | c9dffc10744299590a1c5f78ec9eb29fa5f0886c /engines/toltecs/sound.cpp | |
parent | 170b66b2cbf9c43d3bfe5e1c1a22723dba51f565 (diff) | |
download | scummvm-rg350-041fe21417d107dd558212ba70004d71d02e0355.tar.gz scummvm-rg350-041fe21417d107dd558212ba70004d71d02e0355.tar.bz2 scummvm-rg350-041fe21417d107dd558212ba70004d71d02e0355.zip |
TOLTECS: - Added enum for sound channel type
- Added isPointInside
Diffstat (limited to 'engines/toltecs/sound.cpp')
-rw-r--r-- | engines/toltecs/sound.cpp | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/engines/toltecs/sound.cpp b/engines/toltecs/sound.cpp index cb7b2343bb..3f1be4be89 100644 --- a/engines/toltecs/sound.cpp +++ b/engines/toltecs/sound.cpp @@ -47,7 +47,7 @@ namespace Toltecs { Sound::Sound(ToltecsEngine *vm) : _vm(vm) { for (int i = 0; i < 4; i++) { - channels[i].type = 0; + channels[i].type = kChannelTypeEmpty; channels[i].resIndex = -1; } } @@ -61,7 +61,7 @@ void Sound::playSpeech(int16 resIndex) { debug(0, "playSpeech(%d)", resIndex); - internalPlaySound(resIndex, -3, 50 /*TODO*/, 64); + internalPlaySound(resIndex, kChannelTypeSpeech, 50 /*TODO*/, 64); } @@ -71,8 +71,8 @@ void Sound::playSound(int16 resIndex, int16 type, int16 volume) { debug(0, "playSound(%d, %d, %d)", resIndex, type, volume); - if (volume == -1 || type == -2) { - if (type == -1) { + if (volume == -1 || type == kChannelTypeSfx) { + if (type == kChannelTypeBackground) { internalPlaySound(resIndex, type, 50 /*TODO*/, 64); } else { internalPlaySound(resIndex, type, 100 /*TODO*/, 64); @@ -102,29 +102,29 @@ void Sound::internalPlaySound(int16 resIndex, int16 type, int16 volume, int16 pa _vm->_mixer->stopAll(); _vm->_screen->keepTalkTextItemsAlive(); for (int i = 0; i < 4; i++) { - channels[i].type = 0; + channels[i].type = kChannelTypeEmpty; channels[i].resIndex = -1; } - } else if (type == -2) { + } else if (type == kChannelTypeSfx) { // Stop sounds with specified resIndex for (int i = 0; i < 4; i++) { if (channels[i].resIndex == resIndex) { _vm->_mixer->stopHandle(channels[i].handle); - channels[i].type = 0; + channels[i].type = kChannelTypeEmpty; channels[i].resIndex = -1; } } } else { - if (type == -3) { - // Stop sounds with type == -3 and play new sound + if (type == kChannelTypeSpeech) { + // Stop speech and play new sound stopSpeech(); } // Play new sound in empty channel int freeChannel = -1; for (int i = 0; i < 4; i++) { - if (channels[i].type == 0) { + if (channels[i].type == kChannelTypeEmpty) { freeChannel = i; break; } @@ -137,8 +137,8 @@ void Sound::internalPlaySound(int16 resIndex, int16 type, int16 volume, int16 pa uint32 soundSize = _vm->_res->getCurItemSize(); byte flags = Audio::Mixer::FLAG_UNSIGNED; - // Sounds with type == -1 loop - if (type == -1) + // Background sounds + if (type == kChannelTypeBackground) flags |= Audio::Mixer::FLAG_LOOP; Audio::AudioStream *stream = Audio::makeLinearInputStream(soundData, soundSize, 22050, flags, 0, 0); @@ -156,7 +156,7 @@ void Sound::internalPlaySound(int16 resIndex, int16 type, int16 volume, int16 pa void Sound::updateSpeech() { for (int i = 0; i < 4; i++) { - if (channels[i].type == -3 && _vm->_mixer->isSoundHandleActive(channels[i].handle)) { + if (channels[i].type == kChannelTypeSpeech && _vm->_mixer->isSoundHandleActive(channels[i].handle)) { _vm->_screen->keepTalkTextItemsAlive(); break; } @@ -165,10 +165,10 @@ void Sound::updateSpeech() { void Sound::stopSpeech() { for (int i = 0; i < 4; i++) { - if (channels[i].type == -3) { + if (channels[i].type == kChannelTypeSpeech) { _vm->_mixer->stopHandle(channels[i].handle); _vm->_screen->keepTalkTextItemsAlive(); - channels[i].type = 0; + channels[i].type = kChannelTypeEmpty; channels[i].resIndex = -1; } } |