mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-06 19:56:42 +01:00
36 lines
1.2 KiB
Rust
36 lines
1.2 KiB
Rust
use crate::*;
|
|
use super::*;
|
|
|
|
|
|
audio!(|self: Groovebox, client, scope|{
|
|
let t0 = self.perf.get_t0();
|
|
if Control::Quit == ClockAudio(&mut self.player).process(client, scope) {
|
|
return Control::Quit
|
|
}
|
|
if Control::Quit == PlayerAudio(
|
|
&mut self.player, &mut self.note_buf, &mut self.midi_buf
|
|
).process(client, scope) {
|
|
return Control::Quit
|
|
}
|
|
if Control::Quit == SamplerAudio(&mut self.sampler).process(client, scope) {
|
|
return Control::Quit
|
|
}
|
|
// TODO move these to editor and sampler:
|
|
for RawMidi { time, bytes } in self.player.midi_ins[0].iter(scope) {
|
|
if let LiveEvent::Midi { message, .. } = LiveEvent::parse(bytes).unwrap() {
|
|
match message {
|
|
MidiMessage::NoteOn { ref key, .. } => {
|
|
self.editor.set_note_point(key.as_int() as usize);
|
|
},
|
|
MidiMessage::Controller { controller, value } => {
|
|
if let Some(sample) = &self.sampler.mapped[self.editor.note_point()] {
|
|
sample.write().unwrap().handle_cc(controller, value)
|
|
}
|
|
}
|
|
_ => {}
|
|
}
|
|
}
|
|
}
|
|
self.perf.update(t0, scope);
|
|
Control::Continue
|
|
});
|