aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main.rs11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/main.rs b/src/main.rs
index 063db5f..e60ee45 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -42,13 +42,20 @@ impl Trigger {
let mut res = 0i16;
let abs = sample.abs() as u32;
+ let div = if (abs > self.acc) {
+ abs - self.acc
+ }
+ else {
+ 0
+ };
+
self.acc = (self.acc + abs) / 2;
- if !self.trigged && self.acc > 1000 {
+ if !self.trigged && div > 5000 {
self.trigged = true;
self.playing = true;
self.sample_pos = 0;
}
- else if self.trigged && self.acc < 50 {
+ else if self.trigged && self.acc < 250 {
self.trigged = false;
}