2828#include "shared-bindings/synthio/MidiTrack.h"
2929
3030
31- STATIC void print_midi_stream_error (synthio_miditrack_obj_t * self ) {
31+ STATIC void record_midi_stream_error (synthio_miditrack_obj_t * self ) {
3232 self -> error_location = self -> pos ;
3333 self -> pos = self -> track .len ;
3434}
@@ -37,11 +37,11 @@ STATIC mp_obj_t parse_note(synthio_miditrack_obj_t *self) {
3737 uint8_t * buffer = self -> track .buf ;
3838 size_t len = self -> track .len ;
3939 if (self -> pos + 1 >= len ) {
40- print_midi_stream_error (self );
40+ record_midi_stream_error (self );
4141 }
4242 uint8_t note = buffer [(self -> pos )++ ];
4343 if (note > 127 || buffer [(self -> pos )++ ] > 127 ) {
44- print_midi_stream_error (self );
44+ record_midi_stream_error (self );
4545 }
4646 return MP_OBJ_NEW_SMALL_INT (note );
4747}
@@ -60,7 +60,7 @@ static int decode_duration(synthio_miditrack_obj_t *self) {
6060 // errors cannot be raised from the background task, so simply end the track.
6161 if (c & 0x80 ) {
6262 self -> pos = self -> track .len ;
63- print_midi_stream_error (self );
63+ record_midi_stream_error (self );
6464 }
6565 return delta * self -> synth .sample_rate / self -> tempo ;
6666}
@@ -89,14 +89,14 @@ static void decode_until_pause(synthio_miditrack_obj_t *self) {
8989 case 12 :
9090 case 13 : // one data byte to ignore
9191 if (self -> pos >= len || buffer [self -> pos ++ ] > 127 ) {
92- print_midi_stream_error (self );
92+ record_midi_stream_error (self );
9393 }
9494 break ;
9595 case 15 : // the full syntax is too complicated, just assume it's "End of Track" event
9696 self -> pos = len ;
9797 break ;
9898 default : // invalid event
99- print_midi_stream_error (self );
99+ record_midi_stream_error (self );
100100 }
101101 if (self -> pos < len ) {
102102 self -> synth .span .dur = decode_duration (self );
0 commit comments