mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-06 19:56:42 +01:00
move all port connections to constructors (port: impl AsRef<str>)
This commit is contained in:
parent
e8b97bed37
commit
6607491f16
9 changed files with 215 additions and 129 deletions
12
src/midi.rs
12
src/midi.rs
|
|
@ -127,7 +127,13 @@ pub struct MidiPlayer {
|
|||
pub note_buf: Vec<u8>,
|
||||
}
|
||||
impl MidiPlayer {
|
||||
pub fn new (jack: &Arc<RwLock<JackConnection>>, name: &str) -> Usually<Self> {
|
||||
pub fn new (
|
||||
jack: &Arc<RwLock<JackConnection>>,
|
||||
name: impl AsRef<str>,
|
||||
midi_from: &[impl AsRef<str>],
|
||||
midi_to: &[impl AsRef<str>],
|
||||
) -> Usually<Self> {
|
||||
let name = name.as_ref();
|
||||
Ok(Self {
|
||||
clock: ClockModel::from(jack),
|
||||
play_phrase: None,
|
||||
|
|
@ -138,11 +144,11 @@ impl MidiPlayer {
|
|||
|
||||
notes_in: RwLock::new([false;128]).into(),
|
||||
midi_ins: vec![
|
||||
jack.midi_in(&format!("M/{name}"))?,
|
||||
jack.midi_in(&format!("M/{name}"), midi_from)?,
|
||||
],
|
||||
|
||||
midi_outs: vec![
|
||||
jack.midi_out(&format!("{name}/M"))?,
|
||||
jack.midi_out(&format!("{name}/M"), midi_to)?,
|
||||
],
|
||||
notes_out: RwLock::new([false;128]).into(),
|
||||
reset: true,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue