aboutsummaryrefslogtreecommitdiff
path: root/backends
diff options
context:
space:
mode:
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);