aboutsummaryrefslogtreecommitdiff
path: root/engines/scumm/player_v4a.cpp
diff options
context:
space:
mode:
authorNorbert Lange2009-06-19 14:30:09 +0000
committerNorbert Lange2009-06-19 14:30:09 +0000
commitc7697fb200a10f2c6406239b32d66cc7163c3d59 (patch)
tree011ce214b4ca548aaade6740f9621de9ddf567b6 /engines/scumm/player_v4a.cpp
parentc3596c184b032744d0a6d0d72879dcde854ec93e (diff)
downloadscummvm-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/scumm/player_v4a.cpp')
-rw-r--r--engines/scumm/player_v4a.cpp29
1 files changed, 23 insertions, 6 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
}
}