KYRA: fix audio detection

Don't attempt to detect PC devices for non-PC versions of the game, because this might trigger unnecessary detection failure messages.
This commit is contained in:
athrxx 2011-06-05 18:28:05 +02:00
parent 43075248aa
commit 920c3bb172

View File

@ -93,15 +93,6 @@ Common::Error KyraEngine_v1::init() {
syncSoundSettings(); syncSoundSettings();
if (!_flags.useDigSound) { if (!_flags.useDigSound) {
// In Kyra 1 users who have specified a default MT-32 device in the launcher settings
// will get MT-32 music, otherwise AdLib. In Kyra 2 and LoL users who have specified a
// default GM device in the launcher will get GM music, otherwise AdLib. Users who want
// MT-32 music in Kyra2 or LoL have to select this individually (since we assume that
// most users rather have a GM device than a MT-32 device).
// Users who want PC speaker sound always have to select this individually for all
// Kyra games.
MidiDriver::DeviceHandle dev = MidiDriver::detectDevice(MDT_PCSPK | MDT_MIDI | MDT_ADLIB | ((_flags.gameID == GI_KYRA2 || _flags.gameID == GI_LOL) ? MDT_PREFER_GM : MDT_PREFER_MT32));
if (_flags.platform == Common::kPlatformFMTowns) { if (_flags.platform == Common::kPlatformFMTowns) {
if (_flags.gameID == GI_KYRA1) if (_flags.gameID == GI_KYRA1)
_sound = new SoundTowns(this, _mixer); _sound = new SoundTowns(this, _mixer);
@ -114,43 +105,53 @@ Common::Error KyraEngine_v1::init() {
_sound = new SoundTownsPC98_v2(this, _mixer); _sound = new SoundTownsPC98_v2(this, _mixer);
} else if (_flags.platform == Common::kPlatformAmiga) { } else if (_flags.platform == Common::kPlatformAmiga) {
_sound = new SoundAmiga(this, _mixer); _sound = new SoundAmiga(this, _mixer);
} else if (MidiDriver::getMusicType(dev) == MT_ADLIB) {
_sound = new SoundAdLibPC(this, _mixer);
} else { } else {
Sound::kType type; // In Kyra 1 users who have specified a default MT-32 device in the launcher settings
const MusicType midiType = MidiDriver::getMusicType(dev); // will get MT-32 music, otherwise AdLib. In Kyra 2 and LoL users who have specified a
// default GM device in the launcher will get GM music, otherwise AdLib. Users who want
if (midiType == MT_PCSPK || midiType == MT_NULL) // MT-32 music in Kyra2 or LoL have to select this individually (since we assume that
type = Sound::kPCSpkr; // most users rather have a GM device than a MT-32 device).
else if (midiType == MT_MT32 || ConfMan.getBool("native_mt32")) // Users who want PC speaker sound always have to select this individually for all
type = Sound::kMidiMT32; // Kyra games.
else MidiDriver::DeviceHandle dev = MidiDriver::detectDevice(MDT_PCSPK | MDT_MIDI | MDT_ADLIB | ((_flags.gameID == GI_KYRA2 || _flags.gameID == GI_LOL) ? MDT_PREFER_GM : MDT_PREFER_MT32));
type = Sound::kMidiGM; if (MidiDriver::getMusicType(dev) == MT_ADLIB) {
_sound = new SoundAdLibPC(this, _mixer);
MidiDriver *driver = 0;
if (MidiDriver::getMusicType(dev) == MT_PCSPK) {
driver = new MidiDriver_PCSpeaker(_mixer);
} else { } else {
driver = MidiDriver::createMidi(dev); Sound::kType type;
if (type == Sound::kMidiMT32) const MusicType midiType = MidiDriver::getMusicType(dev);
driver->property(MidiDriver::PROP_CHANNEL_MASK, 0x03FE);
}
assert(driver); if (midiType == MT_PCSPK || midiType == MT_NULL)
type = Sound::kPCSpkr;
else if (midiType == MT_MT32 || ConfMan.getBool("native_mt32"))
type = Sound::kMidiMT32;
else
type = Sound::kMidiGM;
SoundMidiPC *soundMidiPc = new SoundMidiPC(this, _mixer, driver, type); MidiDriver *driver = 0;
_sound = soundMidiPc;
assert(_sound);
// Unlike some SCUMM games, it's not that the MIDI sounds are if (MidiDriver::getMusicType(dev) == MT_PCSPK) {
// missing. It's just that at least at the time of writing they driver = new MidiDriver_PCSpeaker(_mixer);
// are decidedly inferior to the AdLib ones. } else {
if (ConfMan.getBool("multi_midi")) { driver = MidiDriver::createMidi(dev);
SoundAdLibPC *adlib = new SoundAdLibPC(this, _mixer); if (type == Sound::kMidiMT32)
assert(adlib); driver->property(MidiDriver::PROP_CHANNEL_MASK, 0x03FE);
}
_sound = new MixedSoundDriver(this, _mixer, soundMidiPc, adlib); assert(driver);
SoundMidiPC *soundMidiPc = new SoundMidiPC(this, _mixer, driver, type);
_sound = soundMidiPc;
assert(_sound);
// Unlike some SCUMM games, it's not that the MIDI sounds are
// missing. It's just that at least at the time of writing they
// are decidedly inferior to the AdLib ones.
if (ConfMan.getBool("multi_midi")) {
SoundAdLibPC *adlib = new SoundAdLibPC(this, _mixer);
assert(adlib);
_sound = new MixedSoundDriver(this, _mixer, soundMidiPc, adlib);
}
} }
} }