synthio: Fix sweep-type pitch bends
The accumulator saturate logic was wrong, and the sweep was never restarted either
This commit is contained in:
parent
bc7feb30a5
commit
585b1c23b5
@ -193,6 +193,9 @@ void synthio_note_recalculate(synthio_note_obj_t *self, int32_t sample_rate) {
|
||||
|
||||
void synthio_note_start(synthio_note_obj_t *self, int32_t sample_rate) {
|
||||
synthio_note_recalculate(self, sample_rate);
|
||||
if (self->bend_mode != SYNTHIO_BEND_MODE_VIBRATO) {
|
||||
self->bend_state.phase = 0;
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t synthio_note_envelope(synthio_note_obj_t *self) {
|
||||
|
@ -554,8 +554,9 @@ STATIC int synthio_lfo_step_common(synthio_lfo_state_t *state, uint16_t dur) {
|
||||
return whole_phase;
|
||||
}
|
||||
STATIC int synthio_lfo_sweep_common(synthio_lfo_state_t *state, uint16_t dur) {
|
||||
uint32_t old_phase = state->phase;
|
||||
uint16_t whole_phase = synthio_lfo_step_common(state, dur);
|
||||
if (state->phase < state->dds) {
|
||||
if (state->phase < old_phase) {
|
||||
state->phase = 0xffffffff;
|
||||
}
|
||||
return whole_phase;
|
||||
|
Loading…
Reference in New Issue
Block a user