unified compact flag in groovebox

This commit is contained in:
🪞👃🪞 2025-01-02 18:40:29 +01:00
parent c9a79b1f29
commit 511ff91864
12 changed files with 129 additions and 188 deletions

View file

@ -118,4 +118,26 @@ impl Sample {
}
Ok(())
}
pub fn handle_cc (&mut self, controller: u7, value: u7) {
let percentage = value.as_int() as f64 / 127.;
match controller.as_int() {
20 => {
self.start = (percentage * self.end as f64) as usize;
},
21 => {
let length = self.channels[0].len();
self.end = length.min(
self.start + (percentage * (length as f64 - self.start as f64)) as usize
);
},
22 => { /*attack*/ },
23 => { /*decay*/ },
24 => {
self.gain = percentage as f32 * 2.0;
},
26 => { /* pan */ }
25 => { /* pitch */ }
_ => {}
}
}
}