[Scummvm-git-logs] scummvm master -> 6843870af2812bb3471bf1ecbf75636ef5ec6f0b
csnover
csnover at users.noreply.github.com
Thu Oct 5 06:51:19 CEST 2017
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:
cedd9d3c40 SCI: Play MIDI version of SCI0 sound resource if user prefers it
6843870af2 SCI: Set default MT-32 reverb before each sound
Commit: cedd9d3c40503ec74575ea133a60c569a57238c4
https://github.com/scummvm/scummvm/commit/cedd9d3c40503ec74575ea133a60c569a57238c4
Author: Ruud Klaver (ruud at ruudklaver.com)
Date: 2017-10-04T23:29:38-05:00
Commit Message:
SCI: Play MIDI version of SCI0 sound resource if user prefers it
If the user has "Prefer digital sound effects" disabled for a SCI0
game, do not play the digital sample version of a sound resource, if
such data is present. When the resource has only digital sample data
and no MIDI information, play the sample instead.
Closes gh-1022.
Changed paths:
engines/sci/sound/music.cpp
diff --git a/engines/sci/sound/music.cpp b/engines/sci/sound/music.cpp
index 647f588..5530952 100644
--- a/engines/sci/sound/music.cpp
+++ b/engines/sci/sound/music.cpp
@@ -350,8 +350,27 @@ void SciMusic::soundInitSnd(MusicEntry *pSnd) {
pSnd->time = ++_timeCounter;
if (track) {
+ bool playSample;
+
+ if (_soundVersion <= SCI_VERSION_0_LATE && !_useDigitalSFX) {
+ // For SCI0 the digital sample is present in the same track as the
+ // MIDI. If the user specifically requests not to use the digital
+ // samples, play the MIDI data instead. If the MIDI portion of the
+ // track is empty however, play the digital sample anyway. This is
+ // necessary for e.g. the "Where am I?" sample in the SQ3 intro.
+ playSample = false;
+
+ if (track->channelCount == 2) {
+ SoundResource::Channel &chan = track->channels[0];
+ if (chan.data.size() < 2 || chan.data[1] == SCI_MIDI_EOT) {
+ playSample = true;
+ }
+ }
+ } else
+ playSample = (track->digitalChannelNr != -1);
+
// Play digital sample
- if (track->digitalChannelNr != -1) {
+ if (playSample) {
const SciSpan<const byte> &channelData = track->channels[track->digitalChannelNr].data;
delete pSnd->pStreamAud;
byte flags = Audio::FLAG_UNSIGNED;
Commit: 6843870af2812bb3471bf1ecbf75636ef5ec6f0b
https://github.com/scummvm/scummvm/commit/6843870af2812bb3471bf1ecbf75636ef5ec6f0b
Author: Ruud Klaver (ruud at ruudklaver.com)
Date: 2017-10-04T23:47:21-05:00
Commit Message:
SCI: Set default MT-32 reverb before each sound
Set the default reverb configuration present in either the MT-32
patch data or MT32.DRV of SCI0 games before playing each sound, as
a previously played sound may have changed it.
Also, do not perform a general reverb init, since the start of a
sound will do that now.
Closes gh-1023.
Changed paths:
engines/sci/sound/drivers/midi.cpp
engines/sci/sound/drivers/mididriver.h
engines/sci/sound/midiparser_sci.cpp
diff --git a/engines/sci/sound/drivers/midi.cpp b/engines/sci/sound/drivers/midi.cpp
index 3f6149d..46d08a5 100644
--- a/engines/sci/sound/drivers/midi.cpp
+++ b/engines/sci/sound/drivers/midi.cpp
@@ -158,6 +158,7 @@ public:
int getFirstChannel() const;
int getLastChannel() const;
void setVolume(byte volume);
+ virtual void onNewSound() override;
int getVolume();
void setReverb(int8 reverb);
void playSwitch(bool play);
@@ -204,6 +205,7 @@ private:
int _masterVolume;
byte _reverbConfig[kReverbConfigNr][3];
+ int8 _defaultReverb;
Channel _channels[16];
uint8 _percussionMap[128];
int8 _keyShift[128];
@@ -220,7 +222,7 @@ private:
byte _sysExBuf[kMaxSysExSize];
};
-MidiPlayer_Midi::MidiPlayer_Midi(SciVersion version) : MidiPlayer(version), _playSwitch(true), _masterVolume(15), _mt32Type(kMt32TypeNone), _hasReverb(false), _useMT32Track(true) {
+MidiPlayer_Midi::MidiPlayer_Midi(SciVersion version) : MidiPlayer(version), _playSwitch(true), _masterVolume(15), _mt32Type(kMt32TypeNone), _hasReverb(false), _defaultReverb(-1), _useMT32Track(true) {
MidiDriver::DeviceHandle dev = MidiDriver::detectDevice(MDT_MIDI);
_driver = MidiDriver::createMidi(dev);
@@ -477,6 +479,14 @@ int MidiPlayer_Midi::getVolume() {
return _masterVolume;
}
+void MidiPlayer_Midi::onNewSound() {
+ if (_defaultReverb >= 0)
+ // SCI0 in combination with MT-32 requires a reset of the reverb to
+ // the default value that is present in either the MT-32 patch data
+ // or MT32.DRV itself.
+ setReverb(_defaultReverb);
+}
+
void MidiPlayer_Midi::setReverb(int8 reverb) {
assert(reverb < kReverbConfigNr);
@@ -610,7 +620,7 @@ void MidiPlayer_Midi::readMt32Patch(const SciSpan<const byte> &data) {
setMt32Volume(volume);
// Reverb default only used in (roughly) SCI0/SCI01
- byte reverb = stream.readByte();
+ _defaultReverb = stream.readSByte();
_hasReverb = true;
@@ -649,10 +659,6 @@ void MidiPlayer_Midi::readMt32Patch(const SciSpan<const byte> &data) {
sendMt32SysEx(0x100004, stream, 9);
}
- // Reverb for SCI0
- if (_version <= SCI_VERSION_0_LATE)
- setReverb(reverb);
-
// Send after-SysEx text
stream.seek(0);
sendMt32SysEx(0x200000, stream, 20);
@@ -780,7 +786,7 @@ void MidiPlayer_Midi::readMt32DrvData() {
if (size == 2771) {
// MT32.DRV in LSL2 early contains more data, like a normal patch
- byte reverb = f.readByte();
+ _defaultReverb = f.readByte();
_hasReverb = true;
@@ -800,8 +806,6 @@ void MidiPlayer_Midi::readMt32DrvData() {
sendMt32SysEx(0x50000, f, 256);
sendMt32SysEx(0x50200, f, 128);
- setReverb(reverb);
-
// Send the after-SysEx text
f.seek(0x3d);
sendMt32SysEx(0x200000, f, 20);
diff --git a/engines/sci/sound/drivers/mididriver.h b/engines/sci/sound/drivers/mididriver.h
index fee0154..f12d47f 100644
--- a/engines/sci/sound/drivers/mididriver.h
+++ b/engines/sci/sound/drivers/mididriver.h
@@ -106,6 +106,8 @@ public:
return _driver ? _driver->property(MIDI_PROP_MASTER_VOLUME, 0xffff) : 0;
}
+ virtual void onNewSound() {}
+
// Returns the current reverb, or -1 when no reverb is active
int8 getReverb() const { return _reverb; }
// Sets the current reverb, used mainly in MT-32
diff --git a/engines/sci/sound/midiparser_sci.cpp b/engines/sci/sound/midiparser_sci.cpp
index bdd0d1b..1644eb6 100644
--- a/engines/sci/sound/midiparser_sci.cpp
+++ b/engines/sci/sound/midiparser_sci.cpp
@@ -392,6 +392,8 @@ void MidiParser_SCI::sendInitCommands() {
// Set initial voice count
if (_pSnd) {
if (_soundVersion <= SCI_VERSION_0_LATE) {
+ static_cast<MidiPlayer *>(_driver)->onNewSound();
+
for (int i = 0; i < 15; ++i) {
byte voiceCount = 0;
if (_channelUsed[i]) {
More information about the Scummvm-git-logs
mailing list