[Scummvm-cvs-logs] CVS: scummvm/scumm imuse.cpp,2.4,2.5 instrument.h,2.2,2.3 instrument.cpp,2.4,2.5
Jamieson Christian
jamieson630 at users.sourceforge.net
Fri Dec 20 05:10:02 CET 2002
Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1:/tmp/cvs-serv17031/scummvm/scumm
Modified Files:
imuse.cpp instrument.h instrument.cpp
Log Message:
[Bug #656635] fixed.
Adlib global instrument assignments are now correct.
Index: imuse.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/imuse.cpp,v
retrieving revision 2.4
retrieving revision 2.5
diff -u -d -r2.4 -r2.5
--- imuse.cpp 18 Dec 2002 17:14:04 -0000 2.4
+++ imuse.cpp 20 Dec 2002 13:09:01 -0000 2.5
@@ -272,6 +272,7 @@
void silence();
void set_instrument(uint b);
void set_instrument(byte * data);
+ void load_global_instrument (byte b);
void set_transpose(int8 transpose);
void set_vol(uint8 volume);
@@ -366,6 +367,7 @@
void on_timer() {}
void set_instrument(uint slot, byte *instr);
+ void part_load_global_instrument (Part *part, byte slot);
void part_set_param(Part *part, byte param, int value) {}
void part_key_on(Part *part, byte note, byte velocity);
void part_key_off(Part *part, byte note);
@@ -2073,8 +2075,12 @@
case 0xC: // Program Change
value = *s++;
part = get_part(chan);
- if (part)
- part->set_program(value);
+ if (part) {
+ if (_isGM || value >= 32)
+ part->set_program(value);
+ else
+ part->load_global_instrument (value);
+ }
break;
case 0xD: // Channel Pressure
@@ -3277,6 +3283,11 @@
changed(IMuseDriver::pcProgram);
}
+void Part::load_global_instrument (byte slot)
+{
+ _drv->part_load_global_instrument (this, slot);
+}
+
void Part::key_on(byte note, byte velocity)
{
_drv->part_key_on(this, note, velocity);
@@ -3693,6 +3704,14 @@
// memcpy(&_glob_instr[slot], data, sizeof(Instrument));
_glob_instr[slot].adlib (data);
}
+}
+
+void IMuseDriver::part_load_global_instrument (Part *part, byte slot)
+{
+ if (slot >= 32)
+ return;
+ _glob_instr [slot].copy_to (&part->_instrument);
+ part->changed (pcProgram);
}
void IMuseDriver::part_changed(Part *part, uint16 what)
Index: instrument.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/instrument.h,v
retrieving revision 2.2
retrieving revision 2.3
diff -u -d -r2.2 -r2.3
--- instrument.h 18 Dec 2002 17:14:05 -0000 2.2
+++ instrument.h 20 Dec 2002 13:09:01 -0000 2.3
@@ -30,10 +30,15 @@
class Serializer;
class MidiChannel;
+class Instrument;
+
+
+
class InstrumentInternal {
public:
virtual void saveOrLoad (Serializer *s) = 0;
virtual void send (MidiChannel *mc) = 0;
+ virtual void copy_to (Instrument *dest) = 0;
};
class Instrument {
@@ -52,6 +57,7 @@
Instrument() : _type (0), _instrument (0) { }
void clear();
+ void copy_to (Instrument *dest) { if (_instrument) _instrument->copy_to (dest); else dest->clear(); }
void program (byte program, bool mt32);
void adlib (byte *instrument);
void roland (byte *instrument);
Index: instrument.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/instrument.cpp,v
retrieving revision 2.4
retrieving revision 2.5
diff -u -d -r2.4 -r2.5
--- instrument.cpp 18 Dec 2002 23:19:37 -0000 2.4
+++ instrument.cpp 20 Dec 2002 13:09:01 -0000 2.5
@@ -133,6 +133,7 @@
Instrument_Program (Serializer *s);
void saveOrLoad (Serializer *s);
void send (MidiChannel *mc);
+ void copy_to (Instrument *dest) { dest->program (_program, _mt32); }
};
class Instrument_Adlib : public InstrumentInternal {
@@ -161,6 +162,7 @@
Instrument_Adlib (Serializer *s);
void saveOrLoad (Serializer *s);
void send (MidiChannel *mc);
+ void copy_to (Instrument *dest) { dest->adlib ((byte *) &_instrument); }
};
class Instrument_Roland : public InstrumentInternal {
@@ -230,6 +232,7 @@
Instrument_Roland (Serializer *s);
void saveOrLoad (Serializer *s);
void send (MidiChannel *mc);
+ void copy_to (Instrument *dest) { dest->roland ((byte *) &_instrument); }
};
More information about the Scummvm-git-logs
mailing list