mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-06 19:56:42 +01:00
device: add DeviceAudio dispatcher
This commit is contained in:
parent
fb99128650
commit
c78b2dc9de
3 changed files with 62 additions and 34 deletions
|
|
@ -2,26 +2,20 @@ use crate::*;
|
|||
impl HasJack for App { fn jack (&self) -> &Jack { &self.jack } }
|
||||
audio!(
|
||||
|self: App, client, scope|{
|
||||
|
||||
// Start profiling cycle
|
||||
let t0 = self.perf.get_t0();
|
||||
|
||||
// Update transport clock
|
||||
self.clock().update_from_scope(scope).unwrap();
|
||||
// Collect MIDI input (TODO preallocate)
|
||||
|
||||
// Collect MIDI input (TODO preallocate large buffers)
|
||||
let midi_in = self.midi_ins.iter()
|
||||
.map(|port|port.port().iter(scope)
|
||||
.map(|RawMidi { time, bytes }|(time, LiveEvent::parse(bytes)))
|
||||
.collect::<Vec<_>>())
|
||||
.collect::<Vec<_>>();
|
||||
// Update standalone MIDI sequencer
|
||||
//if let Some(player) = self.player.as_mut() {
|
||||
//if Control::Quit == PlayerAudio(
|
||||
//player,
|
||||
//&mut self.note_buf,
|
||||
//&mut self.midi_buf,
|
||||
//).process(client, scope) {
|
||||
//return Control::Quit
|
||||
//}
|
||||
//}
|
||||
|
||||
// Update standalone sampler
|
||||
//if let Some(sampler) = self.sampler.as_mut() {
|
||||
//if Control::Quit == SamplerAudio(sampler).process(client, scope) {
|
||||
|
|
@ -35,6 +29,7 @@ audio!(
|
|||
//}
|
||||
//}
|
||||
//}
|
||||
|
||||
// TODO move these to editor and sampler?:
|
||||
//for port in midi_in.iter() {
|
||||
//for event in port.iter() {
|
||||
|
|
@ -58,14 +53,21 @@ audio!(
|
|||
//}
|
||||
//}
|
||||
//}
|
||||
// Update track sequencers
|
||||
|
||||
// Update track sequencers and devices
|
||||
for track in self.tracks.iter_mut() {
|
||||
if PlayerAudio(
|
||||
if Control::Quit == PlayerAudio(
|
||||
track.player_mut(), &mut self.note_buf, &mut self.midi_buf
|
||||
).process(client, scope) == Control::Quit {
|
||||
).process(client, scope) {
|
||||
return Control::Quit
|
||||
}
|
||||
for device in track.devices.iter_mut() {
|
||||
if Control::Quit == DeviceAudio(device).process(client, scope) {
|
||||
return Control::Quit
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// End profiling cycle
|
||||
self.perf.update_from_jack_scope(t0, scope);
|
||||
Control::Continue
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue