diff options
author | Werner Schweer <ws.seh.de> | 2006-11-05 22:00:01 +0000 |
---|---|---|
committer | Werner Schweer <ws.seh.de> | 2006-11-05 22:00:01 +0000 |
commit | b92fdeb0f83f85063ea67a87ea02084816d47354 (patch) | |
tree | 5960d6361dfcefc1b5424e88c3b05c3bfd729789 | |
parent | 8e6eef6c783cac7143093a9a2c6f7e036d20a663 (diff) |
small updates
-rw-r--r-- | muse/muse/midievent.cpp | 12 | ||||
-rw-r--r-- | muse/muse/midioutport.cpp | 27 |
2 files changed, 19 insertions, 20 deletions
diff --git a/muse/muse/midievent.cpp b/muse/muse/midievent.cpp index 573302c0..8dbf4dc2 100644 --- a/muse/muse/midievent.cpp +++ b/muse/muse/midievent.cpp @@ -79,11 +79,11 @@ MidiEvent::MidiEvent(unsigned tick, int channel, const Event& e) void MidiEvent::dump() const { printf("chan:%d ", _channel+1); - if (_type == 0x90) { // NoteOn + if (_type == ME_NOTEON) { // NoteOn QString s = pitch2string(_a); printf("NoteOn %3s(0x%02x) %3d\n", s.toLatin1().data(), _a, _b); } - else if (_type == 0xf0) { + else if (_type == ME_SYSEX) { printf("SysEx len %d ", len()); int n = len() < 7 ? len() : 7; unsigned char* p = data(); @@ -91,12 +91,14 @@ void MidiEvent::dump() const printf("%02x ", *p++); printf("\n"); } - else if (_type == 0xb0) + else if (_type == ME_CONTROLLER) printf("Ctrl %d(0x%02x) %d(0x%02x)\n", _a, _a, _b, _b); - else if (_type == 0xc0) + else if (_type == ME_PROGRAM) printf("Prog %d(0x%02x)\n", _a, _a); - else if (_type == 0xd0) + else if (_type == ME_AFTERTOUCH) printf("Aftertouch %d\n", _a); + else if (_type == ME_PITCHBEND) + printf("PitchBend %d\n", _a); else printf("type:0x%02x a=%d(0x%02x) b=%d(0x%02x)\n", _type, _a, _a, _b, _b); } diff --git a/muse/muse/midioutport.cpp b/muse/muse/midioutport.cpp index 720256b5..c3fc16fc 100644 --- a/muse/muse/midioutport.cpp +++ b/muse/muse/midioutport.cpp @@ -132,8 +132,8 @@ void MidiOutPort::routeEvent(const MidiEvent& event) int chn = event.channel(); if (chn == 255) { // port controller - if (hwCtrlState(a) == event.dataB()) { -// printf(" controller change optimized away 1\n"); + if (hwCtrlState(a) == b) { +// printf(" controller change optimized away 1\n"); return; } setHwCtrlState(a, b); @@ -143,8 +143,8 @@ void MidiOutPort::routeEvent(const MidiEvent& event) // // optimize controller settings // - if (mc->hwCtrlState(a) == event.dataB()) { -// printf(" controller change optimized away 2\n"); + if (mc->hwCtrlState(a) == b) { +// printf(" controller %02x change optimized away: value %02x\n", a, b); return; } mc->setHwCtrlState(a, b); @@ -185,17 +185,14 @@ void MidiOutPort::queueAlsaEvent(const MidiEvent& ev) AO(MidiEvent(t, chn, ME_PITCHBEND, b, 0)); } else if (a == CTRL_PROGRAM) { - // don't output program changes for GM drum channel -// if (!(song->mtype() == MT_GM && chn == 9)) { - int hb = (b >> 16) & 0xff; - int lb = (b >> 8) & 0xff; - int pr = b & 0x7f; - if (hb != 0xff) - AO(MidiEvent(t, chn, ME_CONTROLLER, CTRL_HBANK, hb)); - if (lb != 0xff) - AO(MidiEvent(t+1, chn, ME_CONTROLLER, CTRL_LBANK, lb)); - AO(MidiEvent(t+2, chn, ME_PROGRAM, pr, 0)); -// } + int hb = (b >> 16) & 0xff; + int lb = (b >> 8) & 0xff; + int pr = b & 0x7f; + if (hb != 0xff) + AO(MidiEvent(t, chn, ME_CONTROLLER, CTRL_HBANK, hb)); + if (lb != 0xff) + AO(MidiEvent(t+1, chn, ME_CONTROLLER, CTRL_LBANK, lb)); + AO(MidiEvent(t+2, chn, ME_PROGRAM, pr, 0)); } else if (a == CTRL_MASTER_VOLUME) { unsigned char sysex[] = { |