synthio: re-striking a note should re-enter attack

.. without changing the current note amplitude
This commit is contained in:
Jeff Epler 2023-05-04 07:23:17 -05:00
parent 021aaa4599
commit 2b0231e9d3
No known key found for this signature in database
GPG Key ID: D5BF15AB975AB4DE

View File

@ -372,9 +372,8 @@ STATIC int find_channel_with_note(synthio_synth_t *synth, mp_obj_t note) {
bool synthio_span_change_note(synthio_synth_t *synth, mp_obj_t old_note, mp_obj_t new_note) {
int channel;
if (new_note != SYNTHIO_SILENCE && (channel = find_channel_with_note(synth, new_note)) != -1) {
// note already playing, re-strike
synthio_envelope_state_init(&synth->envelope_state[channel], &synth->envelope_definition);
synth->accum[channel] = 0;
// note already playing, re-enter attack phase
synth->envelope_state[channel].state = SYNTHIO_ENVELOPE_STATE_ATTACK;
return true;
}
channel = find_channel_with_note(synth, old_note);