aboutsummaryrefslogtreecommitdiff
path: root/engines/scumm/imuse/instrument.cpp
diff options
context:
space:
mode:
authorJohannes Schickel2011-07-08 04:43:45 +0200
committerJohannes Schickel2011-07-08 04:45:01 +0200
commited993e6350bd4926b4b9c94a014aa0f96a628ce7 (patch)
treeb6f0b19a5d7d8da8b61b98376e85b36867a13acd /engines/scumm/imuse/instrument.cpp
parent3f04ad72a998dead1b6b43a8facd4d7a62d2119a (diff)
downloadscummvm-rg350-ed993e6350bd4926b4b9c94a014aa0f96a628ce7.tar.gz
scummvm-rg350-ed993e6350bd4926b4b9c94a014aa0f96a628ce7.tar.bz2
scummvm-rg350-ed993e6350bd4926b4b9c94a014aa0f96a628ce7.zip
SCUMM: Initial PC Speaker output implementation for SCUMM v5.
This is *not* complete yet.
Diffstat (limited to 'engines/scumm/imuse/instrument.cpp')
-rw-r--r--engines/scumm/imuse/instrument.cpp52
1 files changed, 52 insertions, 0 deletions
diff --git a/engines/scumm/imuse/instrument.cpp b/engines/scumm/imuse/instrument.cpp
index 955700fc2b..581f378655 100644
--- a/engines/scumm/imuse/instrument.cpp
+++ b/engines/scumm/imuse/instrument.cpp
@@ -259,6 +259,19 @@ public:
bool is_valid() { return (_native_mt32 ? true : (_instrument_name[0] != '\0')); }
};
+class Instrument_PcSpk : public InstrumentInternal {
+public:
+ Instrument_PcSpk(const byte *data);
+ Instrument_PcSpk(Serializer *s);
+ void saveOrLoad(Serializer *s);
+ void send(MidiChannel *mc);
+ void copy_to(Instrument *dest) { dest->pcspk((byte *)&_instrument); }
+ bool is_valid() { return true; }
+
+private:
+ byte _instrument[23];
+};
+
////////////////////////////////////////
//
// Instrument class members
@@ -299,6 +312,14 @@ void Instrument::roland(const byte *instrument) {
_instrument = new Instrument_Roland(instrument);
}
+void Instrument::pcspk(const byte *instrument) {
+ clear();
+ if (!instrument)
+ return;
+ _type = itPcSpk;
+ _instrument = new Instrument_PcSpk(instrument);
+}
+
void Instrument::saveOrLoad (Serializer *s) {
if (s->isSaving()) {
s->saveByte(_type);
@@ -319,6 +340,9 @@ void Instrument::saveOrLoad (Serializer *s) {
case itRoland:
_instrument = new Instrument_Roland(s);
break;
+ case itPcSpk:
+ _instrument = new Instrument_PcSpk(s);
+ break;
default:
warning("No known instrument classification #%d", (int)_type);
_type = itNone;
@@ -470,4 +494,32 @@ uint8 Instrument_Roland::getEquivalentGM() {
return 255;
}
+////////////////////////////////////////
+//
+// Instrument_PcSpk class members
+//
+////////////////////////////////////////
+
+Instrument_PcSpk::Instrument_PcSpk(const byte *data) {
+ memcpy(_instrument, data, sizeof(_instrument));
+}
+
+Instrument_PcSpk::Instrument_PcSpk(Serializer *s) {
+ if (!s->isSaving())
+ saveOrLoad(s);
+ else
+ memset(_instrument, 0, sizeof(_instrument));
+}
+
+void Instrument_PcSpk::saveOrLoad(Serializer *s) {
+ if (s->isSaving())
+ s->saveBytes(_instrument, sizeof(_instrument));
+ else
+ s->loadBytes(_instrument, sizeof(_instrument));
+}
+
+void Instrument_PcSpk::send(MidiChannel *mc) {
+ mc->sysEx_customInstrument('SPK ', (byte *)&_instrument);
+}
+
} // End of namespace Scumm