mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-08 04:36:45 +01:00
wip: down to 13 errors
This commit is contained in:
parent
6ce83fb27a
commit
ebdb8881e9
19 changed files with 793 additions and 691 deletions
|
|
@ -2,17 +2,17 @@
|
|||
use crate::*;
|
||||
|
||||
impl<T: Has<Sequencer>> HasSequencer for T {
|
||||
fn sequencer (&self) -> &impl MidiSequencer {
|
||||
fn sequencer (&self) -> &Sequencer {
|
||||
self.get()
|
||||
}
|
||||
fn sequencer_mut (&mut self) -> &mut impl MidiSequencer {
|
||||
fn sequencer_mut (&mut self) -> &mut Sequencer {
|
||||
self.get_mut()
|
||||
}
|
||||
}
|
||||
|
||||
pub trait HasSequencer {
|
||||
fn sequencer (&self) -> &impl MidiSequencer;
|
||||
fn sequencer_mut (&mut self) -> &mut impl MidiSequencer;
|
||||
fn sequencer (&self) -> &Sequencer;
|
||||
fn sequencer_mut (&mut self) -> &mut Sequencer;
|
||||
}
|
||||
|
||||
/// Contains state for playing a clip
|
||||
|
|
@ -41,6 +41,8 @@ pub struct Sequencer {
|
|||
pub notes_out: Arc<RwLock<[bool; 128]>>,
|
||||
/// MIDI output buffer
|
||||
pub note_buf: Vec<u8>,
|
||||
/// MIDI output buffer
|
||||
pub midi_buf: Vec<Vec<Vec<u8>>>,
|
||||
}
|
||||
|
||||
impl Default for Sequencer {
|
||||
|
|
@ -55,6 +57,7 @@ impl Default for Sequencer {
|
|||
notes_in: RwLock::new([false;128]).into(),
|
||||
notes_out: RwLock::new([false;128]).into(),
|
||||
note_buf: vec![0;8],
|
||||
midi_buf: vec![],
|
||||
reset: true,
|
||||
|
||||
midi_ins: vec![],
|
||||
|
|
@ -80,14 +83,10 @@ impl Sequencer {
|
|||
midi_outs: vec![JackMidiOut::new(jack, format!("{}/M", name.as_ref()), midi_to)?, ],
|
||||
play_clip: clip.map(|clip|(Moment::zero(&clock.timebase), Some(clip.clone()))),
|
||||
clock,
|
||||
note_buf: vec![0;8],
|
||||
reset: true,
|
||||
recording: false,
|
||||
monitoring: false,
|
||||
overdub: false,
|
||||
next_clip: None,
|
||||
notes_in: RwLock::new([false;128]).into(),
|
||||
notes_out: RwLock::new([false;128]).into(),
|
||||
..Default::default()
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
@ -106,12 +105,9 @@ has!(Clock: |self: Sequencer|self.clock);
|
|||
has!(Vec<JackMidiIn>: |self:Sequencer| self.midi_ins);
|
||||
has!(Vec<JackMidiOut>: |self:Sequencer| self.midi_outs);
|
||||
|
||||
impl MidiRecorder for Sequencer {
|
||||
fn recording (&self) -> bool {
|
||||
self.recording
|
||||
}
|
||||
fn recording_mut (&mut self) -> &mut bool {
|
||||
&mut self.recording
|
||||
impl MidiMonitor for Sequencer {
|
||||
fn notes_in (&self) -> &Arc<RwLock<[bool; 128]>> {
|
||||
&self.notes_in
|
||||
}
|
||||
fn monitoring (&self) -> bool {
|
||||
self.monitoring
|
||||
|
|
@ -119,21 +115,21 @@ impl MidiRecorder for Sequencer {
|
|||
fn monitoring_mut (&mut self) -> &mut bool {
|
||||
&mut self.monitoring
|
||||
}
|
||||
}
|
||||
|
||||
impl MidiRecord for Sequencer {
|
||||
fn recording (&self) -> bool {
|
||||
self.recording
|
||||
}
|
||||
fn recording_mut (&mut self) -> &mut bool {
|
||||
&mut self.recording
|
||||
}
|
||||
fn overdub (&self) -> bool {
|
||||
self.overdub
|
||||
}
|
||||
fn overdub_mut (&mut self) -> &mut bool {
|
||||
&mut self.overdub
|
||||
}
|
||||
fn notes_in (&self) -> &Arc<RwLock<[bool; 128]>> {
|
||||
&self.notes_in
|
||||
}
|
||||
}
|
||||
|
||||
impl MidiPlayer for Sequencer {
|
||||
fn notes_out (&self) -> &Arc<RwLock<[bool; 128]>> {
|
||||
&self.notes_out
|
||||
}
|
||||
}
|
||||
|
||||
impl HasPlayClip for Sequencer {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue