[Scummvm-git-logs] scummvm master -> e052fee77f18d68a657b46927586663f84941038
athrxx
noreply at scummvm.org
Tue Sep 13 20:14:20 UTC 2022
This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
f5bfc7b60a SCUMM: (IMS) - improve transpose precision
e052fee77f SCUMM: (IMS) - cleanup sound init process
Commit: f5bfc7b60a39c96a0c59eea0e2f0756ddc27e074
https://github.com/scummvm/scummvm/commit/f5bfc7b60a39c96a0c59eea0e2f0756ddc27e074
Author: athrxx (athrxx at scummvm.org)
Date: 2022-09-13T22:13:43+02:00
Commit Message:
SCUMM: (IMS) - improve transpose precision
(I have checked some more drivers. It seems that the AdLib and PC Speaker
drivers of the earlier games have larger boundaries, the MT-32 drivers have
smaller ones)
Changed paths:
engines/scumm/imuse/imuse_part.cpp
engines/scumm/imuse/imuse_player.cpp
engines/scumm/imuse/sysex_scumm.cpp
diff --git a/engines/scumm/imuse/imuse_part.cpp b/engines/scumm/imuse/imuse_part.cpp
index fda371a0aa1..b7a7afbc108 100644
--- a/engines/scumm/imuse/imuse_part.cpp
+++ b/engines/scumm/imuse/imuse_part.cpp
@@ -185,7 +185,7 @@ void Part::effectLevel(byte value) {
}
void Part::fix_after_load() {
- int lim = (_se->_game_id == GID_TENTACLE || _se->_isAmiga) ? 12 : 24;
+ int lim = (_se->_game_id == GID_TENTACLE || _se->_isAmiga || _se->isNativeMT32()) ? 12 : 24;
set_transpose(_transpose, -lim, lim);
volume(_vol);
set_detune(_detune);
@@ -380,24 +380,31 @@ void Part::sendPitchBend() {
transpose = 0;
} else if (_player->isAdLibOrFMTowns()) {
transpose = detune = 0;
- } else if (_player->_se->isNativeMT32()) {
- // RPN-based pitchbend range doesn't work for the MT32, so we'll do the scaling ourselves.
- bend = bend * _pitchbend_factor / 12;
}
- if (_player->isGM()) {
+ bool oldPitchBendFormula = true;
+
+ if (_player->isGM() || _player->_se->isNativeMT32()) {
if (_se->_game_id == GID_SAMNMAX) {
- // SAMNMAX formula
+ // SAMNMAX formula (same for Roland MT-32 and GM)
bend = _pitchbend_factor ? (bend * _pitchbend_factor) >> 5 : bend >> 6;
- bend = (bend + _detune_eff + (transpose << 8)) << 1;
- } else {
- // DOTT formula (from the DOTT GMIDI.IMS driver)
- bend = clamp(((bend * _pitchbend_factor) >> 6) + _detune_eff + (transpose << 7), -2048, 2047) << 2;
+ bend = (bend + detune + (transpose << 8)) << 1;
+ oldPitchBendFormula = false;
+ } else if (_se->_game_id == GID_TENTACLE || _se->_game_id == GID_INDY4 || _se->_game_id == GID_MONKEY2) {
+ // DOTT, INDY4 and MI2 formula (same for Roland MT-32 and GM)
+ bend = clamp(((bend * _pitchbend_factor) >> 6) + detune + (transpose << 7), -2048, 2047) << 2;
+ oldPitchBendFormula = false;
+ } else if (_se->isNativeMT32()) {
+ // RPN-based pitchbend range doesn't work for the MT32, so we'll do the scaling ourselves.
+ // athrxx: I haven't yet seen any evidence of this in any original driver. But I still
+ // haven't checked absolutely everything, so let's keep it around until we know better...
+ bend = bend * _pitchbend_factor / 12;
}
- } else {
- bend = clamp(bend + (_detune_eff * 64 / 12) + (transpose * 8192 / 12), -8192, 8191);
}
+ if (oldPitchBendFormula)
+ bend = clamp(bend + (detune * 64 / 12) + (transpose * 8192 / 12), -8192, 8191);
+
_mc->pitchBend(bend);
}
diff --git a/engines/scumm/imuse/imuse_player.cpp b/engines/scumm/imuse/imuse_player.cpp
index 4b99e6a4b02..8230203bc45 100644
--- a/engines/scumm/imuse/imuse_player.cpp
+++ b/engines/scumm/imuse/imuse_player.cpp
@@ -577,8 +577,8 @@ int Player::setTranspose(byte relative, int b) {
_transpose = b;
- // MI2 and INDY4 use bounds of -24/24, DOTT uses -12/12.
- int lim = (_se->_game_id == GID_TENTACLE) ? 12 : 24;
+ // MI2 and INDY4 use boundaries of -12/12 for MT-32 and -24/24 for AdLib and PC Speaker, DOTT uses -12/12 for everything.
+ int lim = (_se->_game_id == GID_TENTACLE || _se->isNativeMT32()) ? 12 : 24;
for (part = _parts; part; part = part->_next)
part->set_transpose(part->_transpose, -lim, lim);
@@ -597,8 +597,8 @@ void Player::part_set_transpose(uint8 chan, byte relative, int8 b) {
if (relative)
b = transpose_clamp(b + part->_transpose, -7, 7);
- // MI2 and INDY4 use bounds of -24/24, DOTT uses -12/12.
- int lim = (_se->_game_id == GID_TENTACLE) ? 12 : 24;
+ // MI2 and INDY4 use boundaries of -12/12 for MT-32 and -24/24 for AdLib and PC Speaker, DOTT uses -12/12 for everything.
+ int lim = (_se->_game_id == GID_TENTACLE || _se->isNativeMT32()) ? 12 : 24;
part->set_transpose(b, -lim, lim);
}
diff --git a/engines/scumm/imuse/sysex_scumm.cpp b/engines/scumm/imuse/sysex_scumm.cpp
index b126e87585a..20f5bdcf1ce 100644
--- a/engines/scumm/imuse/sysex_scumm.cpp
+++ b/engines/scumm/imuse/sysex_scumm.cpp
@@ -72,8 +72,9 @@ void sysexHandler_Scumm(Player *player, const byte *msg, uint16 len) {
part->volume(buf[3]);
part->set_pan(buf[4]);
part->_percussion = player->_supportsPercussion ? ((buf[5] & 0x80) > 0) : false;
- // The original intepreter uses a different clipping range for MI2 and INDY4 here,
- // instead of the usual -24/24. DOTT always uses -12/12.
+ // The original MI2 and INDY4 drivers always use -12/12 boundaries here, even for the
+ // AdLib and PC Speaker drivers which use -24/24 in other locations. DOTT does not
+ // have/use this sysex code any more, but even at other locations it always uses -12/12.
part->set_transpose(buf[5], -12, 12);
part->set_detune(buf[6]);
part->pitchBendFactor(buf[7]);
Commit: e052fee77f18d68a657b46927586663f84941038
https://github.com/scummvm/scummvm/commit/e052fee77f18d68a657b46927586663f84941038
Author: athrxx (athrxx at scummvm.org)
Date: 2022-09-13T22:13:53+02:00
Commit Message:
SCUMM: (IMS) - cleanup sound init process
Reduce abuse of the property function to set init vars.
Better distinction between drivers to prevent a GM init on
the Mac driver (which could happen depending on the
launcher sound setting).
Changed paths:
audio/mididrv.h
engines/scumm/imuse/imuse.cpp
engines/scumm/imuse/imuse.h
engines/scumm/imuse/imuse_internal.h
engines/scumm/imuse/imuse_part.cpp
engines/scumm/imuse/imuse_player.cpp
engines/scumm/players/player_ad.cpp
engines/scumm/players/player_mac.cpp
engines/scumm/scumm.cpp
engines/scumm/scumm.h
diff --git a/audio/mididrv.h b/audio/mididrv.h
index 1c950b6d494..adc85b6e905 100644
--- a/audio/mididrv.h
+++ b/audio/mididrv.h
@@ -92,7 +92,8 @@ enum MidiDriverFlags {
MDT_MIDI = 1 << 10, // Real MIDI
MDT_PREFER_MT32 = 1 << 11, // MT-32 output is preferred
MDT_PREFER_GM = 1 << 12, // GM output is preferred
- MDT_PREFER_FLUID= 1 << 13 // FluidSynth driver is preferred
+ MDT_PREFER_FLUID= 1 << 13, // FluidSynth driver is preferred
+ MDT_MACINTOSH = 1 << 14
};
/**
diff --git a/engines/scumm/imuse/imuse.cpp b/engines/scumm/imuse/imuse.cpp
index efae39612a8..2e2f095ba91 100644
--- a/engines/scumm/imuse/imuse.cpp
+++ b/engines/scumm/imuse/imuse.cpp
@@ -43,10 +43,9 @@ namespace Scumm {
//
////////////////////////////////////////
-IMuseInternal::IMuseInternal(Common::Mutex &mutex) :
- _native_mt32(false),
- _enable_gs(false),
- _isAmiga(false),
+IMuseInternal::IMuseInternal(ScummEngine *vm, MidiDriverFlags sndType, uint32 initFlags) :
+ _native_mt32((initFlags & kFlagNativeMT32) || (initFlags & kFlagRolandGS)), // GS Mode emulates MT-32 on a GS device, so _native_mt32 should always be true
+ _enable_gs(initFlags & kFlagRolandGS),
_midi_adlib(nullptr),
_midi_native(nullptr),
_sysex(nullptr),
@@ -65,8 +64,9 @@ IMuseInternal::IMuseInternal(Common::Mutex &mutex) :
_music_volume(0),
_trigger_count(0),
_snm_trigger_index(0),
- _pcSpeaker(false),
- _mutex(mutex) {
+ _soundType(sndType),
+ _game_id(vm->_game.id),
+ _mutex(vm->_mixer->mutex()) {
memset(_channel_volume, 0, sizeof(_channel_volume));
memset(_channel_volume_eff, 0, sizeof(_channel_volume_eff));
memset(_volchan_table, 0, sizeof(_volchan_table));
@@ -164,7 +164,7 @@ bool IMuseInternal::isMT32(int sound) {
return false;
case MKTAG('R', 'O', 'L', ' '): // Unfortunately FOA Amiga also uses this resource type
- return !_isAmiga;
+ return _soundType != MDT_AMIGA && _soundType != MDT_MACINTOSH;
case MKTAG('M', 'A', 'C', ' '): // Occurs in the Mac version of FOA and MI2
return false;
@@ -253,7 +253,7 @@ bool IMuseInternal::supportsPercussion(int sound) {
return false;
case MKTAG('R', 'O', 'L', ' '): // Roland LAPC/MT-32/CM32L track, but also used by INDY4 Amiga
- return !_isAmiga;
+ return _soundType != MDT_AMIGA && _soundType != MDT_MACINTOSH;
case MKTAG('M', 'A', 'C', ' '): // Occurs in the Mac version of FOA and MI2
// This is MIDI, i.e. uses MIDI style program changes, but without a
@@ -465,6 +465,7 @@ int32 IMuseInternal::doCommand(int numargs, int a[]) {
return doCommand_internal(numargs, a);
}
+
uint32 IMuseInternal::property(int prop, uint32 value) {
Common::StackLock lock(_mutex, "IMuseInternal::property()");
switch (prop) {
@@ -476,32 +477,6 @@ uint32 IMuseInternal::property(int prop, uint32 value) {
_tempoFactor = value;
break;
- case IMuse::PROP_NATIVE_MT32:
- _native_mt32 = (value > 0);
- Instrument::nativeMT32(_native_mt32);
- if (_midi_native && _native_mt32)
- initMT32(_midi_native);
- break;
-
- case IMuse::PROP_GS:
- _enable_gs = (value > 0);
-
- if (_midi_native) {
- if (_enable_gs) {
- // GS Mode emulates MT-32 on a GS device, so _native_mt32 should always be true
- _native_mt32 = true;
- initGS(_midi_native);
- } else if (!_native_mt32) {
- // If GS is disabled we do the "normal" init from the original GM drivers.
- initGM();
- }
- }
- break;
-
- case IMuse::PROP_AMIGA:
- _isAmiga = (value > 0);
- break;
-
case IMuse::PROP_LIMIT_PLAYERS:
if (value > 0 && value <= ARRAYSIZE(_players))
_player_limit = (int)value;
@@ -511,14 +486,6 @@ uint32 IMuseInternal::property(int prop, uint32 value) {
_recycle_players = (value != 0);
break;
- case IMuse::PROP_GAME_ID:
- _game_id = value;
- break;
-
- case IMuse::PROP_PC_SPEAKER:
- _pcSpeaker = (value != 0);
- break;
-
default:
break;
}
@@ -1436,9 +1403,9 @@ int IMuseInternal::get_volchan_entry(uint a) {
return -1;
}
-IMuseInternal *IMuseInternal::create(OSystem *syst, MidiDriver *nativeMidiDriver, MidiDriver *adlibMidiDriver) {
- IMuseInternal *i = new IMuseInternal(syst->getMixer()->mutex());
- i->initialize(syst, nativeMidiDriver, adlibMidiDriver);
+IMuseInternal *IMuseInternal::create(ScummEngine *vm, MidiDriver *nativeMidiDriver, MidiDriver *adlibMidiDriver, MidiDriverFlags sndType, uint32 initFlags) {
+ IMuseInternal *i = new IMuseInternal(vm, sndType, initFlags);
+ i->initialize(vm->_system, nativeMidiDriver, adlibMidiDriver);
return i;
}
@@ -1470,6 +1437,18 @@ int IMuseInternal::initialize(OSystem *syst, MidiDriver *native_midi, MidiDriver
init_queue();
init_parts();
+ if (_midi_native && _soundType != MDT_MACINTOSH && _soundType != MDT_AMIGA) {
+ if (_native_mt32 && !_enable_gs) {
+ Instrument::nativeMT32(_native_mt32);
+ initMT32(_midi_native);
+ } else if (_enable_gs) {
+ initGS(_midi_native);
+ } else if (!_native_mt32) {
+ // If GS is disabled we do the "normal" init from the original GM drivers.
+ initGM();
+ }
+ }
+
_initialized = true;
return 0;
@@ -1629,8 +1608,6 @@ void IMuseInternal::initGS(MidiDriver *midi) {
}
void IMuseInternal::initGM() {
- if (!_midi_native || _native_mt32 || _enable_gs || _isAmiga)
- return;
// These are the init messages from the DOTT General Midi
// driver. This is the major part of the bug fix for bug
// no. 13460 ("DOTT: Incorrect MIDI pitch bending").
@@ -1779,7 +1756,7 @@ void IMuseInternal::reallocateMidiChannels(MidiDriver *midi) {
void IMuseInternal::setGlobalInstrument(byte slot, byte *data) {
if (slot < 32) {
- if (_pcSpeaker)
+ if (_soundType == MDT_PCSPK)
_global_instruments[slot].pcspk(data);
else
_global_instruments[slot].adlib(data);
@@ -1799,7 +1776,7 @@ void IMuseInternal::copyGlobalInstrument(byte slot, Instrument *dest) {
if (_global_instruments[slot].isValid()) {
// In case we have an valid instrument set up, copy it to the part.
_global_instruments[slot].copy_to(dest);
- } else if (_pcSpeaker) {
+ } else if (_soundType == MDT_PCSPK) {
debug(0, "Trying to use non-existent global PC Speaker instrument %d", slot);
dest->pcspk(defaultInstr);
} else {
@@ -1819,8 +1796,8 @@ void IMuseInternal::copyGlobalInstrument(byte slot, Instrument *dest) {
* of the implementation to be changed and updated
* without requiring a recompile of the client code.
*/
-IMuse *IMuse::create(OSystem *syst, MidiDriver *nativeMidiDriver, MidiDriver *adlibMidiDriver) {
- IMuseInternal *engine = IMuseInternal::create(syst, nativeMidiDriver, adlibMidiDriver);
+IMuse *IMuse::create(ScummEngine *vm, MidiDriver *nativeMidiDriver, MidiDriver *adlibMidiDriver, MidiDriverFlags sndType, uint32 flags) {
+ IMuseInternal *engine = IMuseInternal::create(vm, nativeMidiDriver, adlibMidiDriver, sndType, flags);
return engine;
}
diff --git a/engines/scumm/imuse/imuse.h b/engines/scumm/imuse/imuse.h
index 156e9199f82..7924bcf409b 100644
--- a/engines/scumm/imuse/imuse.h
+++ b/engines/scumm/imuse/imuse.h
@@ -22,6 +22,7 @@
#ifndef SCUMM_IMUSE_H
#define SCUMM_IMUSE_H
+#include "audio/mididrv.h"
#include "common/scummsys.h"
#include "common/serializer.h"
#include "common/mutex.h"
@@ -50,13 +51,13 @@ class IMuse : public MusicEngine {
public:
enum {
PROP_TEMPO_BASE,
- PROP_NATIVE_MT32,
- PROP_GS,
- PROP_AMIGA,
PROP_LIMIT_PLAYERS,
- PROP_RECYCLE_PLAYERS,
- PROP_GAME_ID,
- PROP_PC_SPEAKER
+ PROP_RECYCLE_PLAYERS
+ };
+
+ enum {
+ kFlagNativeMT32 = 1 << 0,
+ kFlagRolandGS = 1 << 1
};
public:
@@ -77,7 +78,7 @@ public:
public:
// Factory methods
- static IMuse *create(OSystem *syst, MidiDriver *nativeMidiDriver, MidiDriver *adlibMidiDriver);
+ static IMuse *create(ScummEngine *vm, MidiDriver *nativeMidiDriver, MidiDriver *adlibMidiDriver, MidiDriverFlags sndType, uint32 flags);
};
} // End of namespace Scumm
diff --git a/engines/scumm/imuse/imuse_internal.h b/engines/scumm/imuse/imuse_internal.h
index d8d2f2c64eb..a5f3ecc9d7e 100644
--- a/engines/scumm/imuse/imuse_internal.h
+++ b/engines/scumm/imuse/imuse_internal.h
@@ -406,15 +406,15 @@ class IMuseInternal : public IMuse {
#endif
protected:
- bool _native_mt32;
- bool _enable_gs;
- bool _isAmiga;
+ const bool _native_mt32;
+ const bool _enable_gs;
+ const MidiDriverFlags _soundType;
MidiDriver *_midi_adlib;
MidiDriver *_midi_native;
TimerCallbackInfo _timer_info_adlib;
TimerCallbackInfo _timer_info_native;
- uint32 _game_id;
+ const uint32 _game_id;
// Plug-in SysEx handling. Right now this only supports one
// custom SysEx handler for the hardcoded IMUSE_SYSEX_ID
@@ -453,13 +453,12 @@ protected:
Player _players[8];
Part _parts[32];
- bool _pcSpeaker;
Instrument _global_instruments[32];
CommandQueue _cmd_queue[64];
DeferredCommand _deferredCommands[4];
protected:
- IMuseInternal(Common::Mutex &mutex);
+ IMuseInternal(ScummEngine *vm, MidiDriverFlags sndType, uint32 initFlags);
~IMuseInternal() override;
int initialize(OSystem *syst, MidiDriver *nativeMidiDriver, MidiDriver *adlibMidiDriver);
@@ -555,7 +554,7 @@ public:
public:
// Factory function
- static IMuseInternal *create(OSystem *syst, MidiDriver *nativeMidiDriver, MidiDriver *adlibMidiDriver);
+ static IMuseInternal *create(ScummEngine *vm, MidiDriver *nativeMidiDriver, MidiDriver *adlibMidiDriver, MidiDriverFlags sndType, uint32 initFlags);
};
} // End of namespace Scumm
diff --git a/engines/scumm/imuse/imuse_part.cpp b/engines/scumm/imuse/imuse_part.cpp
index b7a7afbc108..2638a9585f1 100644
--- a/engines/scumm/imuse/imuse_part.cpp
+++ b/engines/scumm/imuse/imuse_part.cpp
@@ -154,8 +154,8 @@ void Part::set_transpose(int8 transpose, int8 clipRangeLow, int8 clipRangeHi) {
// The Amiga versions have a signed/unsigned bug which makes the check for _transpose == -128 impossible. They actually check for
// a value of 128 with a signed int8 (a signed int8 can never be 128). The playback depends on this being implemented exactly
// like in the original driver. I found this bug with the WinUAE debugger. The DOS versions do not have that bug.
- _transpose_eff = (!_se->_isAmiga && _transpose == -128) ? 0 : transpose_clamp(_transpose + _player->getTranspose(), clipRangeLow, clipRangeHi);
- if (_player->isAdLibOrFMTowns() || _se->_isAmiga)
+ _transpose_eff = (_se->_soundType != MDT_AMIGA && _transpose == -128) ? 0 : transpose_clamp(_transpose + _player->getTranspose(), clipRangeLow, clipRangeHi);
+ if (_player->isAdLibOrFMTowns() || _se->_soundType == MDT_AMIGA)
sendTranspose();
else
sendPitchBend();
@@ -185,7 +185,7 @@ void Part::effectLevel(byte value) {
}
void Part::fix_after_load() {
- int lim = (_se->_game_id == GID_TENTACLE || _se->_isAmiga || _se->isNativeMT32()) ? 12 : 24;
+ int lim = (_se->_game_id == GID_TENTACLE || _se->_soundType == MDT_AMIGA|| _se->isNativeMT32()) ? 12 : 24;
set_transpose(_transpose, -lim, lim);
volume(_vol);
set_detune(_detune);
@@ -214,7 +214,7 @@ void Part::set_onoff(bool on) {
}
void Part::set_instrument(byte *data) {
- if (_se->_pcSpeaker)
+ if (_se->_soundType == MDT_PCSPK)
_instrument.pcspk(data);
else
_instrument.adlib(data);
@@ -376,7 +376,7 @@ void Part::sendPitchBend() {
// For Amiga, AdLib and FM-Towns we send some values separately due to the way the drivers have
// been implemented (it must be avoided that the pitchbend factor gets applied on top). So we
// neutralize them here for the pitch bend calculation.
- if (_se->_isAmiga) {
+ if (_se->_soundType == MDT_AMIGA) {
transpose = 0;
} else if (_player->isAdLibOrFMTowns()) {
transpose = detune = 0;
@@ -413,7 +413,7 @@ void Part::sendTranspose() {
return;
// Some drivers handle the transpose and the detune in pitchBend()...
- if (!_se->_isAmiga && !_player->isAdLibOrFMTowns())
+ if (_se->_soundType != MDT_AMIGA && !_player->isAdLibOrFMTowns())
return;
_mc->transpose(_transpose_eff);
diff --git a/engines/scumm/imuse/imuse_player.cpp b/engines/scumm/imuse/imuse_player.cpp
index 8230203bc45..73a4c75dbbf 100644
--- a/engines/scumm/imuse/imuse_player.cpp
+++ b/engines/scumm/imuse/imuse_player.cpp
@@ -112,7 +112,7 @@ bool Player::startSound(int sound, MidiDriver *midi) {
// IMuseInternal::supportsPercussion() filters out more non-MIDI things than IMuseInternal::isMIDI(),
// but still not the AdLib in Samnmax, so we make an extra test for that...
_isGM = (_supportsPercussion && !(_se->_game_id == GID_SAMNMAX && !_se->_midi_native && _se->_midi_adlib) && !_isMT32);
- _isAdLibOrFMTowns = (_se->_midi_adlib && !_isMT32 && !_isGM && !_se->_pcSpeaker);
+ _isAdLibOrFMTowns = (_se->_midi_adlib && !_isMT32 && !_isGM && _se->_soundType != MDT_PCSPK);
_parts = nullptr;
_active = true;
@@ -393,7 +393,7 @@ void Player::sysEx(const byte *p, uint16 len) {
if (a == ROLAND_SYSEX_ID) {
// Roland custom instrument definition.
// There is at least one (pointless) attempt in INDY4 Amiga to send this, too.
- if ((_isMIDI && !_se->_isAmiga) || _isMT32) {
+ if ((_isMIDI && _se->_soundType != MDT_AMIGA) || _isMT32) {
part = getPart(p[0] & 0x0F);
if (part) {
part->_instrument.roland(p - 1);
@@ -1041,7 +1041,7 @@ void Player::fixAfterLoad() {
// IMuseInternal::supportsPercussion() filters out more non-MIDI things than IMuseInternal::isMIDI(),
// but still not the AdLib in SAMNMAX, so we make an extra test for that...
_isGM = (_supportsPercussion && !(_se->_game_id == GID_SAMNMAX && !_se->_midi_native && _se->_midi_adlib) && !_isMT32);
- _isAdLibOrFMTowns = (_se->_midi_adlib && !_isMT32 && !_isGM && !_se->_pcSpeaker);
+ _isAdLibOrFMTowns = (_se->_midi_adlib && !_isMT32 && !_isGM && _se->_soundType != MDT_PCSPK);
}
}
diff --git a/engines/scumm/players/player_ad.cpp b/engines/scumm/players/player_ad.cpp
index be0033e0cee..84fffb62fc4 100644
--- a/engines/scumm/players/player_ad.cpp
+++ b/engines/scumm/players/player_ad.cpp
@@ -194,7 +194,7 @@ void Player_AD::saveLoadWithSerializer(Common::Serializer &s) {
Common::StackLock lock(_mutex);
if (s.getVersion() < VER(95)) {
- IMuse *dummyImuse = IMuse::create(_vm->_system, nullptr, nullptr);
+ IMuse *dummyImuse = IMuse::create(_vm, nullptr, nullptr, MDT_ADLIB, 0);
dummyImuse->saveLoadIMuse(s, _vm, false);
delete dummyImuse;
return;
diff --git a/engines/scumm/players/player_mac.cpp b/engines/scumm/players/player_mac.cpp
index 93128e10b65..ed8be915010 100644
--- a/engines/scumm/players/player_mac.cpp
+++ b/engines/scumm/players/player_mac.cpp
@@ -111,7 +111,7 @@ void Player_Mac::saveLoadWithSerializer(Common::Serializer &s) {
Common::StackLock lock(_mutex);
if (s.getVersion() < VER(94)) {
if (_vm->_game.id == GID_MONKEY && s.isLoading()) {
- IMuse *dummyImuse = IMuse::create(_vm->_system, nullptr, nullptr);
+ IMuse *dummyImuse = IMuse::create(_vm, nullptr, nullptr, MDT_NONE, 0);
dummyImuse->saveLoadIMuse(s, _vm, false);
delete dummyImuse;
}
diff --git a/engines/scumm/scumm.cpp b/engines/scumm/scumm.cpp
index 22aaf320ba5..3f0178f12aa 100644
--- a/engines/scumm/scumm.cpp
+++ b/engines/scumm/scumm.cpp
@@ -1952,10 +1952,7 @@ void ScummEngine::setupMusic(int midi, const Common::String &macInstrumentFile)
}
// DOTT + SAM use General MIDI, so they shouldn't use GS settings
- if ((_game.id == GID_TENTACLE) || (_game.id == GID_SAMNMAX))
- _enable_gs = false;
- else
- _enable_gs = ConfMan.getBool("enable_gs");
+ bool enable_gs = (_game.id == GID_TENTACLE || _game.id == GID_SAMNMAX) ? false : ConfMan.getBool("enable_gs");
/* Bind the mixer to the system => mixer will be invoked
* automatically when samples need to be generated */
@@ -2040,7 +2037,7 @@ void ScummEngine::setupMusic(int midi, const Common::String &macInstrumentFile)
useOnlyNative = true;
} else if (_sound->_musicType == MDT_AMIGA) {
nativeMidiDriver = new IMuseDriver_Amiga(_mixer);
- _native_mt32 = _enable_gs = false;
+ _native_mt32 = enable_gs = false;
useOnlyNative = true;
} else if (_sound->_musicType != MDT_ADLIB && _sound->_musicType != MDT_TOWNS && _sound->_musicType != MDT_PCSPK) {
nativeMidiDriver = MidiDriver::createMidi(dev);
@@ -2062,7 +2059,13 @@ void ScummEngine::setupMusic(int midi, const Common::String &macInstrumentFile)
}
}
- _imuse = IMuse::create(_system, nativeMidiDriver, adlibMidiDriver);
+ uint32 imsFlags = 0;
+ if (_native_mt32)
+ imsFlags |= IMuse::kFlagNativeMT32;
+ if (enable_gs && MidiDriver::getMusicType(dev) != MT_MT32)
+ imsFlags |= IMuse::kFlagRolandGS;
+
+ _imuse = IMuse::create(this, nativeMidiDriver, adlibMidiDriver, isMacM68kIMuse() ? MDT_MACINTOSH : _sound->_musicType, imsFlags);
if (_game.platform == Common::kPlatformFMTowns) {
_musicEngine = _townsPlayer = new Player_Towns_v2(this, _mixer, _imuse, true);
@@ -2076,22 +2079,12 @@ void ScummEngine::setupMusic(int midi, const Common::String &macInstrumentFile)
_imuse->addSysexHandler
(/*IMUSE_SYSEX_ID*/ 0x7D,
(_game.id == GID_SAMNMAX) ? sysexHandler_SamNMax : sysexHandler_Scumm);
- _imuse->property(IMuse::PROP_GAME_ID, _game.id);
if (ConfMan.hasKey("tempo"))
_imuse->property(IMuse::PROP_TEMPO_BASE, ConfMan.getInt("tempo"));
- if (midi != MDT_NONE) {
- _imuse->property(IMuse::PROP_NATIVE_MT32, _native_mt32);
- if (MidiDriver::getMusicType(dev) != MT_MT32) // MT-32 Emulation shouldn't be GM/GS initialized
- _imuse->property(IMuse::PROP_GS, _enable_gs);
- }
if (_game.heversion >= 60) {
_imuse->property(IMuse::PROP_LIMIT_PLAYERS, 1);
_imuse->property(IMuse::PROP_RECYCLE_PLAYERS, 1);
}
- if (_sound->_musicType == MDT_PCSPK)
- _imuse->property(IMuse::PROP_PC_SPEAKER, 1);
- if (_sound->_musicType == MDT_AMIGA)
- _imuse->property(IMuse::PROP_AMIGA, 1);
}
}
}
diff --git a/engines/scumm/scumm.h b/engines/scumm/scumm.h
index 06355359249..4b114680d4d 100644
--- a/engines/scumm/scumm.h
+++ b/engines/scumm/scumm.h
@@ -1385,7 +1385,6 @@ protected:
uint16 _defaultTextSpeed = 0;
int _saveSound = 0;
bool _native_mt32 = false;
- bool _enable_gs = false;
bool _copyProtection = false;
// Indy4 Amiga specific
More information about the Scummvm-git-logs
mailing list