aboutsummaryrefslogtreecommitdiff
path: root/backends
diff options
context:
space:
mode:
authorJamieson Christian2002-12-01 15:51:29 +0000
committerJamieson Christian2002-12-01 15:51:29 +0000
commitcc6c37e1ad6434c7e0f4537d3753e20a39cc921a (patch)
treebaa5725fe0b2d78c565e67a7725477301b7aa4a7 /backends
parent885c0ac565d0117a3c8b11ac6978747f53d5b431 (diff)
downloadscummvm-rg350-cc6c37e1ad6434c7e0f4537d3753e20a39cc921a.tar.gz
scummvm-rg350-cc6c37e1ad6434c7e0f4537d3753e20a39cc921a.tar.bz2
scummvm-rg350-cc6c37e1ad6434c7e0f4537d3753e20a39cc921a.zip
Fixed Adlib instrument setup in old (GF_SMALL_HEADER) games.
Restored MT-32 emulation lost during restructuring. svn-id: r5786
Diffstat (limited to 'backends')
-rw-r--r--backends/midi/adlib.cpp19
1 files changed, 16 insertions, 3 deletions
diff --git a/backends/midi/adlib.cpp b/backends/midi/adlib.cpp
index cf1b453e88..f19596ffd6 100644
--- a/backends/midi/adlib.cpp
+++ b/backends/midi/adlib.cpp
@@ -503,6 +503,8 @@ public:
void send(uint32 b);
void pause(bool p) { }
void set_stream_callback(void *param, StreamCallback *sc) { } // No streaming support. Use MidiStreamer wrapper
+ uint32 property (int prop, uint32 param);
+
void setPitchBendRange (byte channel, uint range);
void sysEx_customInstrument (byte channel, uint32 type, byte *instr);
@@ -520,6 +522,7 @@ public:
private:
int _mode;
+ bool _game_SmallHeader;
FM_OPL *_opl;
byte *_adlib_reg_cache;
@@ -726,6 +729,7 @@ MidiDriver_ADLIB::MidiDriver_ADLIB()
for (i = 0; i < ARRAYSIZE(_parts); ++i) {
_parts[i].init (this);
}
+ _game_SmallHeader = false;
}
int MidiDriver_ADLIB::open (int mode)
@@ -811,6 +815,17 @@ void MidiDriver_ADLIB::send (uint32 b)
}
}
+uint32 MidiDriver_ADLIB::property (int prop, uint32 param)
+{
+ switch (prop) {
+ case PROP_SMALLHEADER: // Indicates older game, use different operator volume algorithm
+ _game_SmallHeader = (param > 0);
+ return 1;
+ }
+
+ return 0;
+}
+
void MidiDriver_ADLIB::setPitchBendRange (byte channel, uint range)
{
MidiChannelAdl *mc;
@@ -1302,9 +1317,7 @@ void MidiDriver_ADLIB::adlib_setup_channel(int chan, Instrument * instr, byte vo
port = channel_mappings[chan];
adlib_write(port + 0x20, instr->flags_1);
- // FIXME: Without using g_scumm, this may make older games sound weird.
- // Gotta transform the volume *before* it gets sent here.
- if (/*!(g_scumm->_features & GF_SMALL_HEADER)*/true ||(instr->feedback & 1))
+ if (!_game_SmallHeader ||(instr->feedback & 1))
adlib_write(port + 0x40, (instr->oplvl_1 | 0x3F) - vol_1 );
else
adlib_write(port + 0x40, instr->oplvl_1);