[Scummvm-cvs-logs] CVS: scummvm/backends/midi adlib.cpp,1.61,1.62 mt32.cpp,1.2,1.3 ym2612.cpp,1.27,1.28 emumidi.h,1.5,1.6
Max Horn
fingolfin at users.sourceforge.net
Mon Nov 8 02:24:54 CET 2004
Update of /cvsroot/scummvm/scummvm/backends/midi
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30808
Modified Files:
adlib.cpp mt32.cpp ym2612.cpp emumidi.h
Log Message:
cleanup
Index: adlib.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/backends/midi/adlib.cpp,v
retrieving revision 1.61
retrieving revision 1.62
diff -u -d -r1.61 -r1.62
--- adlib.cpp 17 Oct 2004 17:49:45 -0000 1.61
+++ adlib.cpp 8 Nov 2004 10:16:07 -0000 1.62
@@ -279,7 +279,7 @@
242, 243, 245, 247, 249, 251, 252, 254,
};
-static byte map_gm_to_fm [128][30] = {
+static const byte map_gm_to_fm[128][30] = {
// 0x00
{ 0xC2, 0xC5, 0x2B, 0x99, 0x58, 0xC2, 0x1F, 0x1E, 0xC8, 0x7C, 0x0A, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0x23 },
{ 0x22, 0x53, 0x0E, 0x8A, 0x30, 0x14, 0x06, 0x1D, 0x7A, 0x5C, 0x06, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0x00 },
@@ -418,7 +418,7 @@
{ 0x00, 0x3F, 0x4C, 0xFB, 0x00, 0x00, 0x3F, 0x0A, 0xE9, 0x7C, 0x0E, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0x05 }
};
-static byte gm_percussion_to_fm [39][30] = {
+static byte gm_percussion_to_fm[39][30] = {
{ 0x1A, 0x3F, 0x15, 0x05, 0x7C, 0x02, 0x21, 0x2B, 0xE4, 0x7C, 0x0E, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0x06 },
{ 0x11, 0x12, 0x04, 0x07, 0x7C, 0x02, 0x23, 0x0B, 0xE5, 0x7C, 0x0E, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0x05 },
{ 0x0A, 0x3F, 0x0B, 0x01, 0x7C, 0x1F, 0x1C, 0x46, 0xD0, 0x7C, 0x0E, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0x01 },
@@ -460,7 +460,7 @@
{ 0x0A, 0x0E, 0x7F, 0x00, 0x7D, 0x13, 0x20, 0x28, 0x03, 0x7C, 0x06, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0x00 }
};
-static byte gm_percussion_lookup[128] = {
+static const byte gm_percussion_lookup[128] = {
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C,
@@ -472,7 +472,7 @@
};
static byte lookup_table[64][32];
-const byte volume_table[] = {
+const const byte volume_table[] = {
0, 4, 7, 11,
13, 16, 18, 20,
22, 24, 26, 27,
@@ -579,8 +579,8 @@
AdlibPart _parts[32];
AdlibPercussionChannel _percussion;
- void generate_samples(int16 *buf, int len);
- void on_timer();
+ void generateSamples(int16 *buf, int len);
+ void onTimer();
void part_key_on(AdlibPart *part, AdlibInstrument *instr, byte note, byte velocity);
void part_key_off(AdlibPart *part, byte note);
@@ -625,20 +625,20 @@
return _owner;
}
-void AdlibPart::send (uint32 b) {
- _owner->send (_channel, b);
+void AdlibPart::send(uint32 b) {
+ _owner->send(_channel, b);
}
void AdlibPart::noteOff(byte note) {
#ifdef DEBUG_ADLIB
- debug (6, "%10d: noteOff(%d)", tick, note);
+ debug(6, "%10d: noteOff(%d)", tick, note);
#endif
_owner->part_key_off(this, note);
}
void AdlibPart::noteOn(byte note, byte velocity) {
#ifdef DEBUG_ADLIB
- debug (6, "%10d: noteOn(%d,%d)", tick, note, velocity);
+ debug(6, "%10d: noteOn(%d,%d)", tick, note, velocity);
#endif
_owner->part_key_on(this, &_part_instr, note, velocity);
}
@@ -654,7 +654,7 @@
if (!count)
warning("No Adlib instrument defined for GM program %d", (int) program);
_program = program;
- memcpy(&_part_instr, &map_gm_to_fm [program], sizeof(AdlibInstrument));
+ memcpy(&_part_instr, &map_gm_to_fm[program], sizeof(AdlibInstrument));
}
void AdlibPart::pitchBend(int16 bend) {
@@ -669,20 +669,20 @@
void AdlibPart::controlChange(byte control, byte value) {
switch (control) {
- case 1: modulationWheel (value); break;
- case 7: volume (value); break;
+ case 1: modulationWheel(value); break;
+ case 7: volume(value); break;
case 10: break; // Pan position. Not supported.
- case 16: pitchBendFactor (value); break;
- case 17: detune (value); break;
- case 18: priority (value); break;
- case 64: sustain (value > 0); break;
+ case 16: pitchBendFactor(value); break;
+ case 17: detune(value); break;
+ case 18: priority(value); break;
+ case 64: sustain(value > 0); break;
case 91: break; // Effects level. Not supported.
case 93: break; // Chorus level. Not supported.
case 119: break; // Unknown, used in Simon the Sorcerer 2
case 121: break; // Unknown, used in Simon the Sorcerer 1
case 123: allNotesOff(); break;
default:
- warning ("Adlib: Unknown control change message %d", (int) control);
+ warning("Adlib: Unknown control change message %d", (int) control);
}
}
@@ -782,12 +782,12 @@
}
void AdlibPercussionChannel::noteOn(byte note, byte velocity) {
- byte key = gm_percussion_lookup [note];
+ byte key = gm_percussion_lookup[note];
if (key == 0xFF) {
- debug (2, "No FM map for GM percussion key %d", (int) note);
+ debug(2, "No FM map for GM percussion key %d", (int) note);
return;
}
- _owner->part_key_on(this, (AdlibInstrument *) &gm_percussion_to_fm [key], note, velocity);
+ _owner->part_key_on(this, (AdlibInstrument *) &gm_percussion_to_fm[key], note, velocity);
}
// MidiDriver method implementations
@@ -853,8 +853,8 @@
uint i;
for (i = 0; i < ARRAYSIZE(_voices); ++i) {
- if (_voices [i]._part)
- mc_off(&_voices [i]);
+ if (_voices[i]._part)
+ mc_off(&_voices[i]);
}
// Turn off the OPL emulation
@@ -863,11 +863,11 @@
free(_adlib_reg_cache);
}
-void MidiDriver_ADLIB::send (uint32 b) {
- send (b & 0xF, b & 0xFFFFFFF0);
+void MidiDriver_ADLIB::send(uint32 b) {
+ send(b & 0xF, b & 0xFFFFFFF0);
}
-void MidiDriver_ADLIB::send (byte chan, uint32 b) {
+void MidiDriver_ADLIB::send(byte chan, uint32 b) {
//byte param3 = (byte) ((b >> 24) & 0xFF);
byte param2 = (byte) ((b >> 16) & 0xFF);
byte param1 = (byte) ((b >> 8) & 0xFF);
@@ -877,7 +877,7 @@
if (chan == 9)
part = &_percussion;
else
- part = &_parts [chan];
+ part = &_parts[chan];
switch (cmd) {
case 0x80:// Note Off
@@ -929,7 +929,7 @@
void MidiDriver_ADLIB::setPitchBendRange(byte channel, uint range) {
AdlibVoice *voice;
- AdlibPart *part = &_parts [channel];
+ AdlibPart *part = &_parts[channel];
part->_pitchbend_factor = range;
for (voice = part->_voice; voice; voice = voice->_next) {
@@ -950,7 +950,7 @@
part = &_parts[i];
if (!part->_allocated) {
part->allocate();
- return (part);
+ return part;
}
}
return NULL;
@@ -966,19 +966,19 @@
if (_adlib_reg_cache[port] == value)
return;
#ifdef DEBUG_ADLIB
- debug (6, "%10d: adlib_write[%x] = %x", tick, port, value);
+ debug(6, "%10d: adlib_write[%x] = %x", tick, port, value);
#endif
_adlib_reg_cache[port] = value;
OPLWriteReg(_opl, port, value);
}
-void MidiDriver_ADLIB::generate_samples(int16 *data, int len) {
+void MidiDriver_ADLIB::generateSamples(int16 *data, int len) {
memset(data, 0, sizeof(int16) * len);
YM3812UpdateOne(_opl, data, len);
}
-void MidiDriver_ADLIB::on_timer() {
+void MidiDriver_ADLIB::onTimer() {
AdlibVoice *voice;
int i;
Index: mt32.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/backends/midi/mt32.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- mt32.cpp 6 Nov 2004 02:20:43 -0000 1.2
+++ mt32.cpp 8 Nov 2004 10:16:07 -0000 1.3
@@ -38,14 +38,14 @@
class MidiDriver_MT32 : public MidiDriver_Emulated {
private:
- MidiChannel_MPU401 _midi_channels[16];
- uint16 _channel_mask;
+ MidiChannel_MPU401 _midiChannels[16];
+ uint16 _channelMask;
MT32Emu::Synth *_synth;
int _outputRate;
protected:
- void generate_samples(int16 *buf, int len);
+ void generateSamples(int16 *buf, int len);
public:
MidiDriver_MT32(SoundMixer *mixer);
@@ -144,10 +144,10 @@
}
MidiDriver_MT32::MidiDriver_MT32(SoundMixer *mixer) : MidiDriver_Emulated(mixer) {
- _channel_mask = 0xFFFF; // Permit all 16 channels by default
+ _channelMask = 0xFFFF; // Permit all 16 channels by default
uint i;
- for (i = 0; i < ARRAYSIZE(_midi_channels); ++i) {
- _midi_channels [i].init (this, i);
+ for (i = 0; i < ARRAYSIZE(_midiChannels); ++i) {
+ _midiChannels[i].init(this, i);
}
_synth = NULL;
@@ -218,15 +218,15 @@
_synth = NULL;
}
-void MidiDriver_MT32::generate_samples(int16 *data, int len) {
+void MidiDriver_MT32::generateSamples(int16 *data, int len) {
_synth->render(data, len);
}
-uint32 MidiDriver_MT32::property (int prop, uint32 param) {
+uint32 MidiDriver_MT32::property(int prop, uint32 param) {
switch (prop) {
- case PROP_CHANNEL_MASK:
- _channel_mask = param & 0xFFFF;
- return 1;
+ case PROP_CHANNEL_MASK:
+ _channelMask = param & 0xFFFF;
+ return 1;
}
return 0;
@@ -236,10 +236,10 @@
MidiChannel_MPU401 *chan;
uint i;
- for (i = 0; i < ARRAYSIZE(_midi_channels); ++i) {
- if (i == 9 || !(_channel_mask & (1 << i)))
+ for (i = 0; i < ARRAYSIZE(_midiChannels); ++i) {
+ if (i == 9 || !(_channelMask & (1 << i)))
continue;
- chan = &_midi_channels[i];
+ chan = &_midiChannels[i];
if (chan->allocate()) {
return chan;
}
@@ -248,7 +248,7 @@
}
MidiChannel *MidiDriver_MT32::getPercussionChannel() {
- return &_midi_channels [9];
+ return &_midiChannels[9];
}
////////////////////////////////////////
Index: ym2612.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/backends/midi/ym2612.cpp,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -d -r1.27 -r1.28
--- ym2612.cpp 17 Oct 2004 17:49:45 -0000 1.27
+++ ym2612.cpp 8 Nov 2004 10:16:07 -0000 1.28
@@ -164,7 +164,7 @@
int volume(int val = -1) { if (val >= 0) _volume = val; return _volume; }
void rate(uint16 r);
- void generate_samples(int16 *buf, int len);
+ void generateSamples(int16 *buf, int len);
public:
MidiDriver_YM2612(SoundMixer *mixer);
@@ -802,7 +802,7 @@
_channel[msg[1]]->sysEx_customInstrument('EUP ', &msg[2]);
}
-void MidiDriver_YM2612::generate_samples(int16 *data, int len) {
+void MidiDriver_YM2612::generateSamples(int16 *data, int len) {
memset(data, 0, 2 * sizeof(int16) * len);
nextTick(data, len);
}
Index: emumidi.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/backends/midi/emumidi.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- emumidi.h 23 Oct 2004 20:33:39 -0000 1.5
+++ emumidi.h 8 Nov 2004 10:16:07 -0000 1.6
@@ -31,15 +31,15 @@
SoundMixer *_mixer;
private:
- Timer::TimerProc _timer_proc;
- void *_timer_param;
+ Timer::TimerProc _timerProc;
+ void *_timerParam;
- int _next_tick;
- int _samples_per_tick;
+ int _nextTick;
+ int _samplesPerTick;
protected:
- virtual void generate_samples(int16 *buf, int len) = 0;
- virtual void on_timer() {}
+ virtual void generateSamples(int16 *buf, int len) = 0;
+ virtual void onTimer() {}
int _baseFreq;
@@ -47,11 +47,11 @@
MidiDriver_Emulated(SoundMixer *mixer) : _mixer(mixer) {
_isOpen = false;
- _timer_proc = 0;
- _timer_param = 0;
+ _timerProc = 0;
+ _timerParam = 0;
- _next_tick = 0;
- _samples_per_tick = 0;
+ _nextTick = 0;
+ _samplesPerTick = 0;
_baseFreq = 250;
}
@@ -65,13 +65,13 @@
// This is equivalent to (getRate() << FIXP_SHIFT) / BASE_FREQ
// but less prone to arithmetic overflow.
- _samples_per_tick = (d << FIXP_SHIFT) + (r << FIXP_SHIFT) / _baseFreq;
+ _samplesPerTick = (d << FIXP_SHIFT) + (r << FIXP_SHIFT) / _baseFreq;
return 0;
}
void setTimerCallback(void *timer_param, Timer::TimerProc timer_proc) {
- _timer_proc = timer_proc;
- _timer_param = timer_param;
+ _timerProc = timer_proc;
+ _timerParam = timer_param;
}
uint32 getBaseTempo() { return 1000000 / _baseFreq; }
@@ -85,17 +85,17 @@
do {
step = len;
- if (step > (_next_tick >> FIXP_SHIFT))
- step = (_next_tick >> FIXP_SHIFT);
+ if (step > (_nextTick >> FIXP_SHIFT))
+ step = (_nextTick >> FIXP_SHIFT);
- generate_samples(data, step);
+ generateSamples(data, step);
- _next_tick -= step << FIXP_SHIFT;
- if (!(_next_tick >> FIXP_SHIFT)) {
- if (_timer_proc)
- (*_timer_proc)(_timer_param);
- on_timer();
- _next_tick += _samples_per_tick;
+ _nextTick -= step << FIXP_SHIFT;
+ if (!(_nextTick >> FIXP_SHIFT)) {
+ if (_timerProc)
+ (*_timerProc)(_timerParam);
+ onTimer();
+ _nextTick += _samplesPerTick;
}
data += step * stereoFactor;
len -= step;
More information about the Scummvm-git-logs
mailing list