[Scummvm-cvs-logs] SF.net SVN: scummvm:[41685] scummvm/branches/gsoc2009-mods
nolange at users.sourceforge.net
nolange at users.sourceforge.net
Fri Jun 19 22:17:54 CEST 2009
Revision: 41685
http://scummvm.svn.sourceforge.net/scummvm/?rev=41685&view=rev
Author: nolange
Date: 2009-06-19 20:17:53 +0000 (Fri, 19 Jun 2009)
Log Message:
-----------
Enabled signals and made ScummVM use them (they specify when a song should be stopped)
Cleanups in player_v4a.
Modified Paths:
--------------
scummvm/branches/gsoc2009-mods/engines/scumm/player_v4a.cpp
scummvm/branches/gsoc2009-mods/engines/scumm/player_v4a.h
scummvm/branches/gsoc2009-mods/sound/mods/tfmx.cpp
scummvm/branches/gsoc2009-mods/sound/mods/tfmx.h
Modified: scummvm/branches/gsoc2009-mods/engines/scumm/player_v4a.cpp
===================================================================
--- scummvm/branches/gsoc2009-mods/engines/scumm/player_v4a.cpp 2009-06-19 19:28:29 UTC (rev 41684)
+++ scummvm/branches/gsoc2009-mods/engines/scumm/player_v4a.cpp 2009-06-19 20:17:53 UTC (rev 41685)
@@ -33,7 +33,7 @@
namespace Scumm {
Player_V4A::Player_V4A(ScummEngine *scumm, Audio::Mixer *mixer)
- : _vm(scumm), _mixer(mixer), _slots(), _musicId(), _tfmxPlay(0), _tfmxSfx(0), _musicHandle(), _sfxHandle() {
+ : _vm(scumm), _mixer(mixer), _musicId(), _tfmxPlay(0), _tfmxSfx(0), _musicHandle(), _sfxHandle() {
init();
}
@@ -65,25 +65,17 @@
}
Player_V4A::~Player_V4A() {
+ _mixer->stopHandle(_musicHandle);
+ _mixer->stopHandle(_sfxHandle);
delete _tfmxPlay;
+ delete _tfmxSfx;
}
void Player_V4A::setMusicVolume(int vol) {
debug("player_v4a: setMusicVolume %i", vol);
}
-int Player_V4A::getSlot(int id) const {
- for (int i = 0; i < ARRAYSIZE(_slots); i++) {
- if (_slots[i].id == id)
- return i;
- }
- if (id == 0)
- warning("player_v4a - out of music channels");
- return -1;
-}
-
-
void Player_V4A::stopAllSounds() {
if (_musicId)
stopSound(_musicId);
@@ -93,16 +85,15 @@
if (nr == _musicId) {
_mixer->stopHandle(_musicHandle);
_musicId = 0;
- }
+ } else
+ warning("player_v4a: stop Sound %d", nr);
}
void Player_V4A::startSound(int nr) {
assert(_vm);
- byte *ptr = _vm->getResourceAddress(rtSound, nr);
+ const byte *ptr = _vm->getResourceAddress(rtSound, nr);
assert(ptr);
- Common::hexdump(ptr, 16);
-
static const int8 monkeyCommands[52] = {
-1, -2, -3, -4, -5, -6, -7, -8,
-9, -10, -11, -12, -13, -14, 18, 17,
@@ -113,24 +104,30 @@
6, 13, 9, 19
};
- int val = ptr[9];
- if (val < 0 || val >= ARRAYSIZE(monkeyCommands))
- debug("Tfmx: illegal Songnumber %i", val);
+ const int val = ptr[9];
+ if (val < 0 || val >= ARRAYSIZE(monkeyCommands)) {
+ debug(3, "Tfmx: illegal Songnumber %i", val);
+ return;
+ }
+
+ if (!_tfmxSfx || !_tfmxPlay)
+ return;
+
int index = monkeyCommands[val];
if (index < 0) {
// SoundFX
index = -index - 1;
- debug("Tfmx: Soundpattern %i", index);
+ debug(5, "player_v4a: play custom %i", index);
- _tfmxSfx->doSong(0x18);
+ if (_tfmxSfx->getSongIndex() < 0)
+ _tfmxSfx->doSong(0x18);
_tfmxSfx->doSfx(index);
if (!_mixer->isSoundHandleActive(_sfxHandle))
- _mixer->playInputStream(Audio::Mixer::kSFXSoundType, &_sfxHandle, _tfmxSfx, -1, Audio::Mixer::kMaxChannelVolume, 0, false, false);
-
+ _mixer->playInputStream(Audio::Mixer::kSFXSoundType, &_sfxHandle, _tfmxSfx, -1, Audio::Mixer::kMaxChannelVolume, 0, true, false);
} else {
// Song
- debug("Tfmx: Song %i", index);
+ debug(5, "player_v4a: play song %i", index);
assert(_tfmxPlay);
_tfmxPlay->doSong(index);
@@ -139,8 +136,6 @@
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
}
}
@@ -157,10 +152,8 @@
}
int Player_V4A::getSoundStatus(int nr) const {
- if (nr == _musicId)
- return _mixer->isSoundHandleActive(_musicHandle);
- /*if (getSfxChan(nr) != -1)
- return 1;*/
+ if (nr == _musicId && _mixer->isSoundHandleActive(_musicHandle))
+ return _tfmxPlay->getSignal(0);
return 0;
}
Modified: scummvm/branches/gsoc2009-mods/engines/scumm/player_v4a.h
===================================================================
--- scummvm/branches/gsoc2009-mods/engines/scumm/player_v4a.h 2009-06-19 19:28:29 UTC (rev 41684)
+++ scummvm/branches/gsoc2009-mods/engines/scumm/player_v4a.h 2009-06-19 20:17:53 UTC (rev 41685)
@@ -61,17 +61,8 @@
Audio::SoundHandle _musicHandle;
Audio::SoundHandle _sfxHandle;
- enum {V4A_MAXSFX = 1};
-
- struct SoundSlot {
- int id;
- byte patternNum;
- byte channel;
- } _slots[V4A_MAXSFX];
-
int _musicId;
- int getSlot(int id) const;
bool init();
};
Modified: scummvm/branches/gsoc2009-mods/sound/mods/tfmx.cpp
===================================================================
--- scummvm/branches/gsoc2009-mods/sound/mods/tfmx.cpp 2009-06-19 19:28:29 UTC (rev 41684)
+++ scummvm/branches/gsoc2009-mods/sound/mods/tfmx.cpp 2009-06-19 20:17:53 UTC (rev 41685)
@@ -439,7 +439,8 @@
return channel.deferWait;
case 0x20: // Signal. Parameters: signalnumber/value
- warnMacroUnimplemented(macroPtr, 0);
+ if (macroPtr[1] < ARRAYSIZE(_playerCtx.signal))
+ _playerCtx.signal[macroPtr[1]] = READ_BE_UINT16(¯oPtr[2]);
return true;
case 0x21: // Play macro. Parameters: macro/chan/detune
@@ -622,8 +623,8 @@
return true;
case 13: // Cue
- warnPatternUnimplemented(patternPtr, 1);
- debug("Cue/Signal %02X %04X", patternPtr[1], READ_BE_UINT16(&patternPtr[2]));
+ if (patternPtr[1] < ARRAYSIZE(_playerCtx.signal))
+ _playerCtx.signal[patternPtr[1]] = READ_BE_UINT16(&patternPtr[2]);
return true;
case 15: // NOP
Modified: scummvm/branches/gsoc2009-mods/sound/mods/tfmx.h
===================================================================
--- scummvm/branches/gsoc2009-mods/sound/mods/tfmx.h 2009-06-19 19:28:29 UTC (rev 41684)
+++ scummvm/branches/gsoc2009-mods/sound/mods/tfmx.h 2009-06-19 20:17:53 UTC (rev 41685)
@@ -51,6 +51,8 @@
void doMacro(int macro, int note);
bool load(Common::SeekableReadStream &musicData, Common::SeekableReadStream &sampleData);
int getTicks() {return _playerCtx.tickCount;}
+ int getSongIndex() {return _playerCtx.song;}
+ uint16 getSignal(int index) {return _playerCtx.signal[index];}
// Note: everythings public so the debug-Routines work.
// private:
@@ -217,6 +219,8 @@
int tickCount;
+ uint16 signal[4];
+
bool stopWithLastPattern; //!< hack to automatically stop the whole player if no Pattern is running
} _playerCtx;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list