aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/sound
diff options
context:
space:
mode:
authormd52011-03-03 01:47:08 +0200
committermd52011-03-03 01:47:08 +0200
commit9d6ed4de3191702ab839c6cafec308dd449b3d1f (patch)
treea6577d78b6c27ad6b0b959df6d1df2154ce9dcf8 /engines/sci/sound
parent3f052213346e7887c85b6a2a5d31b24015d672bc (diff)
downloadscummvm-rg350-9d6ed4de3191702ab839c6cafec308dd449b3d1f.tar.gz
scummvm-rg350-9d6ed4de3191702ab839c6cafec308dd449b3d1f.tar.bz2
scummvm-rg350-9d6ed4de3191702ab839c6cafec308dd449b3d1f.zip
SCI: Slight cleanup of some sound drivers
Diffstat (limited to 'engines/sci/sound')
-rw-r--r--engines/sci/sound/drivers/adlib.cpp8
-rw-r--r--engines/sci/sound/drivers/amigamac.cpp64
-rw-r--r--engines/sci/sound/drivers/midi.cpp8
3 files changed, 53 insertions, 27 deletions
diff --git a/engines/sci/sound/drivers/adlib.cpp b/engines/sci/sound/drivers/adlib.cpp
index 9780f9fa56..07a210cb06 100644
--- a/engines/sci/sound/drivers/adlib.cpp
+++ b/engines/sci/sound/drivers/adlib.cpp
@@ -273,10 +273,6 @@ void MidiDriver_AdLib::send(uint32 b) {
case 0x90:
noteOn(channel, op1, op2);
break;
- case 0xe0:
- _channels[channel].pitchWheel = (op1 & 0x7f) | ((op2 & 0x7f) << 7);
- renewNotes(channel, true);
- break;
case 0xb0:
switch (op1) {
case 0x07:
@@ -321,6 +317,10 @@ void MidiDriver_AdLib::send(uint32 b) {
case 0xa0: // Polyphonic key pressure (aftertouch)
case 0xd0: // Channel pressure (aftertouch)
break;
+ case 0xe0:
+ _channels[channel].pitchWheel = (op1 & 0x7f) | ((op2 & 0x7f) << 7);
+ renewNotes(channel, true);
+ break;
case 0xf0: // SysEx, ignore it
break;
default:
diff --git a/engines/sci/sound/drivers/amigamac.cpp b/engines/sci/sound/drivers/amigamac.cpp
index f28d81ee81..a095a05eb8 100644
--- a/engines/sci/sound/drivers/amigamac.cpp
+++ b/engines/sci/sound/drivers/amigamac.cpp
@@ -289,9 +289,9 @@ void MidiDriver_AmigaMac::playInstrument(int16 *dest, Voice *channel, int count)
void MidiDriver_AmigaMac::changeInstrument(int channel, int instrument) {
#ifdef DEBUG
if (_bank.instruments[instrument][0])
- debugN("[sfx:seq:amiga] Setting channel %i to \"%s\" (%i)\n", channel, _bank.instruments[instrument].name, instrument);
+ debugN("Amiga/Mac driver: Setting channel %i to \"%s\" (%i)\n", channel, _bank.instruments[instrument].name, instrument);
else
- warning("[sfx:seq:amiga] instrument %i does not exist (channel %i)", instrument, channel);
+ warning("Amiga/Mac driver: instrument %i does not exist (channel %i)", instrument, channel);
#endif
_channels[channel].instrument = instrument;
}
@@ -326,7 +326,7 @@ void MidiDriver_AmigaMac::stopNote(int ch, int note) {
if (channel == kChannels) {
#ifdef DEBUG
- warning("[sfx:seq:amiga] cannot stop note %i on channel %i", note, ch);
+ warning("Amiga/Mac driver: cannot stop note %i on channel %i", note, ch);
#endif
return;
}
@@ -366,7 +366,7 @@ void MidiDriver_AmigaMac::setOutputFrac(int voice) {
fnote += instrument->transpose;
if (fnote < 0 || fnote > 127) {
- warning("[sfx:seq:amiga] illegal note %i", fnote);
+ warning("Amiga/Mac driver: illegal note %i", fnote);
return;
}
} else
@@ -403,14 +403,14 @@ void MidiDriver_AmigaMac::startNote(int ch, int note, int velocity) {
int channel;
if (_channels[ch].instrument < 0 || _channels[ch].instrument > 255) {
- warning("[sfx:seq:amiga] invalid instrument %i on channel %i", _channels[ch].instrument, ch);
+ warning("Amiga/Mac driver: invalid instrument %i on channel %i", _channels[ch].instrument, ch);
return;
}
InstrumentSample *instrument = findInstrument(_channels[ch].instrument, note);
if (!instrument) {
- warning("[sfx:seq:amiga] instrument %i does not exist", _channels[ch].instrument);
+ warning("Amiga/Mac driver: instrument %i does not exist", _channels[ch].instrument);
return;
}
@@ -419,7 +419,7 @@ void MidiDriver_AmigaMac::startNote(int ch, int note, int velocity) {
break;
if (channel == kChannels) {
- warning("[sfx:seq:amiga] could not find a free channel");
+ warning("Amiga/Mac driver: could not find a free channel");
return;
}
@@ -447,7 +447,7 @@ MidiDriver_AmigaMac::InstrumentSample *MidiDriver_AmigaMac::readInstrumentSCI0(C
byte header[61];
if (file.read(header, 61) < 61) {
- warning("[sfx:seq:amiga] failed to read instrument header");
+ warning("Amiga/Mac driver: failed to read instrument header");
return NULL;
}
@@ -489,7 +489,7 @@ MidiDriver_AmigaMac::InstrumentSample *MidiDriver_AmigaMac::readInstrumentSCI0(C
instrument->name[29] = 0;
#ifdef DEBUG
- debugN("[sfx:seq:amiga] Reading instrument %i: \"%s\" (%i bytes)\n",
+ debugN("Amiga/Mac driver: Reading instrument %i: \"%s\" (%i bytes)\n",
*id, instrument->name, size);
debugN(" Mode: %02x\n", instrument->mode);
debugN(" Looping: %s\n", instrument->mode & kModeLoop ? "on" : "off");
@@ -500,7 +500,7 @@ MidiDriver_AmigaMac::InstrumentSample *MidiDriver_AmigaMac::readInstrumentSCI0(C
instrument->samples = (int8 *) malloc(size + 1);
if (file.read(instrument->samples, size) < (unsigned int)size) {
- warning("[sfx:seq:amiga] failed to read instrument samples");
+ warning("Amiga/Mac driver: failed to read instrument samples");
free(instrument->samples);
delete instrument;
return NULL;
@@ -512,14 +512,14 @@ MidiDriver_AmigaMac::InstrumentSample *MidiDriver_AmigaMac::readInstrumentSCI0(C
if (instrument->mode & kModeLoop) {
if (loop_offset + seg_size[1] > size) {
#ifdef DEBUG
- warning("[sfx:seq:amiga] looping samples extend %i bytes past end of sample block",
+ warning("Amiga/Mac driver: looping samples extend %i bytes past end of sample block",
loop_offset + seg_size[1] - size);
#endif
seg_size[1] = size - loop_offset;
}
if (seg_size[1] < 0) {
- warning("[sfx:seq:amiga] invalid looping point");
+ warning("Amiga/Mac driver: invalid looping point");
free(instrument->samples);
delete instrument;
return NULL;
@@ -666,26 +666,44 @@ void MidiDriver_AmigaMac::send(uint32 b) {
case 0x07:
_channels[channel].volume = op2;
break;
- case 0x0a:
+ case 0x0a: // pan
+ // TODO
#ifdef DEBUG
- warning("[sfx:seq:amiga] ignoring pan 0x%02x event for channel %i", op2, channel);
+ warning("Amiga/Mac driver: ignoring pan 0x%02x event for channel %i", op2, channel);
#endif
break;
+ case 0x40: // hold
+ // TODO
+#ifdef DEBUG
+ warning("Amiga/Mac driver: ignoring hold 0x%02x event for channel %i", op2, channel);
+#endif
+ break;
+ case 0x4b: // voice mapping
+ break;
+ case 0x4e: // velocity
+ break;
case 0x7b:
stopChannel(channel);
break;
default:
- warning("[sfx:seq:amiga] unknown control event 0x%02x", op1);
+ //warning("Amiga/Mac driver: unknown control event 0x%02x", op1);
+ break;
}
break;
case 0xc0:
changeInstrument(channel, op1);
break;
+ // The original MIDI driver from sierra ignores aftertouch completely, so should we
+ case 0xa0: // Polyphonic key pressure (aftertouch)
+ case 0xd0: // Channel pressure (aftertouch)
+ break;
case 0xe0:
pitchWheel(channel, (op2 << 7) | op1);
break;
+ case 0xf0: // SysEx, ignore it
+ break;
default:
- warning("[sfx:seq:amiga] unknown event %02x", command);
+ warning("Amiga/Mac driver: unknown event %02x", command);
}
}
@@ -738,7 +756,7 @@ bool MidiDriver_AmigaMac::loadInstrumentsSCI0(Common::File &file) {
byte header[40];
if (file.read(header, 40) < 40) {
- warning("[sfx:seq:amiga] failed to read header of file bank.001");
+ warning("Amiga/Mac driver: failed to read header of file bank.001");
return false;
}
@@ -746,7 +764,7 @@ bool MidiDriver_AmigaMac::loadInstrumentsSCI0(Common::File &file) {
strncpy(_bank.name, (char *) header + 8, 29);
_bank.name[29] = 0;
#ifdef DEBUG
- debugN("[sfx:seq:amiga] Reading %i instruments from bank \"%s\"\n", _bank.size, _bank.name);
+ debugN("Amiga/Mac driver: Reading %i instruments from bank \"%s\"\n", _bank.size, _bank.name);
#endif
for (uint i = 0; i < _bank.size; i++) {
@@ -754,12 +772,12 @@ bool MidiDriver_AmigaMac::loadInstrumentsSCI0(Common::File &file) {
InstrumentSample *instrument = readInstrumentSCI0(file, &id);
if (!instrument) {
- warning("[sfx:seq:amiga] failed to read bank.001");
+ warning("Amiga/Mac driver: failed to read bank.001");
return false;
}
if (id < 0 || id > 255) {
- warning("[sfx:seq:amiga] Error: instrument ID out of bounds");
+ warning("Amiga/Mac driver: Error: instrument ID out of bounds");
return false;
}
@@ -777,7 +795,7 @@ bool MidiDriver_AmigaMac::loadInstrumentsSCI0Mac(Common::SeekableReadStream &fil
byte header[40];
if (file.read(header, 40) < 40) {
- warning("[sfx:seq:amiga] failed to read header of file patch.200");
+ warning("Amiga/Mac driver: failed to read header of file patch.200");
return false;
}
@@ -785,7 +803,7 @@ bool MidiDriver_AmigaMac::loadInstrumentsSCI0Mac(Common::SeekableReadStream &fil
strncpy(_bank.name, (char *) header + 8, 29);
_bank.name[29] = 0;
#ifdef DEBUG
- debugN("[sfx:seq:amiga] Reading %i instruments from bank \"%s\"\n", _bank.size, _bank.name);
+ debugN("Amiga/Mac driver: Reading %i instruments from bank \"%s\"\n", _bank.size, _bank.name);
#endif
Common::Array<uint32> instrumentOffsets;
@@ -848,7 +866,7 @@ bool MidiDriver_AmigaMac::loadInstrumentsSCI0Mac(Common::SeekableReadStream &fil
instrument->samples = (int8 *)malloc(size + 1);
if (file.read(instrument->samples, size) < size) {
- warning("[sfx:seq:amiga] failed to read instrument sample");
+ warning("Amiga/Mac driver: failed to read instrument sample");
free(instrument->samples);
delete instrument;
continue;
diff --git a/engines/sci/sound/drivers/midi.cpp b/engines/sci/sound/drivers/midi.cpp
index 65ccaecc6f..a9b3162505 100644
--- a/engines/sci/sound/drivers/midi.cpp
+++ b/engines/sci/sound/drivers/midi.cpp
@@ -248,11 +248,17 @@ void MidiPlayer_Midi::controlChange(int channel, int control, int value) {
_channels[channel].hold = value;
break;
+ case 0x4b: // voice mapping
+ break;
+ case 0x4e: // velocity
+ break;
case 0x7b:
if (!_channels[channel].playing)
return;
_channels[channel].playing = false;
+ default:
+ break;
}
_driver->send(0xb0 | channel, control, value);
@@ -350,6 +356,8 @@ void MidiPlayer_Midi::send(uint32 b) {
case 0xe0:
_driver->send(b);
break;
+ case 0xf0: // SysEx, ignore it
+ break;
default:
warning("Ignoring MIDI event %02x", command);
}