and it once again compiles

This commit is contained in:
🪞👃🪞 2024-08-09 21:59:14 +03:00
parent 6dd4caeb42
commit 430c51e305
31 changed files with 466 additions and 694 deletions

View file

@ -13,7 +13,6 @@ tek_plugin = { path = "../tek_plugin" }
tek_sampler = { path = "../tek_sampler" }
tek_sequencer = { path = "../tek_sequencer" }
tek_timer = { path = "../tek_timer" }
tek_chain = { path = "../tek_chain" }
tek_mixer = { path = "../tek_mixer", features = ["standalone_devices"] }
#jack = "0.10"
#crossterm = "0.27"

View file

@ -1,6 +1,8 @@
use crate::*;
use tek_core::Direction;
use tek_timer::TransportToolbar;
use tek_sequencer::Arranger;
use tek_mixer::Mixer;
/// Root of application state.
pub struct App {
@ -10,8 +12,10 @@ pub struct App {
pub section: AppFocus,
/// Transport model and view.
pub transport: TransportToolbar,
/// Arranger/sequencer
/// Arranger (contains sequencers)
pub arranger: Arranger,
/// Mixer (contains tracks)
pub mixer: Mixer,
/// Main JACK client.
pub jack: Option<JackClient>,
/// Map of external MIDI outs in the jack graph
@ -37,13 +41,14 @@ impl App {
Client::new("tek", ClientOptions::NO_START_SERVER)?.0
);
*MODAL.lock().unwrap() = first_run.then(||{
Exit::boxed(SetupModal(Some(xdg.clone()), false))
ExitableComponent::boxed(SetupModal(Some(xdg.clone()), false))
});
Ok(Self {
entered: true,
section: AppFocus::default(),
transport: TransportToolbar::new(Some(jack.transport())),
arranger: Arranger::new(),
mixer: Mixer::new("")?,
jack: Some(jack),
audio_outs: vec![],
chain_mode: false,
@ -97,8 +102,13 @@ render!(App |self, buf, area| {
&self.transport,
&self.arranger,
&If(self.arranger.selected.is_clip(), &Split::right([
&tek_chain::ChainView::vertical(&self),
&self.sequencer,
&tek_mixer::TrackView {
direction: Direction::Down,
entered: self.entered,
focused: self.section == AppFocus::Chain,
chain: self.mixer.track()
},
&self.arranger.sequencer,
]))
]).render(buf, area)?;
if let Some(ref modal) = *MODAL.lock().unwrap() {

View file

@ -51,7 +51,7 @@ fn handle_focused (state: &mut App, e: &AppEvent) -> Usually<bool> {
}
fn handle_device (state: &mut App, e: &AppEvent) -> Usually<bool> {
state.arranger.track()
state.mixer.track()
.and_then(|track|track.device_mut())
.map(|mut device|device.handle(e))
.transpose()
@ -99,7 +99,7 @@ pub const KEYMAP_GLOBAL: &'static [KeyBinding<App>] = keymap!(App {
phrase.notes = notes;
phrase.length = phrase.length * 2;
});
app.arranger.sequencer.show(app.arranger.phrase())?;
//app.arranger.show_phrase()?;
Ok(true)
}],
[Char('l'), NONE, "loop_toggle", "toggle looping", |_app: &mut App| {

View file

@ -59,10 +59,10 @@ impl App {
}
},
Some(Edn::Symbol("scene")) => {
tek_sequencer::Scene::from_edn(self, &items[1..])?;
tek_sequencer::Scene::from_edn(&items[1..])?;
},
Some(Edn::Symbol("track")) => {
tek_mixer::MixerTrack::from_edn(self, &items[1..])?;
tek_mixer::Track::from_edn(&items[1..])?;
},
Some(Edn::Symbol("midi-in")) => {
self.midi_ins = items[1..].iter().map(|x|match x {

View file

@ -24,7 +24,7 @@ submod! {
}
/// Global modal dialog
pub static MODAL: Lazy<Arc<Mutex<Option<Box<dyn Exit>>>>> =
pub static MODAL: Lazy<Arc<Mutex<Option<Box<dyn ExitableComponent>>>>> =
Lazy::new(||Arc::new(Mutex::new(None)));
/// Application entrypoint.
@ -55,10 +55,10 @@ pub fn main () -> Usually<()> {
for (index, track) in app.arranger.tracks.iter_mut().enumerate() {
track.midi_out = midi_outs[index].take();
}
for track in app.arranger.tracks.iter() {
track.connect_first_device()?;
track.connect_last_device(&app)?;
}
//for track in app.arranger.tracks.iter() {
//track.connect_first_device()?;
//track.connect_last_device(&app)?;
//}
};
})))?)?;
Ok(())