Skip to content

Commit

Permalink
Change layout, fix bug with 1 byte messages
Browse files Browse the repository at this point in the history
  • Loading branch information
HackerFoo committed Mar 18, 2021
1 parent 3d86f3f commit 4a24375
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion midi_tasks.c
Original file line number Diff line number Diff line change
Expand Up @@ -980,7 +980,7 @@ DTASK_ENABLE(transpose) {
show_octave(*DREF(transpose));
}

const int upper_limit = 128 - 40 + ALIGNMENT_PADDING(128 - 40, 12);
const int upper_limit = 128 - 24 + ALIGNMENT_PADDING(128 - 24, 12);

DTASK(transpose, int8_t) {
const control_change_t *cc = DREF(control_change);
Expand Down
15 changes: 8 additions & 7 deletions midipush.c
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,12 @@ bool read_midi_msgs(struct midi *m, midi_tasks_state_t *state, dtask_set_t *even

const char *buffer_end = buffer + n;
seg_t msg;
while(msg = find_midi_msg(&m->last_status, &buffer, buffer_end), msg.n) {
while(msg = find_midi_msg(&m->last_status, &buffer, buffer_end), msg.s) {
#if DEBUG
printf("msg(%d, %02x)", m->id, m->last_status);
COUNTUP(i, msg.n) printf(" %02x", msg.s[i]);
printf("\n");
#endif
midi_state.midi_in.status = m->last_status;
if(!msg.n) m->last_status = 0; // ***
midi_state.midi_in.id = m->id;
Expand Down Expand Up @@ -382,13 +387,9 @@ bool in_key(unsigned int scale, unsigned int key) {
unsigned int pad_to_note(unsigned int pad) {
int
x = pad & 7,
y = pad >> 3,
block_column = x >> 2,
block_x = x & 3;
y = pad >> 3;
return
block_column * 12 + // right side is an octave higher
block_x +
y * 3.5; // shift rows by alternating 3/4 semitones
x + y * 3.5; // shift rows by alternating 3/4 semitones
}

void write_text(int x, int y, seg_t s) {
Expand Down

0 comments on commit 4a24375

Please sign in to comment.