mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-07 12:16:42 +01:00
jammable again - and autoconnects!
This commit is contained in:
parent
3ed9ebddd4
commit
768c2337e7
5 changed files with 98 additions and 59 deletions
29
src/main.rs
29
src/main.rs
|
|
@ -33,6 +33,20 @@ pub fn main () -> Usually<()> {
|
|||
state.playing = Some(TransportState::Stopped);
|
||||
state.midi_in = Some(client.register_port("midi-in", MidiIn)?);
|
||||
|
||||
let _ = ["nanoKEY Studio.*capture.*"]
|
||||
.iter()
|
||||
.map(|name|client
|
||||
.ports(Some(name), None, PortFlags::empty())
|
||||
.iter()
|
||||
.map(|name|{
|
||||
if let Some(port) = client.port_by_name(name) {
|
||||
client.connect_ports(&port, &state.midi_in.as_ref().unwrap())?;
|
||||
}
|
||||
Ok(())
|
||||
})
|
||||
.collect::<Usually<()>>())
|
||||
.collect::<Usually<()>>()?;
|
||||
|
||||
let timebase = &state.timebase;
|
||||
let ppq = timebase.ppq() as usize;
|
||||
state.track_cursor = 1;
|
||||
|
|
@ -54,7 +68,9 @@ pub fn main () -> Usually<()> {
|
|||
state.add_track_with_cb(Some("Drums"), |_, track|{
|
||||
|
||||
track.add_device_with_cb(Sampler::new("Sampler", Some(BTreeMap::from([
|
||||
sample!(36, "Kick", "/home/user/Lab/Music/pak/kik.wav"),
|
||||
sample!(34, "808", "/home/user/Lab/Music/pak/808.wav"),
|
||||
sample!(35, "Kick1", "/home/user/Lab/Music/pak/kik.wav"),
|
||||
sample!(36, "Kick2", "/home/user/Lab/Music/pak/kik2.wav"),
|
||||
sample!(40, "Snare", "/home/user/Lab/Music/pak/sna.wav"),
|
||||
sample!(44, "Hihat", "/home/user/Lab/Music/pak/chh.wav"),
|
||||
])))?, |track, device|{
|
||||
|
|
@ -89,13 +105,13 @@ pub fn main () -> Usually<()> {
|
|||
00 * ppq/4 => MidiMessage::NoteOn { key: 36.into(), vel: 100.into() },
|
||||
04 * ppq/4 => MidiMessage::NoteOn { key: 40.into(), vel: 100.into() },
|
||||
08 * ppq/4 => MidiMessage::NoteOn { key: 36.into(), vel: 100.into() },
|
||||
10 * ppq/4 => MidiMessage::NoteOn { key: 36.into(), vel: 100.into() },
|
||||
10 * ppq/4 => MidiMessage::NoteOn { key: 35.into(), vel: 100.into() },
|
||||
12 * ppq/4 => MidiMessage::NoteOn { key: 40.into(), vel: 100.into() },
|
||||
}));
|
||||
track.add_phrase("Garage", ppq * 4, Some(phrase! {
|
||||
00 * ppq/4 => MidiMessage::NoteOn { key: 36.into(), vel: 100.into() },
|
||||
00 * ppq/4 => MidiMessage::NoteOn { key: 35.into(), vel: 100.into() },
|
||||
04 * ppq/4 => MidiMessage::NoteOn { key: 40.into(), vel: 100.into() },
|
||||
11 * ppq/4 => MidiMessage::NoteOn { key: 36.into(), vel: 100.into() },
|
||||
11 * ppq/4 => MidiMessage::NoteOn { key: 35.into(), vel: 100.into() },
|
||||
12 * ppq/4 => MidiMessage::NoteOn { key: 40.into(), vel: 100.into() },
|
||||
}));
|
||||
Ok(())
|
||||
|
|
@ -105,7 +121,8 @@ pub fn main () -> Usually<()> {
|
|||
track.add_device_with_cb(Plugin::lv2(
|
||||
"Odin2",
|
||||
"file:///home/user/.lv2/Odin2.lv2"
|
||||
)?, |_, device|{
|
||||
)?, |track, device|{
|
||||
device.connect_midi_in(0, &track.midi_out.clone_unowned())?;
|
||||
if let Some(Some(left)) = outputs.get(0) {
|
||||
device.connect_audio_out(0, left)?;
|
||||
}
|
||||
|
|
@ -208,7 +225,7 @@ process!(App |self, _client, scope| {
|
|||
&self.timebase,
|
||||
self.playing,
|
||||
&scope,
|
||||
frame,
|
||||
self.playhead,
|
||||
frames,
|
||||
panic,
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue