aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/sound
diff options
context:
space:
mode:
Diffstat (limited to 'engines/sci/sound')
-rw-r--r--engines/sci/sound/drivers/adlib.cpp2
-rw-r--r--engines/sci/sound/drivers/amigamac.cpp25
-rw-r--r--engines/sci/sound/drivers/cms.cpp2
-rw-r--r--engines/sci/sound/drivers/fb01.cpp1
-rw-r--r--engines/sci/sound/drivers/midi.cpp4
-rw-r--r--engines/sci/sound/drivers/pcjr.cpp3
-rw-r--r--engines/sci/sound/soundcmd.cpp28
7 files changed, 51 insertions, 14 deletions
diff --git a/engines/sci/sound/drivers/adlib.cpp b/engines/sci/sound/drivers/adlib.cpp
index 65a8e2e3da..f00c99d5b5 100644
--- a/engines/sci/sound/drivers/adlib.cpp
+++ b/engines/sci/sound/drivers/adlib.cpp
@@ -26,6 +26,8 @@
#include "sci/sci.h"
#include "common/file.h"
+#include "common/system.h"
+#include "common/textconsole.h"
#include "audio/fmopl.h"
#include "audio/softsynth/emumidi.h"
diff --git a/engines/sci/sound/drivers/amigamac.cpp b/engines/sci/sound/drivers/amigamac.cpp
index d64dfac23c..7ee8d21f86 100644
--- a/engines/sci/sound/drivers/amigamac.cpp
+++ b/engines/sci/sound/drivers/amigamac.cpp
@@ -30,6 +30,8 @@
#include "common/file.h"
#include "common/frac.h"
#include "common/memstream.h"
+#include "common/system.h"
+#include "common/textconsole.h"
#include "common/util.h"
namespace Sci {
@@ -132,6 +134,7 @@ private:
};
bool _isSci1;
+ bool _isSci1Early; // KQ1 Amiga, patch 5
bool _playSwitch;
int _masterVolume;
int _frequency;
@@ -557,6 +560,7 @@ uint32 MidiDriver_AmigaMac::property(int prop, uint32 param) {
int MidiDriver_AmigaMac::open() {
_isSci1 = false;
+ _isSci1Early = false;
for (int i = 0; i < 48; i++)
_freqTable[i] = pow(2, i / (double)48);
@@ -589,9 +593,15 @@ int MidiDriver_AmigaMac::open() {
} else {
ResourceManager *resMan = g_sci->getResMan();
- Resource *resource = resMan->findResource(ResourceId(kResourceTypePatch, 7), false);
+ Resource *resource = resMan->findResource(ResourceId(kResourceTypePatch, 7), false); // Mac
if (!resource)
- resource = resMan->findResource(ResourceId(kResourceTypePatch, 9), false);
+ resource = resMan->findResource(ResourceId(kResourceTypePatch, 9), false); // Amiga
+
+ if (!resource) {
+ resource = resMan->findResource(ResourceId(kResourceTypePatch, 5), false); // KQ1 Amiga
+ if (resource)
+ _isSci1Early = true;
+ }
// If we have a patch by this point, it's SCI1
if (resource)
@@ -896,6 +906,9 @@ bool MidiDriver_AmigaMac::loadInstrumentsSCI0Mac(Common::SeekableReadStream &fil
bool MidiDriver_AmigaMac::loadInstrumentsSCI1(Common::SeekableReadStream &file) {
_bank.size = 128;
+ if (_isSci1Early)
+ file.skip(4); // TODO: What is this offset for?
+
Common::Array<uint32> instrumentOffsets;
instrumentOffsets.resize(_bank.size);
_bank.instruments.resize(_bank.size);
@@ -908,11 +921,17 @@ bool MidiDriver_AmigaMac::loadInstrumentsSCI1(Common::SeekableReadStream &file)
if (instrumentOffsets[i] == 0)
continue;
- file.seek(instrumentOffsets[i]);
+ file.seek(instrumentOffsets[i] + (_isSci1Early ? 4 : 0));
// Read in the instrument name
file.read(_bank.instruments[i].name, 10); // last two bytes are always 0
+ // TODO: Finish off support of SCI1 early patches (patch.005 - KQ1 Amiga)
+ if (_isSci1Early) {
+ warning("Music patch 5 isn't supported yet - ignoring instrument %d", i);
+ continue;
+ }
+
for (uint32 j = 0; ; j++) {
InstrumentSample *sample = new InstrumentSample;
memset(sample, 0, sizeof(InstrumentSample));
diff --git a/engines/sci/sound/drivers/cms.cpp b/engines/sci/sound/drivers/cms.cpp
index 051fa7f1fd..47c59a1e3d 100644
--- a/engines/sci/sound/drivers/cms.cpp
+++ b/engines/sci/sound/drivers/cms.cpp
@@ -29,6 +29,8 @@
#include "audio/softsynth/cms.h"
#include "audio/mixer.h"
+#include "common/system.h"
+
#include "sci/resource.h"
namespace Sci {
diff --git a/engines/sci/sound/drivers/fb01.cpp b/engines/sci/sound/drivers/fb01.cpp
index 971c2ff92d..f217738bb2 100644
--- a/engines/sci/sound/drivers/fb01.cpp
+++ b/engines/sci/sound/drivers/fb01.cpp
@@ -30,6 +30,7 @@
#include "common/file.h"
#include "common/system.h"
+#include "common/textconsole.h"
namespace Sci {
diff --git a/engines/sci/sound/drivers/midi.cpp b/engines/sci/sound/drivers/midi.cpp
index 9eef867aeb..f36aac3a2a 100644
--- a/engines/sci/sound/drivers/midi.cpp
+++ b/engines/sci/sound/drivers/midi.cpp
@@ -745,7 +745,7 @@ uint8 MidiPlayer_Midi::getGmInstrument(const Mt32ToGmMap &Mt32Ins) {
void MidiPlayer_Midi::mapMt32ToGm(byte *data, size_t size) {
// FIXME: Clean this up
int memtimbres, patches;
- uint8 group, number, keyshift, finetune, bender_range;
+ uint8 group, number, keyshift, /*finetune,*/ bender_range;
uint8 *patchpointer;
uint32 pos;
int i;
@@ -784,7 +784,7 @@ void MidiPlayer_Midi::mapMt32ToGm(byte *data, size_t size) {
group = *patchpointer;
number = *(patchpointer + 1);
keyshift = *(patchpointer + 2);
- finetune = *(patchpointer + 3);
+ //finetune = *(patchpointer + 3);
bender_range = *(patchpointer + 4);
debugCN(kDebugLevelSound, " [%03d] ", i);
diff --git a/engines/sci/sound/drivers/pcjr.cpp b/engines/sci/sound/drivers/pcjr.cpp
index 063332577e..4b1efb3c87 100644
--- a/engines/sci/sound/drivers/pcjr.cpp
+++ b/engines/sci/sound/drivers/pcjr.cpp
@@ -27,6 +27,9 @@
#include "audio/softsynth/emumidi.h"
+#include "common/debug.h"
+#include "common/system.h"
+
namespace Sci {
#define VOLUME_SHIFT 3
diff --git a/engines/sci/sound/soundcmd.cpp b/engines/sci/sound/soundcmd.cpp
index 9ad964b67e..a2b09eab4c 100644
--- a/engines/sci/sound/soundcmd.cpp
+++ b/engines/sci/sound/soundcmd.cpp
@@ -325,14 +325,6 @@ reg_t SoundCommandParser::kDoSoundFade(int argc, reg_t *argv, reg_t acc) {
return acc;
}
- // If the current volume of the slot is the same as the target volume,
- // return without performing any fading. This fixes the music in room
- // 406 in KQ6 (bug #3267956), where the game scripts ask for the background
- // music to be played, and then faded to volume 127 (but the music is
- // already at volume 127) and subsequently stopped.
- if (argc >= 4 && musicSlot->volume == CLIP<uint16>(argv[1].toUint16(), 0, MUSIC_VOLUME_MAX))
- return acc;
-
switch (argc) {
case 1: // SCI0
// SCI0 fades out all the time and when fadeout is done it will also
@@ -353,7 +345,25 @@ reg_t SoundCommandParser::kDoSoundFade(int argc, reg_t *argv, reg_t acc) {
musicSlot->fadeStep = volume > musicSlot->fadeTo ? -5 : 5;
musicSlot->fadeTickerStep = argv[2].toUint16() * 16667 / _music->soundGetTempo();
musicSlot->fadeTicker = 0;
- musicSlot->stopAfterFading = (argc == 5) ? (argv[4].toUint16() != 0) : false;
+
+ if (argc == 5) {
+ // TODO: We currently treat this argument as a boolean, but may
+ // have to handle different non-zero values differently. (e.g.,
+ // some KQ6 scripts pass 3 here)
+ musicSlot->stopAfterFading = (argv[4].toUint16() != 0);
+ } else {
+ musicSlot->stopAfterFading = false;
+ }
+
+ // WORKAROUND/HACK: In the labyrinth in KQ6, when falling in the pit and
+ // lighting the lantern, the game scripts perform a fade in of the game
+ // music, but set it to stop after fading. Remove that flag here. This is
+ // marked as both a workaround and a hack because this issue could be a
+ // problem with our fading code and an incorrect handling of that
+ // parameter, or a script bug in that scene. Fixes bug #3267956.
+ if (g_sci->getGameId() == GID_KQ6 && g_sci->getEngineState()->currentRoomNumber() == 406 &&
+ musicSlot->resourceId == 400)
+ musicSlot->stopAfterFading = false;
break;
default: