diff options
author | Norbert Lange | 2009-06-19 14:30:09 +0000 |
---|---|---|
committer | Norbert Lange | 2009-06-19 14:30:09 +0000 |
commit | c7697fb200a10f2c6406239b32d66cc7163c3d59 (patch) | |
tree | 011ce214b4ca548aaade6740f9621de9ddf567b6 /engines | |
parent | c3596c184b032744d0a6d0d72879dcde854ec93e (diff) | |
download | scummvm-rg350-c7697fb200a10f2c6406239b32d66cc7163c3d59.tar.gz scummvm-rg350-c7697fb200a10f2c6406239b32d66cc7163c3d59.tar.bz2 scummvm-rg350-c7697fb200a10f2c6406239b32d66cc7163c3d59.zip |
added support for SFX by using a seperate Player for them.
svn-id: r41676
Diffstat (limited to 'engines')
-rw-r--r-- | engines/scumm/player_v4a.cpp | 29 | ||||
-rw-r--r-- | engines/scumm/player_v4a.h | 6 |
2 files changed, 26 insertions, 9 deletions
diff --git a/engines/scumm/player_v4a.cpp b/engines/scumm/player_v4a.cpp index 1483b67b42..e25f59f5f7 100644 --- a/engines/scumm/player_v4a.cpp +++ b/engines/scumm/player_v4a.cpp @@ -33,7 +33,7 @@ namespace Scumm { Player_V4A::Player_V4A(ScummEngine *scumm, Audio::Mixer *mixer) - : _vm(scumm), _mixer(mixer), _slots(), _musicId(), _tfmxPlay(0) { + : _vm(scumm), _mixer(mixer), _slots(), _musicId(), _tfmxPlay(0), _tfmxSfx(0), _musicHandle(), _sfxHandle() { init(); } @@ -52,6 +52,14 @@ bool Player_V4A::init() { _tfmxPlay = play; } else delete play; + + play = new Audio::Tfmx(_mixer->getOutputRate(), true); + fileMdat.seek(0); + fileSample.seek(0); + if (play->load(fileMdat, fileSample)) { + _tfmxSfx = play; + } else + delete play; } return _tfmxPlay != 0; } @@ -111,19 +119,28 @@ void Player_V4A::startSound(int nr) { int index = monkeyCommands[val]; if (index < 0) { // SoundFX - debug("Tfmx: Soundpattern %i", -index - 1); + index = -index - 1; + debug("Tfmx: Soundpattern %i", index); + + _tfmxSfx->doSong(0x18); + _tfmxSfx->doSfx(index); + + if (!_mixer->isSoundHandleActive(_sfxHandle)) + _mixer->playInputStream(Audio::Mixer::kSFXSoundType, &_sfxHandle, _tfmxSfx, -1, Audio::Mixer::kMaxChannelVolume, 0, false, false); } else { // Song debug("Tfmx: Song %i", index); assert(_tfmxPlay); - _mixer->stopHandle(_musicHandle); _tfmxPlay->doSong(index); _musicId = nr; - - _mixer->playInputStream(Audio::Mixer::kMusicSoundType, &_musicHandle, _tfmxPlay, -1, Audio::Mixer::kMaxChannelVolume, 0, false, false); - _musicLastTicks = g_system->getMillis(); + + + if (!_mixer->isSoundHandleActive(_musicHandle)) + _mixer->playInputStream(Audio::Mixer::kMusicSoundType, &_musicHandle, _tfmxPlay, -1, Audio::Mixer::kMaxChannelVolume, 0, false, false); + else + debug("Player_V4A:: Song started while another was still running"); // Tfmx class doesnt support this properly yet } } diff --git a/engines/scumm/player_v4a.h b/engines/scumm/player_v4a.h index 6f7f6bc99f..9c122e3992 100644 --- a/engines/scumm/player_v4a.h +++ b/engines/scumm/player_v4a.h @@ -56,12 +56,12 @@ private: ScummEngine *_vm; Audio::Tfmx *_tfmxPlay; + Audio::Tfmx *_tfmxSfx; Audio::Mixer *_mixer; Audio::SoundHandle _musicHandle; + Audio::SoundHandle _sfxHandle; - int _musicLastTicks; - - enum {V4A_MAXSFX = 8}; + enum {V4A_MAXSFX = 1}; struct SoundSlot { int id; |