mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-07 04:06:45 +01:00
wip: refactor pt.20: 44 errors
This commit is contained in:
parent
914c2d6c09
commit
2188bccd63
25 changed files with 664 additions and 486 deletions
|
|
@ -1,18 +1,18 @@
|
|||
use crate::*;
|
||||
|
||||
pub struct ArrangementAudio {
|
||||
model: Arc<RwLock<Arrangement>>
|
||||
}
|
||||
pub struct ArrangerAudio(pub Arc<RwLock<Arrangement>>);
|
||||
|
||||
impl From<&Arc<RwLock<Arrangement>>> for ArrangementAudio {
|
||||
fn from (model: &Arc<RwLock<Arrangement>>) -> Self {
|
||||
Self { model: model.clone() }
|
||||
impl Audio for ArrangerAudio {
|
||||
#[inline] fn process (&mut self, client: &Client, scope: &ProcessScope) -> Control {
|
||||
ArrangerRefAudio(&mut*self.0.write().unwrap()).process(client, scope)
|
||||
}
|
||||
}
|
||||
|
||||
impl Audio for ArrangementAudio {
|
||||
pub struct ArrangerRefAudio<'a>(pub &'a mut Arrangement);
|
||||
|
||||
impl<'a> Audio for ArrangerRefAudio<'a> {
|
||||
#[inline] fn process (&mut self, client: &Client, scope: &ProcessScope) -> Control {
|
||||
for track in self.model.write().unwrap().tracks.iter_mut() {
|
||||
for track in self.0.tracks.iter_mut() {
|
||||
if MIDIPlayerAudio::from(&mut track.player).process(client, scope) == Control::Quit {
|
||||
return Control::Quit
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,11 +1,24 @@
|
|||
use crate::*;
|
||||
|
||||
pub struct SequencerAppAudio<'a>(&'a mut Transport, &'a mut MIDIPlayer);
|
||||
pub struct SequencerAudio(pub Arc<RwLock<Transport>>, pub Arc<RwLock<MIDIPlayer>>);
|
||||
|
||||
/// JACK process callback for sequencer app
|
||||
impl<'a> Audio for SequencerAppAudio<'a> {
|
||||
impl<'a> Audio for SequencerAudio {
|
||||
fn process (&mut self, client: &Client, scope: &ProcessScope) -> Control {
|
||||
if TransportAudio::from(&mut*self.0).process(client, scope) == Control::Quit {
|
||||
SequencerRefAudio(
|
||||
&mut*self.0.write().unwrap(),
|
||||
&mut*self.1.write().unwrap()
|
||||
).process(client, scope)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
pub struct SequencerRefAudio<'a>(pub &'a mut Transport, pub &'a mut MIDIPlayer);
|
||||
|
||||
/// JACK process callback for sequencer embed
|
||||
impl<'a> Audio for SequencerRefAudio<'a> {
|
||||
fn process (&mut self, client: &Client, scope: &ProcessScope) -> Control {
|
||||
if TransportRefAudio(&mut*self.0).process(client, scope) == Control::Quit {
|
||||
return Control::Quit
|
||||
}
|
||||
if MIDIPlayerAudio::from(&mut*self.1).process(client, scope) == Control::Quit {
|
||||
|
|
|
|||
|
|
@ -1,16 +1,20 @@
|
|||
use crate::*;
|
||||
|
||||
pub struct TransportAudio<'a>(&'a mut Transport);
|
||||
pub struct TransportAudio(pub Arc<RwLock<Transport>>);
|
||||
|
||||
impl<'a> From<&'a mut Transport> for TransportAudio<'a> {
|
||||
fn from (model: &'a mut Transport) -> Self {
|
||||
Self(model)
|
||||
impl Audio for TransportAudio {
|
||||
fn process (&mut self, client: &Client, scope: &ProcessScope) -> Control {
|
||||
TransportRefAudio(
|
||||
&mut*self.0.write().unwrap()
|
||||
).process(client, scope)
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> Audio for TransportAudio<'a> {
|
||||
pub struct TransportRefAudio<'a>(pub &'a mut Transport);
|
||||
|
||||
impl<'a> Audio for TransportRefAudio<'a> {
|
||||
fn process (&mut self, _: &Client, scope: &ProcessScope) -> Control {
|
||||
let state = &mut self.0;
|
||||
let ref state = self.0;
|
||||
let times = scope.cycle_times().unwrap();
|
||||
let CycleTimes { current_frames, current_usecs, next_usecs: _, period_usecs: _ } = times;
|
||||
let _chunk_size = scope.n_frames() as usize;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue