13
0

Send and Read MIDI Positions the right way

This commit is contained in:
Michael Fisher 2013-08-02 18:23:36 -05:00
parent 94f366190e
commit e82574de05
2 changed files with 5 additions and 7 deletions

View File

@ -303,8 +303,7 @@ MidiTracer::tracer (Parser&, byte* msg, size_t len)
} else if (len == 3 && msg[0] == MIDI::position) {
/* MIDI Song Position */
uint16_t midi_beats = (uint16_t) msg[1];
midi_beats |= msg[2];
int midi_beats = (msg[2] << 7) | msg[1];
s += snprintf (&buf[s], bufsize, "%16s %d\n", "Position", (int) midi_beats);
} else {

View File

@ -386,11 +386,10 @@ MidiClockTicker::send_position_event (uint32_t midi_beats, pframes_t offset)
}
/* split midi beats into a 14bit value */
MIDI::byte msg[3] = {
MIDI_CMD_COMMON_SONG_POS,
midi_beats & 0x007f,
midi_beats & 0x3f80
};
MIDI::byte msg[3];
msg[0] = MIDI_CMD_COMMON_SONG_POS;
msg[1] = midi_beats & 0x007f;
msg[2] = midi_beats >> 7;
_midi_port->midimsg (msg, sizeof (msg), offset);