aboutsummaryrefslogtreecommitdiff
path: root/sound/midiparser.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'sound/midiparser.cpp')
-rw-r--r--sound/midiparser.cpp22
1 files changed, 13 insertions, 9 deletions
diff --git a/sound/midiparser.cpp b/sound/midiparser.cpp
index 8ae2bad71a..d58471765e 100644
--- a/sound/midiparser.cpp
+++ b/sound/midiparser.cpp
@@ -67,6 +67,10 @@ void MidiParser::property(int prop, int value) {
}
}
+void MidiParser::sendToDriver(uint32 b) {
+ _driver->send(b);
+}
+
void MidiParser::setTempo(uint32 tempo) {
_tempo = tempo;
if (_ppqn)
@@ -127,7 +131,7 @@ void MidiParser::hangingNote(byte channel, byte note, uint32 time_left, bool rec
best = ptr;
if (ptr->time_left) {
if (recycle)
- _driver->send(0x80 | channel, note, 0);
+ sendToDriver(0x80 | channel, note, 0);
--_hanging_notes_count;
}
break;
@@ -172,7 +176,7 @@ void MidiParser::onTimer() {
for (i = ARRAYSIZE(_hanging_notes); i; --i, ++ptr) {
if (ptr->time_left) {
if (ptr->time_left <= _timer_rate) {
- _driver->send(0x80 | ptr->channel, ptr->note, 0);
+ sendToDriver(0x80 | ptr->channel, ptr->note, 0);
ptr->time_left = 0;
--_hanging_notes_count;
} else {
@@ -232,7 +236,7 @@ void MidiParser::onTimer() {
else
activeNote(info.channel(), info.basic.param1, true);
}
- _driver->send(info.event, info.basic.param1, info.basic.param2);
+ sendToDriver(info.event, info.basic.param1, info.basic.param2);
}
@@ -258,7 +262,7 @@ void MidiParser::allNotesOff() {
for (i = 0; i < 128; ++i) {
for (j = 0; j < 16; ++j) {
if (_active_notes[i] & (1 << j)) {
- _driver->send(0x80 | j, i, 0);
+ sendToDriver(0x80 | j, i, 0);
}
}
}
@@ -266,7 +270,7 @@ void MidiParser::allNotesOff() {
// Turn off all hanging notes
for (i = 0; i < ARRAYSIZE(_hanging_notes); i++) {
if (_hanging_notes[i].time_left) {
- _driver->send(0x80 | _hanging_notes[i].channel, _hanging_notes[i].note, 0);
+ sendToDriver(0x80 | _hanging_notes[i].channel, _hanging_notes[i].note, 0);
_hanging_notes[i].time_left = 0;
}
}
@@ -276,7 +280,7 @@ void MidiParser::allNotesOff() {
// support this...).
for (i = 0; i < 16; ++i) {
- _driver->send(0xB0 | i, 0x7b, 0); // All notes off
+ sendToDriver(0xB0 | i, 0x7b, 0); // All notes off
}
memset(_active_notes, 0, sizeof(_active_notes));
@@ -348,7 +352,7 @@ void MidiParser::hangAllActiveNotes() {
for (j = 0; j < 16; ++j) {
if (temp_active[i] & (1 << j)) {
activeNote(j, i, false);
- _driver->send(0x80 | j, i, 0);
+ sendToDriver(0x80 | j, i, 0);
}
}
}
@@ -399,7 +403,7 @@ bool MidiParser::jumpToTick(uint32 tick, bool fireEvents, bool stopNotes) {
else
_driver->sysEx(info.ext.data, (uint16)info.length);
} else
- _driver->send(info.event, info.basic.param1, info.basic.param2);
+ sendToDriver(info.event, info.basic.param1, info.basic.param2);
}
parseNextEvent(_next_event);
@@ -441,7 +445,7 @@ void MidiParser::unloadMusic() {
if (_driver) {
for (int i = 0; i < 16; ++i) {
- _driver->send(0xE0 | i, 0, 0x40);
+ sendToDriver(0xE0 | i, 0, 0x40);
}
}
}