@@ -115,6 +115,27 @@ static void check_for_deinit(synthio_miditrack_obj_t *self) {
115
115
//| """32 bit value that tells how quickly samples are played in Hertz (cycles per second)."""
116
116
//|
117
117
118
+ //| tempo: int
119
+ //| """Tempo of the streamed events, in MIDI ticks per second."""
120
+ //|
121
+ static mp_obj_t synthio_miditrack_obj_get_tempo (mp_obj_t self_in ) {
122
+ synthio_miditrack_obj_t * self = MP_OBJ_TO_PTR (self_in );
123
+ check_for_deinit (self );
124
+ return mp_obj_new_int (common_hal_synthio_miditrack_get_tempo (self ));
125
+ }
126
+ MP_DEFINE_CONST_FUN_OBJ_1 (synthio_miditrack_get_tempo_obj , synthio_miditrack_obj_get_tempo );
127
+
128
+ static mp_obj_t synthio_miditrack_obj_set_tempo (mp_obj_t self_in , mp_obj_t arg ) {
129
+ synthio_miditrack_obj_t * self = MP_OBJ_TO_PTR (self_in );
130
+ check_for_deinit (self );
131
+ common_hal_synthio_miditrack_set_tempo (self , mp_obj_get_int (arg ));
132
+ return mp_const_none ;
133
+ }
134
+ MP_DEFINE_CONST_FUN_OBJ_2 (synthio_miditrack_set_tempo_obj , synthio_miditrack_obj_set_tempo );
135
+ MP_PROPERTY_GETSET (synthio_miditrack_tempo_obj ,
136
+ (mp_obj_t )& synthio_miditrack_get_tempo_obj ,
137
+ (mp_obj_t )& synthio_miditrack_set_tempo_obj );
138
+
118
139
//| error_location: Optional[int]
119
140
//| """Offset, in bytes within the midi data, of a decoding error"""
120
141
//|
@@ -141,6 +162,7 @@ static const mp_rom_map_elem_t synthio_miditrack_locals_dict_table[] = {
141
162
142
163
// Properties
143
164
{ MP_ROM_QSTR (MP_QSTR_error_location ), MP_ROM_PTR (& synthio_miditrack_error_location_obj ) },
165
+ { MP_ROM_QSTR (MP_QSTR_tempo ), MP_ROM_PTR (& synthio_miditrack_tempo_obj ) },
144
166
AUDIOSAMPLE_FIELDS ,
145
167
};
146
168
static MP_DEFINE_CONST_DICT (synthio_miditrack_locals_dict , synthio_miditrack_locals_dict_table ) ;
0 commit comments