aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/kyra/sound_amiga.cpp64
-rw-r--r--sound/mods/maxtrax.cpp13
-rw-r--r--sound/mods/maxtrax.h3
3 files changed, 69 insertions, 11 deletions
diff --git a/engines/kyra/sound_amiga.cpp b/engines/kyra/sound_amiga.cpp
index 2d8610552d..233a11bcd0 100644
--- a/engines/kyra/sound_amiga.cpp
+++ b/engines/kyra/sound_amiga.cpp
@@ -81,13 +81,55 @@ void SoundAmiga::loadSoundFile(Common::String) {
}
void SoundAmiga::playTrack(uint8 track) {
- _driver->doSong(track - 2);
- if (!_mixer->isSoundHandleActive(_soundChannels[0]))
+ static const byte tempoIntro[6] = { 0x46, 0x55, 0x3C, 0x41, 0x78, 0x50 };
+ static const byte tempoIngame[23] = {
+ 0x64, 0x64, 0x64, 0x64, 0x64, 0x73, 0x4B, 0x64,
+ 0x64, 0x64, 0x55, 0x9C, 0x6E, 0x91, 0x78, 0x84,
+ 0x32, 0x64, 0x64, 0x6E, 0x3C, 0xD8, 0xAF
+ };
+ static const byte loopIngame[23] = {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x01, 0x01, 0x01, 0x00, 0x01, 0x01,
+ 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00,
+ };
+
+ // intro
+ if (track >= 2) {
+ track -= 2;
+ _driver->setVolume(0x40);
+ _driver->doSong(track);
+ _driver->setTempo(tempoIntro[track] << 4);
+ if (!_mixer->isSoundHandleActive(_soundChannels[0]))
_mixer->playInputStream(Audio::Mixer::kPlainSoundType, &_soundChannels[0], _driver);
+ } else if (track == 0){
+ _driver->stopMusic();
+ } else { // track == 1
+ beginFadeOut();
+ }
+
+ // ingame
+ if (false && track < 0x80 && track != 3) {
+ if (track >= 2) {
+ track -= 0xB;
+ _driver->setVolume(0x40);
+ if (loopIngame)
+ ; // TODO: enable looping
+ _driver->doSong(track);
+ _driver->setTempo(tempoIngame[track] << 4);
+ if (!_mixer->isSoundHandleActive(_soundChannels[0]))
+ _mixer->playInputStream(Audio::Mixer::kPlainSoundType, &_soundChannels[0], _driver);
+ } else if (track == 0){
+ _driver->stopMusic();
+ } else { // track == 1
+ beginFadeOut();
+ }
+
+ }
}
void SoundAmiga::haltTrack() {
+
}
void SoundAmiga::beginFadeOut() {
@@ -105,22 +147,26 @@ void SoundAmiga::playSoundEffect(uint8 track) {
_mixer->playInputStream(Audio::Mixer::kPlainSoundType, &_soundChannels[0], _driver);
- /* // ingame?
+ // ingame
+ if (0) {
uint16 extVar = 1; // maybe indicates music playing or enabled
uint16 extVar2 = 1; // sound loaded ?
- if (0x61 <= track && track <= 0x63 && extVar) {
- assert(false);//some music-commands
- }
- assert(track < ARRAYSIZE(kEffectsTable));
- const EffectEntry &entry = kEffectsTable[track];
+ if (0x61 <= track && track <= 0x63 && extVar)
+ playTrack(track - 0x4F);
+
+ assert(track < ARRAYSIZE(tableEffectsGame));
+ const EffectEntry &entry = tableEffectsGame[track];
if (extVar2 && entry.note) {
byte pan = (entry.pan == 2) ? 0 : entry.pan;
_driver->playNote(entry.note, entry.patch, entry.duration, entry.volume, pan != 0);
if (!_mixer->isSoundHandleActive(_soundChannels[0]))
_mixer->playInputStream(Audio::Mixer::kPlainSoundType, &_soundChannels[0], _driver);
- }*/
+
+ }
+ }
}
+
const SoundAmiga::EffectEntry SoundAmiga::tableEffectsIntro[40] = {
{ 0x0000, 0x00, 0x00, 0, 0 },
{ 0x0000, 0x00, 0x00, 0, 0 },
diff --git a/sound/mods/maxtrax.cpp b/sound/mods/maxtrax.cpp
index 16631b09b0..5908314536 100644
--- a/sound/mods/maxtrax.cpp
+++ b/sound/mods/maxtrax.cpp
@@ -314,8 +314,7 @@ bool MaxTrax::doSong(int songIndex, int advance) {
_playerCtx.musicLoop = false;
setTempo(_playerCtx.tempoInitial << 4);
- _playerCtx.nextEvent = _scores[songIndex].events;
- _playerCtx.nextEventTime = _playerCtx.nextEvent->startTime;
+ _playerCtx.tempoTime = 0;
_playerCtx.scoreIndex = songIndex;
_playerCtx.ticks = 0;
@@ -324,6 +323,16 @@ bool MaxTrax::doSong(int songIndex, int advance) {
for (int i = 0; i < kNumChannels; ++i)
resetChannel(_channelCtx[i], (i & 1) != 0);
+ const Event *cev = _scores[songIndex].events;
+ // Songs are special markers in the score
+ for (; advance > 0; --advance) {
+ // TODO - check for boundaries
+ for(; cev->command != 0xFF && (cev->command != 0xA0 || (cev->stopTime >> 8) != 0x00); ++cev)
+ ;
+ }
+ _playerCtx.nextEvent = cev;
+ _playerCtx.nextEventTime = cev->startTime;
+
_playerCtx.musicPlaying = true;
Paula::startPaula();
return true;
diff --git a/sound/mods/maxtrax.h b/sound/mods/maxtrax.h
index cbc4a5b59f..9fef3e68f0 100644
--- a/sound/mods/maxtrax.h
+++ b/sound/mods/maxtrax.h
@@ -210,6 +210,9 @@ public:
void killVoice(byte num);
int playNote(byte note, byte patch, uint16 duration, uint16 volume, bool rightSide);
+ void setVolume(const byte volume) {
+ _playerCtx.volume = volume;
+ }
void setTempo(const uint16 tempo) {
_playerCtx.tickUnit = (int32)(((uint32)(tempo & 0xFFF0) << 8) / (uint16)(5 * _playerCtx.vBlankFreq));
}