Skip to content

Commit

Permalink
correction
Browse files Browse the repository at this point in the history
  • Loading branch information
the-drunk-coder committed Jun 2, 2022
1 parent 2156e7e commit 5e612a8
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/building_blocks/oscillators/lf_rsaw.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ impl<const BUFSIZE: usize> MonoSource<BUFSIZE> for LFRSaw<BUFSIZE> {
SynthParameterLabel::PitchFrequency => match value {
SynthParameterValue::ScalarF32(f) => {
self.freq = *f;
self.amp_inc = -2.0 / (self.samplerate / self.freq);
self.amp_inc = 2.0 / (self.samplerate / self.freq);
}
_ => {}
},
Expand Down Expand Up @@ -116,8 +116,8 @@ impl<const BUFSIZE: usize> MonoSource<BUFSIZE> for LFRSaw<BUFSIZE> {
*current_sample = self.cur_amp * amp_buf[idx];
}

self.amp_inc = -2.0 / (self.samplerate / freq_buf[idx]);
self.cur_amp += self.amp_inc;
self.amp_inc = 2.0 / (self.samplerate / freq_buf[idx]);
self.cur_amp -= self.amp_inc;
}
} else {
for current_sample in out_buf.iter_mut().take(BUFSIZE).skip(start_sample) {
Expand All @@ -131,7 +131,7 @@ impl<const BUFSIZE: usize> MonoSource<BUFSIZE> for LFRSaw<BUFSIZE> {
*current_sample = self.cur_amp * self.amp;
}

self.cur_amp += self.amp_inc;
self.cur_amp -= self.amp_inc;
}
}

Expand Down

0 comments on commit 5e612a8

Please sign in to comment.