mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-07 12:16:42 +01:00
fix connecting track devices
This commit is contained in:
parent
eeb2faf064
commit
14b504374f
4 changed files with 52 additions and 27 deletions
26
src/edn.rs
26
src/edn.rs
|
|
@ -83,12 +83,24 @@ impl Track {
|
|||
_ => {}
|
||||
}
|
||||
}
|
||||
let (left, right) = (app.audio_out(0), app.audio_out(1));
|
||||
app.add_track_with_cb(Some(name.as_str()), move|_, track|{
|
||||
for phrase in phrases {
|
||||
track.phrases.push(phrase);
|
||||
}
|
||||
for device in devices {
|
||||
track.add_device(device);
|
||||
track.add_device(device)?;
|
||||
}
|
||||
if let Some(device) = track.devices.get(0) {
|
||||
device.connect_midi_in(0, &track.midi_out.clone_unowned())?;
|
||||
}
|
||||
if let Some(device) = track.devices.get(track.devices.len() - 1) {
|
||||
if let Some(ref left) = left {
|
||||
device.connect_audio_out(0, left)?;
|
||||
}
|
||||
if let Some(ref right) = right {
|
||||
device.connect_audio_out(1, right)?;
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
})
|
||||
|
|
@ -133,10 +145,12 @@ impl Phrase {
|
|||
if !data.contains_key(&time) {
|
||||
data.insert(time, vec![]);
|
||||
}
|
||||
data.get_mut(&time).unwrap().push(MidiMessage::NoteOn {
|
||||
key: u7::from(*key as u8),
|
||||
vel: u7::from(*vel as u8),
|
||||
});
|
||||
let (key, vel) = (
|
||||
u7::from((*key as u8).min(127)),
|
||||
u7::from((*vel as u8).min(127))
|
||||
);
|
||||
data.get_mut(&time).unwrap()
|
||||
.push(MidiMessage::NoteOn { key, vel })
|
||||
} else {
|
||||
panic!("unexpected list in phrase '{name}'")
|
||||
},
|
||||
|
|
@ -228,7 +242,7 @@ impl LV2Plugin {
|
|||
path = String::from(*p);
|
||||
}
|
||||
},
|
||||
_ => panic!("unexpected in sample {name}"),
|
||||
_ => panic!("unexpected in lv2 '{name}'"),
|
||||
}
|
||||
}
|
||||
Plugin::lv2(&name, &path)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue