[Scummvm-cvs-logs] SF.net SVN: scummvm:[49926] scummvm/trunk/engines/sci/sound
m_kiewitz at users.sourceforge.net
m_kiewitz at users.sourceforge.net
Thu Jun 17 13:54:54 CEST 2010
Revision: 49926
http://scummvm.svn.sourceforge.net/scummvm/?rev=49926&view=rev
Author: m_kiewitz
Date: 2010-06-17 11:54:54 +0000 (Thu, 17 Jun 2010)
Log Message:
-----------
SCI: implemented channel muting for sci1, finally fixes lsl5 paino scene with patti
Modified Paths:
--------------
scummvm/trunk/engines/sci/sound/midiparser_sci.cpp
scummvm/trunk/engines/sci/sound/midiparser_sci.h
scummvm/trunk/engines/sci/sound/music.cpp
scummvm/trunk/engines/sci/sound/music.h
scummvm/trunk/engines/sci/sound/soundcmd.cpp
Modified: scummvm/trunk/engines/sci/sound/midiparser_sci.cpp
===================================================================
--- scummvm/trunk/engines/sci/sound/midiparser_sci.cpp 2010-06-17 11:23:51 UTC (rev 49925)
+++ scummvm/trunk/engines/sci/sound/midiparser_sci.cpp 2010-06-17 11:54:54 UTC (rev 49926)
@@ -79,6 +79,7 @@
for (int i = 0; i < 15; i++) {
_channelUsed[i] = false;
_channelRemap[i] = -1;
+ _channelMuted[i] = false;
}
_channelRemap[9] = 9; // never map channel 9, because that's used for percussion
_channelRemap[15] = 15; // never map channel 15, because thats used by sierra internally
@@ -143,8 +144,22 @@
}
void MidiParser_SCI::sendToDriver(uint32 b) {
+ byte midiChannel = b & 0xf;
+
+ if ((b & 0xFFF0) == 0x4EB0) {
+ // this is channel mute only for sci1
+ // it's velocity control for sci0
+ if (_soundVersion >= SCI_VERSION_1_EARLY) {
+ _channelMuted[midiChannel] = b & 0xFF0000 ? true : false;
+ return; // don't send this to driver at all
+ }
+ }
+
+ // Is channel muted? if so, don't send command
+ if (_channelMuted[midiChannel])
+ return;
// Channel remapping
- int16 realChannel = _channelRemap[b & 0xf];
+ int16 realChannel = _channelRemap[midiChannel];
assert(realChannel != -1);
b = (b & 0xFFFFFFF0) | realChannel;
_driver->send(b);
@@ -249,7 +264,6 @@
case 0x0A: // pan
case 0x0B: // expression
case 0x40: // sustain
- case 0x4E: // velocity control
case 0x79: // reset all
case 0x7B: // notes off
// These are all handled by the music driver, so ignore them
@@ -263,8 +277,11 @@
break;
}
}
- if (info.basic.param1 == 7) // channel volume change -scale it
+ switch (info.basic.param1) {
+ case 7: // channel volume change -scale it
info.basic.param2 = info.basic.param2 * _volume / MUSIC_VOLUME_MAX;
+ break;
+ }
info.length = 0;
break;
Modified: scummvm/trunk/engines/sci/sound/midiparser_sci.h
===================================================================
--- scummvm/trunk/engines/sci/sound/midiparser_sci.h 2010-06-17 11:23:51 UTC (rev 49925)
+++ scummvm/trunk/engines/sci/sound/midiparser_sci.h 2010-06-17 11:54:54 UTC (rev 49926)
@@ -76,9 +76,9 @@
const byte *getMixedData() const { return _mixedData; }
void tryToOwnChannels();
+ void sendToDriver(uint32 b);
protected:
- void sendToDriver(uint32 b);
void parseNextEvent(EventInfo &info);
byte *midiMixChannels();
byte *midiFilterChannels(int channelMask);
@@ -101,6 +101,7 @@
bool _channelUsed[16];
int16 _channelRemap[16];
+ bool _channelMuted[16];
};
} // End of namespace Sci
Modified: scummvm/trunk/engines/sci/sound/music.cpp
===================================================================
--- scummvm/trunk/engines/sci/sound/music.cpp 2010-06-17 11:23:51 UTC (rev 49925)
+++ scummvm/trunk/engines/sci/sound/music.cpp 2010-06-17 11:54:54 UTC (rev 49926)
@@ -446,6 +446,18 @@
_pMidiDrv->setVolume(vol);
}
+void SciMusic::sendMidiCommand(uint32 cmd) {
+ Common::StackLock lock(_mutex);
+ _pMidiDrv->send(cmd);
+}
+
+void SciMusic::sendMidiCommand(MusicEntry *pSnd, uint32 cmd) {
+ if (pSnd->pMidiParser)
+ pSnd->pMidiParser->sendToDriver(cmd);
+ else
+ warning("tried to cmdSendMidi on non midi slot (%04x:%04x)", PRINT_REG(pSnd->soundObj));
+}
+
void SciMusic::printPlayList(Console *con) {
Common::StackLock lock(_mutex);
Modified: scummvm/trunk/engines/sci/sound/music.h
===================================================================
--- scummvm/trunk/engines/sci/sound/music.h 2010-06-17 11:23:51 UTC (rev 49925)
+++ scummvm/trunk/engines/sci/sound/music.h 2010-06-17 11:54:54 UTC (rev 49926)
@@ -179,10 +179,8 @@
MusicList::iterator getPlayListStart() { return _playList.begin(); }
MusicList::iterator getPlayListEnd() { return _playList.end(); }
- void sendMidiCommand(uint32 cmd) {
- Common::StackLock lock(_mutex);
- _pMidiDrv->send(cmd);
- }
+ void sendMidiCommand(uint32 cmd);
+ void sendMidiCommand(MusicEntry *pSnd, uint32 cmd);
void setReverb(byte reverb);
Modified: scummvm/trunk/engines/sci/sound/soundcmd.cpp
===================================================================
--- scummvm/trunk/engines/sci/sound/soundcmd.cpp 2010-06-17 11:23:51 UTC (rev 49925)
+++ scummvm/trunk/engines/sci/sound/soundcmd.cpp 2010-06-17 11:54:54 UTC (rev 49926)
@@ -232,9 +232,8 @@
uint16 controller = argv[4].toUint16();
uint16 param = argv[5].toUint16();
- if (!channel)
- error("invalid channel specified on cmdSendMidi");
- channel--; // channel is given 1-based, we are using 0-based
+ if (channel)
+ channel--; // channel is given 1-based, we are using 0-based
_midiCommand = (channel | midiCmd) | ((uint32)controller << 8) | ((uint32)param << 16);
}
@@ -901,7 +900,15 @@
//SongHandle handle = FROBNICATE_HANDLE(obj);
//_state->sfx_send_midi(handle, value, _midiCmd, _controller, _param);
#else
- _music->sendMidiCommand(_midiCommand);
+ MusicEntry *musicSlot = _music->getSlot(obj);
+ if (!musicSlot) {
+ // TODO: maybe it's possible to call this with obj == 0:0 and send directly?!
+ // if so, allow it
+ //_music->sendMidiCommand(_midiCommand);
+ warning("cmdSendMidi: Slot not found (%04x:%04x)", PRINT_REG(obj));
+ return;
+ }
+ _music->sendMidiCommand(musicSlot, _midiCommand);
#endif
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list