aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorFilippos Karapetis2010-06-04 15:01:26 +0000
committerFilippos Karapetis2010-06-04 15:01:26 +0000
commit722c4f1b8dd9a25e94e48ea1368e786250de7a5c (patch)
treea163331038708cd2ea9f89983dda5259a4a22fb5 /engines
parentfdc9bbcbf5cee1b5e0cca6838ff30b0133b882fa (diff)
downloadscummvm-rg350-722c4f1b8dd9a25e94e48ea1368e786250de7a5c.tar.gz
scummvm-rg350-722c4f1b8dd9a25e94e48ea1368e786250de7a5c.tar.bz2
scummvm-rg350-722c4f1b8dd9a25e94e48ea1368e786250de7a5c.zip
Some more work on channel remapping: Moved the remapping code to the music loading code (still disabled)
svn-id: r49430
Diffstat (limited to 'engines')
-rw-r--r--engines/sci/sound/midiparser_sci.cpp22
-rw-r--r--engines/sci/sound/midiparser_sci.h2
-rw-r--r--engines/sci/sound/music.cpp10
3 files changed, 20 insertions, 14 deletions
diff --git a/engines/sci/sound/midiparser_sci.cpp b/engines/sci/sound/midiparser_sci.cpp
index 83a67509cf..3ee8a3a83d 100644
--- a/engines/sci/sound/midiparser_sci.cpp
+++ b/engines/sci/sound/midiparser_sci.cpp
@@ -88,7 +88,6 @@ bool MidiParser_SCI::loadMusic(SoundResource::Track *track, MusicEntry *psnd, in
_tracks[0] = _mixedData;
setTrack(0);
_loopTick = 0;
- _channelsUsed = 0;
if (_soundVersion <= SCI_VERSION_0_LATE) {
// Set initial voice count
@@ -135,12 +134,6 @@ void MidiParser_SCI::unloadMusic() {
}
void MidiParser_SCI::parseNextEvent(EventInfo &info) {
- byte remappedChannel = _channelRemap[info.channel()];
-
- // Remap channel. Keep the upper 4 bits (command code) and change
- // the lower 4 bits (channel)
- info.event = (info.event & 0xF0) | (remappedChannel & 0xF);
-
// Monitor which channels are used by this song
setChannelUsed(info.channel());
@@ -334,7 +327,7 @@ byte MidiParser_SCI::midiGetNextChannel(long ticker) {
for (int i = 0; i < _track->channelCount; i++) {
if (_track->channels[i].time == -1) // channel ended
continue;
- next = *_track->channels[i].data; // when the next event shoudl occur
+ next = *_track->channels[i].data; // when the next event should occur
if (next == 0xF8) // 0xF8 means 240 ticks delay
next = 240;
next += _track->channels[i].time;
@@ -401,9 +394,18 @@ byte *MidiParser_SCI::midiMixChannels() {
channel->time = -1; // FIXME
break;
default: // MIDI command
- if (command & 0x80)
+ if (command & 0x80) {
par1 = *channel->data++;
- else {// running status
+
+ // TODO: Fix remapping
+
+#if 0
+ // Remap channel. Keep the upper 4 bits (command code) and change
+ // the lower 4 bits (channel)
+ byte remappedChannel = _channelRemap[par1 & 0xF];
+ par1 = (par1 & 0xF0) | (remappedChannel & 0xF);
+#endif
+ } else {// running status
par1 = command;
command = channel->prev;
}
diff --git a/engines/sci/sound/midiparser_sci.h b/engines/sci/sound/midiparser_sci.h
index e33e613dd6..9d4b5a39da 100644
--- a/engines/sci/sound/midiparser_sci.h
+++ b/engines/sci/sound/midiparser_sci.h
@@ -77,6 +77,8 @@ public:
_channelRemap[channel] = newChannel;
}
+ void clearUsedChannels() { _channelsUsed = 0; }
+
protected:
bool isChannelUsed(byte channel) const { return _channelsUsed & (1 << channel); }
void setChannelUsed(byte channel) { _channelsUsed |= (1 << channel); }
diff --git a/engines/sci/sound/music.cpp b/engines/sci/sound/music.cpp
index f0356be709..fa5716e7cc 100644
--- a/engines/sci/sound/music.cpp
+++ b/engines/sci/sound/music.cpp
@@ -231,15 +231,13 @@ void SciMusic::soundInitSnd(MusicEntry *pSnd) {
pSnd->pauseCounter = 0;
- // Find out what channels to filter for SCI0
- channelFilterMask = pSnd->soundRes->getChannelFilterMask(_pMidiDrv->getPlayId(), _pMidiDrv->hasRhythmChannel());
- pSnd->pMidiParser->loadMusic(track, pSnd, channelFilterMask, _soundVersion);
-
// TODO: Fix channel remapping. This doesn't quite work... (e.g. no difference in LSL1VGA)
#if 0
// Remap channels
findUsedChannels();
+ pSnd->pMidiParser->clearUsedChannels();
+
for (int i = 0; i < 16; i++) {
if (_usedChannels[i] && pSnd->soundRes->isChannelUsed(i)) {
int16 newChannel = getNextUnusedChannel();
@@ -254,6 +252,10 @@ void SciMusic::soundInitSnd(MusicEntry *pSnd) {
}
#endif
+ // Find out what channels to filter for SCI0
+ channelFilterMask = pSnd->soundRes->getChannelFilterMask(_pMidiDrv->getPlayId(), _pMidiDrv->hasRhythmChannel());
+ pSnd->pMidiParser->loadMusic(track, pSnd, channelFilterMask, _soundVersion);
+
// Fast forward to the last position and perform associated events when loading
pSnd->pMidiParser->jumpToTick(pSnd->ticker, true);
_mutex.unlock();