diff options
author | Torbjörn Andersson | 2004-11-26 13:28:00 +0000 |
---|---|---|
committer | Torbjörn Andersson | 2004-11-26 13:28:00 +0000 |
commit | 66b8bcd7ebb5cc53afc2a2192a8ccc9ae24ef670 (patch) | |
tree | d726675cbb9fd7b4ede8b89d8ee86d1b26f37b9e | |
parent | 41d1be2ea8e1869b056cf09f3b82d52363aa80c1 (diff) | |
download | scummvm-rg350-66b8bcd7ebb5cc53afc2a2192a8ccc9ae24ef670.tar.gz scummvm-rg350-66b8bcd7ebb5cc53afc2a2192a8ccc9ae24ef670.tar.bz2 scummvm-rg350-66b8bcd7ebb5cc53afc2a2192a8ccc9ae24ef670.zip |
Added looping background noise to the IHNM intro. I don't know if it's the
correct sound or the correct volume, but the small extension to allow the
engine to start looping sounds is worthwhile enough in itself, I think.
svn-id: r15895
-rw-r--r-- | saga/events.cpp | 5 | ||||
-rw-r--r-- | saga/ihnm_introproc.cpp | 21 | ||||
-rw-r--r-- | saga/sfuncs.cpp | 2 | ||||
-rw-r--r-- | saga/sndres.cpp | 4 | ||||
-rw-r--r-- | saga/sndres.h | 2 | ||||
-rw-r--r-- | saga/sound.cpp | 4 | ||||
-rw-r--r-- | saga/sound.h | 6 |
7 files changed, 36 insertions, 8 deletions
diff --git a/saga/events.cpp b/saga/events.cpp index 435256517f..f377b444d1 100644 --- a/saga/events.cpp +++ b/saga/events.cpp @@ -309,6 +309,11 @@ int Events::handleOneShot(EVENT *event) { } break; + case SOUND_EVENT: + _vm->_sound->stopSound(); + if (event->op == EVENT_PLAY) + _vm->_sndRes->playSound(event->param, event->param2, event->param3 != 0); + break; case VOICE_EVENT: _vm->_sndRes->playVoice(event->param); break; diff --git a/saga/ihnm_introproc.cpp b/saga/ihnm_introproc.cpp index 0ceba8545c..45ea1e1dee 100644 --- a/saga/ihnm_introproc.cpp +++ b/saga/ihnm_introproc.cpp @@ -339,11 +339,30 @@ int Scene::IHNMHateProc(int param, SCENE_INFO *scene_info) { q_event = _vm->_events->queue(&event); + // Background sound + event.type = ONESHOT_EVENT; + event.code = SOUND_EVENT; + event.op = EVENT_PLAY; + event.param = 260; // FIXME: Verify sound + event.param2 = 255; // FIXME: Verify volume + event.param3 = SOUND_LOOP; + event.time = 0; + + q_event = _vm->_events->queue(&event); + + // End background sound after the voice has finished + event.type = ONESHOT_EVENT; + event.code = SOUND_EVENT; + event.op = EVENT_STOP; + event.time = _vm->_sndRes->getVoiceLength(0); + + q_event = _vm->_events->chain(q_event, &event); + // End scene after the voice has finished event.type = ONESHOT_EVENT; event.code = SCENE_EVENT; event.op = EVENT_END; - event.time = _vm->_sndRes->getVoiceLength(0); + event.time = 0; q_event = _vm->_events->chain(q_event, &event); break; diff --git a/saga/sfuncs.cpp b/saga/sfuncs.cpp index 1963444a4e..398d075e13 100644 --- a/saga/sfuncs.cpp +++ b/saga/sfuncs.cpp @@ -1156,7 +1156,7 @@ int Script::SF_playSound(SCRIPTFUNC_PARAMS) { SDataWord_T param = thread->pop() - 13; if (/* param >= 0 && */ param < ARRAYSIZE(sfxTable)) - _vm->_sndRes->playSound(sfxTable[param].res, sfxTable[param].vol); + _vm->_sndRes->playSound(sfxTable[param].res, sfxTable[param].vol, false); else _vm->_sound->stopSound(); diff --git a/saga/sndres.cpp b/saga/sndres.cpp index 13426fa91e..5c7b583123 100644 --- a/saga/sndres.cpp +++ b/saga/sndres.cpp @@ -53,7 +53,7 @@ SndRes::SndRes(SagaEngine *vm) : _vm(vm) { _init = 1; } -int SndRes::playSound(uint32 sound_rn, int volume) { +int SndRes::playSound(uint32 sound_rn, int volume, bool loop) { SOUNDBUFFER snd_buffer; debug(0, "SndRes::playSound(%ld)", sound_rn); @@ -63,7 +63,7 @@ int SndRes::playSound(uint32 sound_rn, int volume) { return FAILURE; } - _vm->_sound->playSound(&snd_buffer, volume); + _vm->_sound->playSound(&snd_buffer, volume, loop); return SUCCESS; } diff --git a/saga/sndres.h b/saga/sndres.h index ec823a8673..b5bdd65c48 100644 --- a/saga/sndres.h +++ b/saga/sndres.h @@ -67,7 +67,7 @@ public: SndRes(SagaEngine *vm); int loadSound(uint32 sound_rn); - int playSound(uint32 sound_rn, int volume); + int playSound(uint32 sound_rn, int volume, bool loop); int playVoice(uint32 voice_rn); int getVoiceLength(uint32 voice_rn); diff --git a/saga/sound.cpp b/saga/sound.cpp index e63f675ca0..e68b71384f 100644 --- a/saga/sound.cpp +++ b/saga/sound.cpp @@ -190,8 +190,8 @@ int Sound::playSoundBuffer(PlayingSoundHandle *handle, SOUNDBUFFER *buf, int vol return SUCCESS; } -int Sound::playSound(SOUNDBUFFER *buf, int volume) { - return playSoundBuffer(&_effectHandle, buf, 2 * volume, false); +int Sound::playSound(SOUNDBUFFER *buf, int volume, bool loop) { + return playSoundBuffer(&_effectHandle, buf, 2 * volume, loop); } int Sound::pauseSound() { diff --git a/saga/sound.h b/saga/sound.h index 06292c2099..1f339b2f5a 100644 --- a/saga/sound.h +++ b/saga/sound.h @@ -32,6 +32,10 @@ namespace Saga { +enum SOUND_FLAGS { + SOUND_LOOP = 1 +}; + struct SOUNDBUFFER { uint16 s_freq; int s_samplebits; @@ -48,7 +52,7 @@ public: Sound(SagaEngine *vm, SoundMixer *mixer, int enabled); ~Sound(); - int playSound(SOUNDBUFFER *buf, int volume); + int playSound(SOUNDBUFFER *buf, int volume, bool loop); int pauseSound(); int resumeSound(); int stopSound(); |