Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix for resetting phase on trigger mod #110

Merged
merged 1 commit into from
Mar 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/amy.c
Original file line number Diff line number Diff line change
Expand Up @@ -579,6 +579,7 @@ void reset_osc(uint16_t i ) {
synth[i].feedback = F2S(0); //.996; todo ks feedback is v different from fm feedback
msynth[i].feedback = F2S(0); //.996; todo ks feedback is v different from fm feedback
synth[i].phase = F2P(0);
synth[i].trigger_phase = F2P(0);
synth[i].volume = 0;
synth[i].eq_l = 0;
synth[i].eq_m = 0;
Expand Down Expand Up @@ -847,7 +848,7 @@ void play_event(struct delta d) {
sine_note_on(d.osc, freq_of_logfreq(synth[d.osc].logfreq_coefs[0]));
}
}
if(d.param == PHASE) synth[d.osc].phase = *(PHASOR *)&d.data; // PHASOR
if(d.param == PHASE) { synth[d.osc].phase = *(PHASOR *)&d.data; synth[d.osc].trigger_phase = *(PHASOR*)&d.data; } // PHASOR
if(d.param == PATCH) synth[d.osc].patch = *(uint16_t *)&d.data;
if(d.param == FEEDBACK) synth[d.osc].feedback = *(float *)&d.data;

Expand Down Expand Up @@ -957,6 +958,9 @@ void play_event(struct delta d) {
osc_note_on(d.osc, initial_freq);
// trigger the mod source, if we have one
if(AMY_IS_SET(synth[d.osc].mod_source)) {
synth[synth[d.osc].mod_source].phase = synth[synth[d.osc].mod_source].trigger_phase;


synth[synth[d.osc].mod_source].note_on_clock = total_samples; // Need a note_on_clock to have envelope work correctly.
if(synth[synth[d.osc].mod_source].wave==SINE) sine_mod_trigger(synth[d.osc].mod_source);
if(synth[synth[d.osc].mod_source].wave==SAW_DOWN) saw_up_mod_trigger(synth[d.osc].mod_source);
Expand Down
1 change: 1 addition & 0 deletions src/amy.h
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,7 @@ struct synthinfo {
float feedback;
uint8_t status;
float velocity;
PHASOR trigger_phase;
PHASOR phase;
float detune;
float step;
Expand Down
Loading