mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-07 04:06:45 +01:00
comment out app-specific structs/impls. only monoapp remains
This commit is contained in:
parent
e73c31d494
commit
479988272e
6 changed files with 1080 additions and 1075 deletions
196
tek/src/audio.rs
196
tek/src/audio.rs
|
|
@ -2,9 +2,9 @@ use crate::*;
|
|||
impl HasJack for App {
|
||||
fn jack (&self) -> &Arc<RwLock<JackConnection>> { &self.jack }
|
||||
}
|
||||
impl HasJack for Arranger {
|
||||
fn jack (&self) -> &Arc<RwLock<JackConnection>> { &self.jack }
|
||||
}
|
||||
//impl HasJack for Arranger {
|
||||
//fn jack (&self) -> &Arc<RwLock<JackConnection>> { &self.jack }
|
||||
//}
|
||||
audio!(|self: App, client, scope|{
|
||||
// Start profiling cycle
|
||||
let t0 = self.perf.get_t0();
|
||||
|
|
@ -101,111 +101,111 @@ audio!(|self: App, client, scope|{
|
|||
Control::Continue
|
||||
});
|
||||
|
||||
audio!(|self: Sequencer, client, scope|{
|
||||
// Start profiling cycle
|
||||
let t0 = self.perf.get_t0();
|
||||
//audio!(|self: Sequencer, client, scope|{
|
||||
//// Start profiling cycle
|
||||
//let t0 = self.perf.get_t0();
|
||||
|
||||
// Update transport clock
|
||||
if Control::Quit == ClockAudio(self).process(client, scope) {
|
||||
return Control::Quit
|
||||
}
|
||||
// Update MIDI sequencer
|
||||
if Control::Quit == PlayerAudio(
|
||||
&mut self.player, &mut self.note_buf, &mut self.midi_buf
|
||||
).process(client, scope) {
|
||||
return Control::Quit
|
||||
}
|
||||
|
||||
// End profiling cycle
|
||||
self.perf.update(t0, scope);
|
||||
|
||||
Control::Continue
|
||||
});
|
||||
|
||||
audio!(|self: Groovebox, client, scope|{
|
||||
// Start profiling cycle
|
||||
let t0 = self.perf.get_t0();
|
||||
|
||||
// Update transport clock
|
||||
if Control::Quit == ClockAudio(&mut self.player).process(client, scope) {
|
||||
return Control::Quit
|
||||
}
|
||||
|
||||
// Update MIDI sequencer
|
||||
if Control::Quit == PlayerAudio(
|
||||
&mut self.player, &mut self.note_buf, &mut self.midi_buf
|
||||
).process(client, scope) {
|
||||
return Control::Quit
|
||||
}
|
||||
|
||||
// Update sampler
|
||||
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].port.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)
|
||||
}
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// End profiling cycle
|
||||
self.perf.update(t0, scope);
|
||||
|
||||
Control::Continue
|
||||
});
|
||||
|
||||
audio!(|self: Arranger, client, scope|{
|
||||
// Start profiling cycle
|
||||
let t0 = self.perf.get_t0();
|
||||
|
||||
// Update transport clock
|
||||
if Control::Quit == ClockAudio(self).process(client, scope) {
|
||||
return Control::Quit
|
||||
}
|
||||
|
||||
//// Update MIDI sequencers
|
||||
//let tracks = &mut self.tracks;
|
||||
//let note_buf = &mut self.note_buf;
|
||||
//let midi_buf = &mut self.midi_buf;
|
||||
//if Control::Quit == TracksAudio(tracks, note_buf, midi_buf).process(client, scope) {
|
||||
//// Update transport clock
|
||||
//if Control::Quit == ClockAudio(self).process(client, scope) {
|
||||
//return Control::Quit
|
||||
//}
|
||||
//// Update MIDI sequencer
|
||||
//if Control::Quit == PlayerAudio(
|
||||
//&mut self.player, &mut self.note_buf, &mut self.midi_buf
|
||||
//).process(client, scope) {
|
||||
//return Control::Quit
|
||||
//}
|
||||
|
||||
// FIXME: one of these per playing track
|
||||
//self.now.set(0.);
|
||||
//if let ArrangerSelection::Clip(t, s) = self.selected {
|
||||
//let clip = self.scenes.get(s).map(|scene|scene.clips.get(t));
|
||||
//if let Some(Some(Some(clip))) = clip {
|
||||
//if let Some(track) = self.tracks().get(t) {
|
||||
//if let Some((ref started_at, Some(ref playing))) = track.player.play_clip {
|
||||
//let clip = clip.read().unwrap();
|
||||
//if *playing.read().unwrap() == *clip {
|
||||
//let pulse = self.current().pulse.get();
|
||||
//let start = started_at.pulse.get();
|
||||
//let now = (pulse - start) % clip.length as f64;
|
||||
//self.now.set(now);
|
||||
//// End profiling cycle
|
||||
//self.perf.update(t0, scope);
|
||||
|
||||
//Control::Continue
|
||||
//});
|
||||
|
||||
//audio!(|self: Groovebox, client, scope|{
|
||||
//// Start profiling cycle
|
||||
//let t0 = self.perf.get_t0();
|
||||
|
||||
//// Update transport clock
|
||||
//if Control::Quit == ClockAudio(&mut self.player).process(client, scope) {
|
||||
//return Control::Quit
|
||||
//}
|
||||
|
||||
//// Update MIDI sequencer
|
||||
//if Control::Quit == PlayerAudio(
|
||||
//&mut self.player, &mut self.note_buf, &mut self.midi_buf
|
||||
//).process(client, scope) {
|
||||
//return Control::Quit
|
||||
//}
|
||||
|
||||
//// Update sampler
|
||||
//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].port.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)
|
||||
//}
|
||||
//}
|
||||
//_ => {}
|
||||
//}
|
||||
//}
|
||||
//}
|
||||
|
||||
// End profiling cycle
|
||||
self.perf.update(t0, scope);
|
||||
return Control::Continue
|
||||
});
|
||||
//// End profiling cycle
|
||||
//self.perf.update(t0, scope);
|
||||
|
||||
//Control::Continue
|
||||
//});
|
||||
|
||||
//audio!(|self: Arranger, client, scope|{
|
||||
//// Start profiling cycle
|
||||
//let t0 = self.perf.get_t0();
|
||||
|
||||
//// Update transport clock
|
||||
//if Control::Quit == ClockAudio(self).process(client, scope) {
|
||||
//return Control::Quit
|
||||
//}
|
||||
|
||||
////// Update MIDI sequencers
|
||||
////let tracks = &mut self.tracks;
|
||||
////let note_buf = &mut self.note_buf;
|
||||
////let midi_buf = &mut self.midi_buf;
|
||||
////if Control::Quit == TracksAudio(tracks, note_buf, midi_buf).process(client, scope) {
|
||||
////return Control::Quit
|
||||
////}
|
||||
|
||||
//// FIXME: one of these per playing track
|
||||
////self.now.set(0.);
|
||||
////if let ArrangerSelection::Clip(t, s) = self.selected {
|
||||
////let clip = self.scenes.get(s).map(|scene|scene.clips.get(t));
|
||||
////if let Some(Some(Some(clip))) = clip {
|
||||
////if let Some(track) = self.tracks().get(t) {
|
||||
////if let Some((ref started_at, Some(ref playing))) = track.player.play_clip {
|
||||
////let clip = clip.read().unwrap();
|
||||
////if *playing.read().unwrap() == *clip {
|
||||
////let pulse = self.current().pulse.get();
|
||||
////let start = started_at.pulse.get();
|
||||
////let now = (pulse - start) % clip.length as f64;
|
||||
////self.now.set(now);
|
||||
////}
|
||||
////}
|
||||
////}
|
||||
////}
|
||||
////}
|
||||
|
||||
//// End profiling cycle
|
||||
//self.perf.update(t0, scope);
|
||||
//return Control::Continue
|
||||
//});
|
||||
|
||||
/// Hosts the JACK callback for a collection of tracks
|
||||
pub struct TracksAudio<'a>(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue