[Scummvm-cvs-logs] CVS: scummvm/scumm imuse.cpp,2.28,2.29 instrument.h,2.7,2.8 instrument.cpp,2.14,2.15
Jamieson Christian
jamieson630 at users.sourceforge.net
Thu May 15 16:09:01 CEST 2003
Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1:/tmp/cvs-serv8779/scummvm/scumm
Modified Files:
imuse.cpp instrument.h instrument.cpp
Log Message:
Removed deprecated _program.
Miscellaneous cleanup.
Index: imuse.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/imuse.cpp,v
retrieving revision 2.28
retrieving revision 2.29
diff -u -d -r2.28 -r2.29
--- imuse.cpp 15 May 2003 22:31:56 -0000 2.28
+++ imuse.cpp 15 May 2003 23:08:02 -0000 2.29
@@ -222,7 +222,6 @@
bool _on;
byte _modwheel;
bool _pedal;
- byte _program;
int8 _pri;
byte _pri_eff;
byte _chan;
@@ -291,7 +290,6 @@
OSystem *_system;
MidiDriver *_md;
Instrument _glob_instr[32]; // Adlib custom instruments
- Instrument _midi_instrument_last[16];
static void timer_callback (void *);
@@ -302,7 +300,6 @@
void set_instrument(uint slot, byte *instr);
void part_load_global_instrument (Part *part, byte slot);
- void get_channel_instrument (byte channel, Instrument *instrument) { _midi_instrument_last[channel].copy_to (instrument); }
MidiChannel *allocateChannel() { return _md->allocateChannel(); }
MidiChannel *getPercussionChannel() { return _md->getPercussionChannel(); }
@@ -422,7 +419,6 @@
int get_music_volume();
int set_master_volume(uint vol);
int get_master_volume();
- void get_channel_instrument (byte channel, Instrument *instrument) { _driver->get_channel_instrument (channel, instrument); }
bool startSound(int sound);
int stopSound(int sound);
int stop_all_sounds();
@@ -2792,7 +2788,7 @@
case 15:
return part->_vol;
case 16:
- return part->_program;
+ return (int) part->_instrument;
case 17:
return part->_transpose;
default:
@@ -2951,7 +2947,7 @@
MKLINE(Part, _on, sleUint8, VER_V8),
MKLINE(Part, _modwheel, sleUint8, VER_V8),
MKLINE(Part, _pedal, sleUint8, VER_V8),
- MKLINE(Part, _program, sleUint8, VER_V8),
+ MK_OBSOLETE(Part, _program, sleUint8, VER_V8, VER_V16),
MKLINE(Part, _pri, sleUint8, VER_V8),
MKLINE(Part, _chan, sleUint8, VER_V8),
MKLINE(Part, _effect_level, sleUint8, VER_V8),
@@ -2983,7 +2979,6 @@
Part *part = &_parts[0];
if (ser->getVersion() >= VER_V11) {
for (i = ARRAYSIZE(_parts); i; --i, ++part) {
- part->_program = 255;
part->_instrument.saveOrLoad (ser);
}
} else {
@@ -3106,7 +3101,6 @@
set_detune(_detune);
set_pri(_pri);
set_pan(_pan);
- if (_program < 128) _instrument.program (_program, _player->_mt32emulate);
sendAll();
}
@@ -3207,10 +3201,8 @@
_pitchbend_factor = 2;
_pitchbend = 0;
_effect_level = 64;
- _program = 255;
_instrument.clear();
_unassigned_instrument = true;
-// player->_se->get_channel_instrument (_chan, &_instrument);
_chorus = 0;
_modwheel = 0;
_bank = 0;
@@ -3266,7 +3258,6 @@
_mc->effectLevel (_effect_level);
if (_instrument.isValid()) {
_instrument.send (_mc);
-// part->_instrument.copy_to (&_midi_instrument_last [part->_chan]);
}
_mc->chorusLevel (_effect_level);
_mc->priority (_pri_eff);
@@ -3297,18 +3288,14 @@
}
void Part::set_program(byte program) {
- if (_program != program || _bank != 0) {
- _program = program;
- _bank = 0;
- _instrument.program (_program, _player->_mt32emulate);
- if (clearToTransmit()) _instrument.send (_mc);
- }
+ _bank = 0;
+ _instrument.program (program, _player->_mt32emulate);
+ if (clearToTransmit()) _instrument.send (_mc);
}
void Part::set_instrument(uint b) {
_bank = (byte)(b >> 8);
- _program = (byte)b;
- _instrument.program (_program, _player->_mt32emulate);
+ _instrument.program ((byte) b, _player->_mt32emulate);
if (clearToTransmit()) _instrument.send (_mc);
}
@@ -3324,8 +3311,6 @@
}
void IMuseDriver::init(IMuseInternal *eng, OSystem *syst) {
- int i;
-
_system = syst;
// Open MIDI driver
@@ -3336,10 +3321,6 @@
// Connect to the driver's timer
_se = eng;
_md->setTimerCallback (NULL, &IMuseDriver::timer_callback);
-
- for (i = 0; i != ARRAYSIZE(_midi_instrument_last); i++) {
- _midi_instrument_last [i].clear();
- }
}
void IMuseDriver::timer_callback (void *) {
Index: instrument.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/instrument.h,v
retrieving revision 2.7
retrieving revision 2.8
diff -u -d -r2.7 -r2.8
--- instrument.h 7 May 2003 19:24:14 -0000 2.7
+++ instrument.h 15 May 2003 23:08:03 -0000 2.8
@@ -35,6 +35,7 @@
virtual void send (MidiChannel *mc) = 0;
virtual void copy_to (Instrument *dest) = 0;
virtual bool is_valid() = 0;
+ virtual operator int() { return 255; }
};
class Instrument {
@@ -54,6 +55,7 @@
void clear();
void copy_to (Instrument *dest) { if (_instrument) _instrument->copy_to (dest); else dest->clear(); }
+ operator int() { return (_instrument ? (int) _instrument : 255); }
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.14
retrieving revision 2.15
diff -u -d -r2.14 -r2.15
--- instrument.cpp 15 May 2003 00:27:19 -0000 2.14
+++ instrument.cpp 15 May 2003 23:08:03 -0000 2.15
@@ -25,7 +25,7 @@
#include "scumm/instrument.h"
#include "sound/mididrv.h"
-#define NATIVE_MT32 false
+#define NATIVE_MT32 true
static const byte mt32_to_gm[128] = {
// 0 1 2 3 4 5 6 7 8 9 A B C D E F
@@ -136,6 +136,7 @@
void send (MidiChannel *mc);
void copy_to (Instrument *dest) { dest->program (_program, _mt32); }
bool is_valid() { return (_program < 128); }
+ operator int() { return (_program < 128) ? _program : 255; }
};
class Instrument_Adlib : public InstrumentInternal {
More information about the Scummvm-git-logs
mailing list