Skip to content

Commit 4257c62

Browse files
committed
Variable number of samples within shared_bindings_synthio_lfo_tick.
1 parent 48ca21d commit 4257c62

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

shared-bindings/synthio/__init__.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ MP_DEFINE_CONST_FUN_OBJ_1(synthio_voct_to_hz_obj, voct_to_hz);
292292

293293
#if CIRCUITPY_AUDIOCORE_DEBUG
294294
static mp_obj_t synthio_lfo_tick(size_t n, const mp_obj_t *args) {
295-
shared_bindings_synthio_lfo_tick(48000);
295+
shared_bindings_synthio_lfo_tick(48000, SYNTHIO_MAX_DUR);
296296
mp_obj_t result[n];
297297
for (size_t i = 0; i < n; i++) {
298298
synthio_block_slot_t slot;

shared-module/synthio/__init__.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ void synthio_synth_synthesize(synthio_synth_t *synth, uint8_t **bufptr, uint32_t
294294
return;
295295
}
296296

297-
shared_bindings_synthio_lfo_tick(synth->sample_rate);
297+
shared_bindings_synthio_lfo_tick(synth->sample_rate, SYNTHIO_MAX_DUR);
298298

299299
synth->buffer_index = !synth->buffer_index;
300300
synth->other_channel = 1 - channel;
@@ -487,9 +487,9 @@ uint32_t synthio_frequency_convert_scaled_to_dds(uint64_t frequency_scaled, int3
487487
return (sample_rate / 2 + frequency_scaled) / sample_rate;
488488
}
489489

490-
void shared_bindings_synthio_lfo_tick(uint32_t sample_rate) {
490+
void shared_bindings_synthio_lfo_tick(uint32_t sample_rate, uint16_t num_samples) {
491491
mp_float_t recip_sample_rate = MICROPY_FLOAT_CONST(1.) / sample_rate;
492-
synthio_global_rate_scale = SYNTHIO_MAX_DUR * recip_sample_rate;
492+
synthio_global_rate_scale = num_samples * recip_sample_rate;
493493
synthio_global_W_scale = (2 * MP_PI) * recip_sample_rate;
494494
synthio_global_tick++;
495495
}

shared-module/synthio/__init__.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,4 +90,4 @@ int synthio_sweep_in_step(synthio_lfo_state_t *state, uint16_t dur);
9090

9191
extern mp_float_t synthio_global_rate_scale, synthio_global_W_scale;
9292
extern uint8_t synthio_global_tick;
93-
void shared_bindings_synthio_lfo_tick(uint32_t sample_rate);
93+
void shared_bindings_synthio_lfo_tick(uint32_t sample_rate, uint16_t num_samples);

0 commit comments

Comments
 (0)