diff options
author | Norbert Lange | 2009-07-18 00:04:28 +0000 |
---|---|---|
committer | Norbert Lange | 2009-07-18 00:04:28 +0000 |
commit | 9e16e3b3e644b64c198bbe680e138dad008c2fac (patch) | |
tree | e30e738b9c9383d93fccfa019b9706dd9fc71893 | |
parent | bb64bf008d03e01760a468d0df8cacb164725d41 (diff) | |
download | scummvm-rg350-9e16e3b3e644b64c198bbe680e138dad008c2fac.tar.gz scummvm-rg350-9e16e3b3e644b64c198bbe680e138dad008c2fac.tar.bz2 scummvm-rg350-9e16e3b3e644b64c198bbe680e138dad008c2fac.zip |
first attempt at enabling soundeffects using an table from the executeable. Doesnt quite work as it should
svn-id: r42575
-rw-r--r-- | dists/msvc9/scummvm-tfmx.vcproj | 2 | ||||
-rw-r--r-- | engines/kyra/seqplayer.cpp | 5 | ||||
-rw-r--r-- | engines/kyra/sound_amiga.cpp | 139 | ||||
-rw-r--r-- | engines/kyra/sound_intern.h | 7 | ||||
-rw-r--r-- | sound/mods/maxtrax.cpp | 9 | ||||
-rw-r--r-- | tfmx/mxtxplayer.cpp | 3 |
6 files changed, 153 insertions, 12 deletions
diff --git a/dists/msvc9/scummvm-tfmx.vcproj b/dists/msvc9/scummvm-tfmx.vcproj index def94c898e..0471eaaac2 100644 --- a/dists/msvc9/scummvm-tfmx.vcproj +++ b/dists/msvc9/scummvm-tfmx.vcproj @@ -192,7 +192,7 @@ /> <Tool Name="VCLinkerTool" - LinkLibraryDependencies="false" + LinkLibraryDependencies="true" AdditionalDependencies="winmm.lib sdl.lib zlib.lib libmad.lib vorbisfile_static.lib vorbis_static.lib ogg_static.lib" OutputFile="$(OutDir)\$(ProjectName)-tfmx.exe" ProgramDatabaseFile="$(OutDir)/scummvm.pdb" diff --git a/engines/kyra/seqplayer.cpp b/engines/kyra/seqplayer.cpp index 2145591c03..aeac4ce9df 100644 --- a/engines/kyra/seqplayer.cpp +++ b/engines/kyra/seqplayer.cpp @@ -413,8 +413,6 @@ void SeqPlayer::s1_fillRect() { void SeqPlayer::s1_playEffect() { uint8 track = *_seqData++; - if (_vm->gameFlags().platform == Common::kPlatformAmiga) - return; _vm->delay(3 * _vm->tickLength()); _sound->playSoundEffect(track); } @@ -422,9 +420,6 @@ void SeqPlayer::s1_playEffect() { void SeqPlayer::s1_playTrack() { uint8 msg = *_seqData++; - if (_vm->gameFlags().platform == Common::kPlatformAmiga) - return; - if (msg == 1) { _sound->beginFadeOut(); } else { diff --git a/engines/kyra/sound_amiga.cpp b/engines/kyra/sound_amiga.cpp index 985afa2d32..36d900828c 100644 --- a/engines/kyra/sound_amiga.cpp +++ b/engines/kyra/sound_amiga.cpp @@ -56,7 +56,6 @@ bool SoundAmiga::init() { void SoundAmiga::loadSoundFile(uint file) { assert(file < ARRAYSIZE(kFilenameTable)); - if (_fileLoaded == file) return; @@ -96,6 +95,142 @@ void SoundAmiga::beginFadeOut() { } void SoundAmiga::playSoundEffect(uint8 track) { - assert("Dont call me" == 0); + debug("play sfx %d", track); + uint16 extVar = 1; // maybe indicates music playing or enabled + uint16 extVar2 = 1; // no idea + if (0x61 <= track && track <= 0x63 && extVar) { + assert(false);//some music-commands + } + assert(track < ARRAYSIZE(kEffectsTable)); + const EffectEntry &entry = kEffectsTable[track]; + if (extVar2 && entry.note) { + _driver->playNote(entry.note, entry.patch, entry.duration, entry.volume, entry.pan != 0); + if (!_mixer->isSoundHandleActive(_soundChannels[0])) + _mixer->playInputStream(Audio::Mixer::kPlainSoundType, &_soundChannels[0], _driver); + } } + +const SoundAmiga::EffectEntry SoundAmiga::kEffectsTable[120] = { + { 0x0000, 0x00, 0x00, 0, 0 }, + { 0x0000, 0x01, 0x00, 0, 0 }, + { 0x0000, 0x00, 0x00, 0, 0 }, + { 0x0000, 0x00, 0x00, 0, 0 }, + { 0x0000, 0x00, 0x00, 0, 0 }, + { 0x0000, 0x00, 0x00, 0, 0 }, + { 0x0000, 0x00, 0x00, 0, 0 }, + { 0x0000, 0x00, 0x00, 0, 0 }, + { 0x0000, 0x00, 0x00, 0, 0 }, + { 0x0000, 0x00, 0x00, 0, 0 }, + { 0x0000, 0x00, 0x00, 0, 0 }, + { 0x0000, 0x00, 0x00, 0, 0 }, + { 0x0000, 0x00, 0x00, 0, 0 }, + { 0x0000, 0x00, 0x00, 0, 0 }, + { 0x0000, 0x00, 0x00, 0, 0 }, + { 0x0000, 0x00, 0x00, 0, 0 }, + { 0x0000, 0x00, 0x00, 0, 0 }, + { 0x0000, 0x00, 0x00, 0, 0 }, + { 0x0000, 0x00, 0x00, 0, 0 }, + { 0x0000, 0x00, 0x00, 0, 0 }, + { 0x0156, 0x3C, 0x13, 120, 1 }, + { 0x272C, 0x3C, 0x14, 120, 1 }, + { 0x1B91, 0x3C, 0x15, 120, 1 }, + { 0x1E97, 0x3C, 0x16, 120, 1 }, + { 0x122B, 0x3C, 0x17, 120, 1 }, + { 0x1E97, 0x3C, 0x16, 120, 1 }, + { 0x0224, 0x45, 0x03, 120, 1 }, + { 0x1E97, 0x3C, 0x16, 120, 1 }, + { 0x0000, 0x00, 0x00, 0, 0 }, + { 0x252C, 0x3C, 0x19, 120, 1 }, + { 0x0910, 0x2C, 0x04, 120, 1 }, + { 0x252C, 0x3C, 0x19, 120, 1 }, + { 0x3AEB, 0x3C, 0x1A, 120, 1 }, + { 0x138B, 0x25, 0x1B, 120, 1 }, + { 0x0F52, 0x18, 0x03, 120, 1 }, + { 0x0622, 0x3E, 0x1C, 120, 1 }, + { 0x0754, 0x3B, 0x1C, 120, 1 }, + { 0x206F, 0x16, 0x03, 120, 1 }, + { 0x252C, 0x3C, 0x19, 120, 1 }, + { 0x09EA, 0x3C, 0x1D, 120, 1 }, + { 0x0000, 0x00, 0x00, 0, 0 }, + { 0x0000, 0x00, 0x00, 0, 0 }, + { 0x0000, 0x00, 0x00, 0, 0 }, + { 0x272C, 0x3C, 0x14, 120, 1 }, + { 0x036E, 0x3C, 0x1E, 120, 1 }, + { 0x122B, 0x3C, 0x17, 120, 1 }, + { 0x0991, 0x4E, 0x0B, 120, 1 }, + { 0x02BC, 0x47, 0x1B, 120, 1 }, + { 0x0211, 0x4C, 0x1B, 120, 1 }, + { 0x0000, 0x00, 0x00, 0, 0 }, + { 0x0156, 0x3C, 0x13, 120, 1 }, + { 0x0156, 0x3C, 0x13, 120, 1 }, + { 0x0E9E, 0x3C, 0x1F, 120, 1 }, + { 0x010C, 0x3C, 0x20, 120, 1 }, + { 0x0000, 0x00, 0x00, 0, 0 }, + { 0x252C, 0x3C, 0x19, 120, 1 }, + { 0x0F7C, 0x3C, 0x21, 120, 1 }, + { 0x0000, 0x00, 0x00, 0, 0 }, + { 0x0000, 0x00, 0x00, 0, 0 }, + { 0x0000, 0x00, 0x00, 0, 0 }, + { 0x4C47, 0x2A, 0x0B, 120, 1 }, + { 0x0000, 0x00, 0x00, 0, 0 }, + { 0x0000, 0x00, 0x00, 0, 0 }, + { 0x0000, 0x00, 0x00, 0, 0 }, + { 0x0000, 0x00, 0x00, 0, 0 }, + { 0x0000, 0x00, 0x00, 0, 0 }, + { 0x0528, 0x3C, 0x1B, 120, 1 }, + { 0x0000, 0x00, 0x00, 0, 0 }, + { 0x0000, 0x00, 0x00, 0, 0 }, + { 0x0910, 0x2C, 0x04, 120, 1 }, + { 0x0000, 0x00, 0x00, 0, 0 }, + { 0x0AEE, 0x3C, 0x22, 120, 1 }, + { 0x1E97, 0x3C, 0x16, 120, 1 }, + { 0x1B91, 0x3C, 0x15, 120, 1 }, + { 0x0000, 0x00, 0x00, 0, 0 }, + { 0x0000, 0x00, 0x00, 0, 0 }, + { 0x0000, 0x00, 0x00, 0, 0 }, + { 0x272C, 0x3C, 0x14, 120, 1 }, + { 0x0000, 0x00, 0x00, 0, 0 }, + { 0x0AEE, 0x3C, 0x22, 120, 1 }, + { 0x272C, 0x3C, 0x14, 120, 1 }, + { 0x1419, 0x32, 0x23, 156, 1 }, + { 0x171C, 0x3C, 0x19, 120, 1 }, + { 0x272C, 0x3C, 0x14, 120, 1 }, + { 0x0622, 0x3E, 0x1C, 120, 1 }, + { 0x0201, 0x43, 0x13, 120, 1 }, + { 0x1243, 0x3C, 0x24, 90, 1 }, + { 0x00EE, 0x3E, 0x20, 120, 1 }, + { 0x252C, 0x3C, 0x19, 120, 1 }, + { 0x19EA, 0x29, 0x04, 120, 1 }, + { 0x0000, 0x00, 0x00, 0, 0 }, + { 0x0000, 0x00, 0x00, 0, 0 }, + { 0x0000, 0x00, 0x00, 0, 0 }, + { 0x010C, 0x3C, 0x20, 120, 1 }, + { 0x30B6, 0x3C, 0x25, 120, 1 }, + { 0x252C, 0x3C, 0x19, 120, 1 }, + { 0x0000, 0x00, 0x00, 0, 0 }, + { 0x0000, 0x00, 0x00, 0, 0 }, + { 0x0000, 0x00, 0x00, 0, 0 }, + { 0x0000, 0x00, 0x00, 0, 0 }, + { 0x0000, 0x00, 0x00, 0, 0 }, + { 0x1E97, 0x3C, 0x16, 120, 1 }, + { 0x0000, 0x00, 0x00, 0, 0 }, + { 0x3AEB, 0x3C, 0x1A, 120, 1 }, + { 0x39F3, 0x1B, 0x04, 120, 1 }, + { 0x1699, 0x30, 0x23, 80, 1 }, + { 0x1B91, 0x3C, 0x15, 120, 1 }, + { 0x19EA, 0x29, 0x06, 80, 1 }, + { 0x252C, 0x3C, 0x19, 120, 1 }, + { 0x0000, 0x00, 0x00, 0, 0 }, + { 0x0000, 0x00, 0x00, 0, 0 }, + { 0x3AEB, 0x3C, 0x1A, 120, 1 }, + { 0x252C, 0x3C, 0x19, 120, 1 }, + { 0x0713, 0x3C, 0x26, 120, 1 }, + { 0x0713, 0x3C, 0x26, 120, 1 }, + { 0x272C, 0x3C, 0x14, 120, 1 }, + { 0x1699, 0x30, 0x23, 80, 1 }, + { 0x1699, 0x30, 0x23, 80, 1 }, + { 0x0000, 0x00, 0x00, 0, 0 }, + { 0x0156, 0x3C, 0x13, 120, 1 } +}; + } // end of namespace Kyra
\ No newline at end of file diff --git a/engines/kyra/sound_intern.h b/engines/kyra/sound_intern.h index 792887ab35..8ee1ad9209 100644 --- a/engines/kyra/sound_intern.h +++ b/engines/kyra/sound_intern.h @@ -310,6 +310,13 @@ protected: uint _fileLoaded; static const char *const kFilenameTable[3][2]; + static const struct EffectEntry { + uint16 duration; + uint8 note; + uint8 patch; + int8 volume; + int8 pan; + } kEffectsTable[120]; }; } // end of namespace Kyra diff --git a/sound/mods/maxtrax.cpp b/sound/mods/maxtrax.cpp index 686a74864e..8e4435da18 100644 --- a/sound/mods/maxtrax.cpp +++ b/sound/mods/maxtrax.cpp @@ -48,7 +48,7 @@ MaxTrax::MaxTrax(int rate, bool stereo) uint32 colorClock = kPalSystemClock / 2; - for (int i = 0; i < kNumChannels; ++i) + for (int i = 0; i < ARRAYSIZE(_channelCtx); ++i) resetChannel(_channelCtx[i], (i & 1) != 0); // init extraChannel @@ -92,8 +92,8 @@ void MaxTrax::interrupt() { const uint16 stopTime = curEvent->stopTime; ChannelContext &channel = _channelCtx[data & 0x0F]; - outPutEvent(*curEvent); - debug("CurTime, EventDelta, NextDelta: %d, %d, %d", millis, eventDelta, eventDelta + curEvent[1].startTime ); + //outPutEvent(*curEvent); + //debug("CurTime, EventDelta, NextDelta: %d, %d, %d", millis, eventDelta, eventDelta + curEvent[1].startTime ); if (cmd < 0x80) { // Note const uint16 vol = (data & 0xF0) >> 1; @@ -307,6 +307,7 @@ void MaxTrax::stopMusic() { bool MaxTrax::doSong(int songIndex, int advance) { if (songIndex < 0 || songIndex >= _numScores) return false; + Common::StackLock lock(_mutex); Paula::pausePlay(true); _playerCtx.musicPlaying = false; _playerCtx.musicLoop = false; @@ -569,6 +570,7 @@ void MaxTrax::freePatches() { } int MaxTrax::playNote(byte note, byte patch, uint16 duration, uint16 volume, bool rightSide) { + Common::StackLock lock(_mutex); assert(patch < ARRAYSIZE(_patch)); ChannelContext &channel = _channelCtx[kNumChannels]; @@ -586,6 +588,7 @@ int MaxTrax::playNote(byte note, byte patch, uint16 duration, uint16 volume, boo } bool MaxTrax::load(Common::SeekableReadStream &musicData, bool loadScores, bool loadSamples) { + Common::StackLock lock(_mutex); bool res = false; stopMusic(); if (loadSamples) diff --git a/tfmx/mxtxplayer.cpp b/tfmx/mxtxplayer.cpp index f3c6887a2b..1ceebf8167 100644 --- a/tfmx/mxtxplayer.cpp +++ b/tfmx/mxtxplayer.cpp @@ -88,7 +88,8 @@ void modcmdmain(const int argc, const char *const argv[]) { } if (!hasCmd) { - + player->doSong(0); + player->playNote(0x18, 0x03, 0x0F52, 120, 1); } int maxsecs = 10 * 60; |