Skip to content

Commit

Permalink
Lisää siirroksen indikaattori demoon
Browse files Browse the repository at this point in the history
  • Loading branch information
ollpu committed May 4, 2021
1 parent b9e5139 commit 9f14abd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions examples/demo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,11 @@ impl Widget for Plot {
*tr = factor * self.buffer[i + self.offset] + (1. - factor) * *tr;
}
}
// Draw indicator self.offset indicator
canvas.clear_rect((x + 0.4 * w) as u32, (y + h - 40.) as u32, (0.2 * w) as u32, 15, Color::rgb(70, 70, 70));
let pos = self.offset as f32 / N as f32;
let span = M as f32 / N as f32;
canvas.clear_rect((x + (0.4 + 0.2 * pos) * w) as u32, (y + h - 40.) as u32, (0.2 * span * w) as u32, 15, Color::rgb(90, 90, 90));
// Smooth once per displayed frame. Memory is smoothed once per piece of input data instead.
let factor = if self.stabilize_enabled { self.display_decay } else { 1. };
for (i, tr) in self.last_displayed.iter_mut().enumerate() {
Expand Down
2 changes: 1 addition & 1 deletion examples/test_signal/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ impl TestSignal {
if self.counter == 0 {
for sample in buffer.iter_mut() {
let modulator = osc(&mut self.modulator_phase, 0.5);
*sample = 0.8 * osc(&mut self.oscillator_phase, 300. * (1. + 0.2 * modulator));
*sample = 0.8 * osc(&mut self.oscillator_phase, 201. * (1. + 0.109 * modulator));
}
self.counter = 1;
true
Expand Down

0 comments on commit 9f14abd

Please sign in to comment.