mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-06 19:56:42 +01:00
refactor jack ports again
This commit is contained in:
parent
c13eff95ca
commit
6c8f85ab84
16 changed files with 558 additions and 609 deletions
|
|
@ -30,16 +30,16 @@ pub trait HasSampler {
|
|||
}
|
||||
/// The sampler device plays sounds in response to MIDI notes.
|
||||
#[derive(Debug)] pub struct Sampler {
|
||||
pub jack: Arc<RwLock<JackConnection>>,
|
||||
pub jack: JackClient,
|
||||
pub name: String,
|
||||
pub mapped: [Option<Arc<RwLock<Sample>>>;128],
|
||||
pub recording: Option<(usize, Arc<RwLock<Sample>>)>,
|
||||
pub unmapped: Vec<Arc<RwLock<Sample>>>,
|
||||
pub voices: Arc<RwLock<Vec<Voice>>>,
|
||||
pub midi_in: Option<JackPort<MidiIn>>,
|
||||
pub audio_ins: Vec<JackPort<AudioIn>>,
|
||||
pub midi_in: Option<JackMidiIn>,
|
||||
pub audio_ins: Vec<JackAudioIn>,
|
||||
pub input_meter: Vec<f32>,
|
||||
pub audio_outs: Vec<JackPort<AudioOut>>,
|
||||
pub audio_outs: Vec<JackAudioOut>,
|
||||
pub buffer: Vec<Vec<f32>>,
|
||||
pub output_gain: f32
|
||||
}
|
||||
|
|
@ -89,7 +89,7 @@ impl Default for Sampler {
|
|||
}
|
||||
impl Sampler {
|
||||
pub fn new (
|
||||
jack: &Arc<RwLock<JackConnection>>,
|
||||
jack: &JackClient,
|
||||
name: impl AsRef<str>,
|
||||
midi_from: &[PortConnection],
|
||||
audio_from: &[&[PortConnection];2],
|
||||
|
|
@ -97,14 +97,14 @@ impl Sampler {
|
|||
) -> Usually<Self> {
|
||||
let name = name.as_ref();
|
||||
Ok(Self {
|
||||
midi_in: Some(JackPort::<MidiIn>::new(jack, format!("M/{name}"), midi_from)?),
|
||||
midi_in: Some(JackMidiIn::new(jack, format!("M/{name}"), midi_from)?),
|
||||
audio_ins: vec![
|
||||
JackPort::<AudioIn>::new(jack, &format!("L/{name}"), audio_from[0])?,
|
||||
JackPort::<AudioIn>::new(jack, &format!("R/{name}"), audio_from[1])?,
|
||||
JackAudioIn::new(jack, &format!("L/{name}"), audio_from[0])?,
|
||||
JackAudioIn::new(jack, &format!("R/{name}"), audio_from[1])?,
|
||||
],
|
||||
audio_outs: vec![
|
||||
JackPort::<AudioOut>::new(jack, &format!("{name}/L"), audio_to[0])?,
|
||||
JackPort::<AudioOut>::new(jack, &format!("{name}/R"), audio_to[1])?,
|
||||
JackAudioOut::new(jack, &format!("{name}/L"), audio_to[0])?,
|
||||
JackAudioOut::new(jack, &format!("{name}/R"), audio_to[1])?,
|
||||
],
|
||||
..Default::default()
|
||||
})
|
||||
|
|
@ -349,7 +349,7 @@ impl Sampler {
|
|||
}
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
type MidiSample = (Option<u7>, Arc<RwLock<crate::Sample>>);
|
||||
//from_atom!("sampler" => |jack: &Arc<RwLock<JackConnection>>, args| -> crate::Sampler {
|
||||
//from_atom!("sampler" => |jack: &JackClient, args| -> crate::Sampler {
|
||||
//let mut name = String::new();
|
||||
//let mut dir = String::new();
|
||||
//let mut samples = BTreeMap::new();
|
||||
|
|
@ -377,7 +377,7 @@ type MidiSample = (Option<u7>, Arc<RwLock<crate::Sample>>);
|
|||
//});
|
||||
//Self::new(jack, &name)
|
||||
//});
|
||||
//from_atom!("sample" => |(_jack, dir): (&Arc<RwLock<JackConnection>>, &str), args| -> MidiSample {
|
||||
//from_atom!("sample" => |(_jack, dir): (&JackClient, &str), args| -> MidiSample {
|
||||
//let mut name = String::new();
|
||||
//let mut file = String::new();
|
||||
//let mut midi = None;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue