Skip to content

Commit a483332

Browse files
committed
Scale current duration when tempo is adjusted
1 parent 56bff43 commit a483332

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

shared-module/synthio/MidiTrack.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ mp_int_t common_hal_synthio_miditrack_get_tempo(synthio_miditrack_obj_t *self) {
122122

123123
void common_hal_synthio_miditrack_set_tempo(synthio_miditrack_obj_t *self, mp_int_t value) {
124124
mp_int_t val = mp_arg_validate_int_min(value, 1, MP_QSTR_tempo);
125+
self->synth.span.dur = (uint32_t)self->synth.span.dur * self->tempo / val;
125126
self->tempo = val;
126127
}
127128

0 commit comments

Comments
 (0)