mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-06 11:46:41 +01:00
wip: down to 25 errors woo
This commit is contained in:
parent
89288f2920
commit
6ce83fb27a
25 changed files with 688 additions and 620 deletions
|
|
@ -21,12 +21,12 @@ pub struct App {
|
|||
pub dialog: Option<Dialog>,
|
||||
/// Browses external resources, such as directories
|
||||
pub browser: Option<Browser>,
|
||||
/// Contains the currently edited musical arrangement
|
||||
pub arranger: Option<Arrangement>,
|
||||
/// Contains all clips in the project
|
||||
pub pool: Option<Pool>,
|
||||
/// Contains the currently edited MIDI clip
|
||||
pub editor: Option<MidiEditor>,
|
||||
/// Contains the currently edited musical arrangement
|
||||
pub arranger: Arrangement,
|
||||
|
||||
// Cache of formatted strings
|
||||
pub view_cache: Arc<RwLock<ViewCache>>,
|
||||
|
|
@ -34,6 +34,12 @@ pub struct App {
|
|||
pub color: ItemTheme,
|
||||
}
|
||||
|
||||
has!(Option<Selection>: |self: App|self.arrangement.selected);
|
||||
has!(Vec<JackMidiIn>: |self: App|self.arrangement.midi_ins);
|
||||
has!(Vec<JackMidiOut>: |self: App|self.arrangement.midi_outs);
|
||||
has!(Vec<Scene>: |self: App|self.arrangement.scenes);
|
||||
has!(Vec<Track>: |self: App|self.arrangement.tracks);
|
||||
|
||||
impl App {
|
||||
pub fn toggle_dialog (&mut self, dialog: Option<Dialog>) {
|
||||
self.dialog = if self.dialog == dialog {
|
||||
|
|
@ -86,16 +92,10 @@ pub enum Message {
|
|||
FailedToAddDevice,
|
||||
}
|
||||
|
||||
content!(TuiOut: |self: Message| match self {
|
||||
Self::FailedToAddDevice => "Failed to add device."
|
||||
});
|
||||
|
||||
content!(TuiOut: |self: Message| match self { Self::FailedToAddDevice => "Failed to add device." });
|
||||
has_size!(<TuiOut>|self: App|&self.size);
|
||||
|
||||
has_clock!(|self: App|self.clock);
|
||||
|
||||
has!(Clock: |self: App|self.clock);
|
||||
has_clips!(|self: App|self.pool.as_ref().expect("no clip pool").clips);
|
||||
|
||||
has_editor!(|self: App|{
|
||||
editor = self.editor;
|
||||
editor_w = {
|
||||
|
|
@ -109,30 +109,6 @@ has_editor!(|self: App|{
|
|||
is_editing = self.editing.load(Relaxed);
|
||||
});
|
||||
|
||||
impl HasTracks for App {
|
||||
fn midi_ins (&self) -> &Vec<JackMidiIn> {
|
||||
&self.arranger.midi_ins
|
||||
}
|
||||
fn midi_outs (&self) -> &Vec<JackMidiOut> {
|
||||
&self.arranger.midi_outs
|
||||
}
|
||||
fn tracks (&self) -> &Vec<Track> {
|
||||
&self.arranger.tracks
|
||||
}
|
||||
fn tracks_mut (&mut self) -> &mut Vec<Track> {
|
||||
&mut self.arranger.tracks
|
||||
}
|
||||
}
|
||||
|
||||
impl HasScenes for Arrangement {
|
||||
fn scenes (&self) -> &Vec<Scene> {
|
||||
&self.arranger.scenes
|
||||
}
|
||||
fn scenes_mut (&mut self) -> &mut Vec<Scene> {
|
||||
&mut self.arranger.scenes
|
||||
}
|
||||
}if
|
||||
|
||||
#[tengri_proc::expose]
|
||||
impl App {
|
||||
fn _todo_isize_stub (&self) -> isize {
|
||||
|
|
@ -258,4 +234,27 @@ impl App {
|
|||
0
|
||||
}
|
||||
}
|
||||
fn device_add_lv2 (&mut self) -> Usually<()> {
|
||||
todo!();
|
||||
Ok(())
|
||||
}
|
||||
fn device_add_sampler (&mut self, jack: &Jack) -> Usually<usize> {
|
||||
let name = jack.with_client(|c|c.name().to_string());
|
||||
let midi = self.track().expect("no active track").sequencer.midi_outs[0].name();
|
||||
let sampler = if let Ok(sampler) = Sampler::new(
|
||||
jack,
|
||||
&format!("{}/Sampler", Has::<Track>::get(self).name),
|
||||
&[PortConnect::exact(format!("{name}:{midi}"))],
|
||||
&[&[], &[]],
|
||||
&[&[], &[]]
|
||||
) {
|
||||
self.dialog = None;
|
||||
Device::Sampler(sampler)
|
||||
} else {
|
||||
self.dialog = Some(Dialog::Message(Message::FailedToAddDevice));
|
||||
return Err("failed to add device".into())
|
||||
};
|
||||
Has::<Track>::get_mut(self).expect("no active track").devices.push(sampler);
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue