if (this->pos_write == this->pos_read)
this->full = 1;
}
return length + skip_active_sense;
}
int line6_midibuf_read(struct midi_buffer *this, unsignedchar *data, int length, int read_type)
{ int bytes_used; int length1, length2; int command; int midi_length; int repeat = 0; int i;
/* we need to be able to store at least a 3 byte MIDI message */ if (length < 3) return -EINVAL;
if (midibuf_is_empty(this)) return 0;
bytes_used = line6_midibuf_bytes_used(this);
if (length > bytes_used)
length = bytes_used;
length1 = this->size - this->pos_read;
command = this->buf[this->pos_read]; /* PODxt always has status byte lower nibble set to 0010, when it means to send 0000, so we correct if here so that control/program changes come on channel 1 and sysex message status byte is correct
*/ if (read_type == LINE6_MIDIBUF_READ_RX) { if (command == 0xb2 || command == 0xc2 || command == 0xf2) { unsignedchar fixed = command & 0xf0;
this->buf[this->pos_read] = fixed;
command = fixed;
}
}
/* check MIDI command length */ if (command & 0x80) {
midi_length = midibuf_message_length(command);
this->command_prev = command;
} else { if (this->command_prev > 0) { int midi_length_prev =
midibuf_message_length(this->command_prev);
if (midi_length < 0) { /* search for end of message */ if (length < length1) { /* no buffer wraparound */ for (i = 1; i < length; ++i) if (this->buf[this->pos_read + i] & 0x80) break;
for (i = 1; i < length1; ++i) if (this->buf[this->pos_read + i] & 0x80) break;
if (i < length1)
midi_length = i; else { for (i = 0; i < length2; ++i) if (this->buf[i] & 0x80) break;
midi_length = length1 + i;
}
}
if (midi_length == length)
midi_length = -1; /* end of message not found */
}
if (midi_length < 0) { if (!this->split) return 0; /* command is not yet complete */
} else { if (length < midi_length) return 0; /* command is not yet complete */
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.