mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-07 04:06:45 +01:00
groovebox: display input meters!
This commit is contained in:
parent
e5752ea4b0
commit
7690549bdc
12 changed files with 239 additions and 117 deletions
|
|
@ -1,55 +1,76 @@
|
|||
use crate::*;
|
||||
|
||||
pub type MaybeSample = Option<Arc<RwLock<Sample>>>;
|
||||
|
||||
/// The sampler device plays sounds in response to MIDI notes.
|
||||
#[derive(Debug)]
|
||||
pub struct Sampler {
|
||||
pub name: String,
|
||||
pub mapped: [MaybeSample;128],
|
||||
pub recording: Option<(usize, Arc<RwLock<Sample>>)>,
|
||||
pub unmapped: Vec<Arc<RwLock<Sample>>>,
|
||||
pub voices: Arc<RwLock<Vec<Voice>>>,
|
||||
pub midi_in: Option<JackMidiIn>,
|
||||
pub audio_ins: Vec<JackAudioIn>,
|
||||
pub input_meter: Vec<f32>,
|
||||
pub audio_outs: Vec<JackAudioOut>,
|
||||
pub buffer: Vec<Vec<f32>>,
|
||||
pub output_gain: f32,
|
||||
pub editing: MaybeSample,
|
||||
pub mode: Option<SamplerMode>,
|
||||
/// Size of actual notes area
|
||||
pub size: Measure<TuiOut>,
|
||||
/// Lowest note displayed
|
||||
pub note_lo: AtomicUsize,
|
||||
/// Selected note
|
||||
pub note_pt: AtomicUsize,
|
||||
/// Selected note as row/col
|
||||
pub cursor: (AtomicUsize, AtomicUsize),
|
||||
pub color: ItemTheme
|
||||
/// Name of sampler.
|
||||
pub name: String,
|
||||
/// Device color.
|
||||
pub color: ItemTheme,
|
||||
/// Audio input ports. Samples get recorded here.
|
||||
pub audio_ins: Vec<JackAudioIn>,
|
||||
/// Audio input meters.
|
||||
pub input_meters: Vec<f32>,
|
||||
/// Sample currently being recorded.
|
||||
pub recording: Option<(usize, Arc<RwLock<Sample>>)>,
|
||||
/// Recording buffer.
|
||||
pub buffer: Vec<Vec<f32>>,
|
||||
/// Samples mapped to MIDI notes.
|
||||
pub mapped: [Option<Arc<RwLock<Sample>>>;128],
|
||||
/// Samples that are not mapped to MIDI notes.
|
||||
pub unmapped: Vec<Arc<RwLock<Sample>>>,
|
||||
/// Sample currently being edited.
|
||||
pub editing: Option<Arc<RwLock<Sample>>>,
|
||||
/// MIDI input port. Triggers sample playback.
|
||||
pub midi_in: Option<JackMidiIn>,
|
||||
/// Collection of currently playing instances of samples.
|
||||
pub voices: Arc<RwLock<Vec<Voice>>>,
|
||||
/// Audio output ports. Voices get played here.
|
||||
pub audio_outs: Vec<JackAudioOut>,
|
||||
/// Audio output meters.
|
||||
pub output_meters: Vec<f32>,
|
||||
/// How to mix the voices.
|
||||
pub mixing_mode: MixingMode,
|
||||
/// How to meter the inputs and outputs.
|
||||
pub metering_mode: MeteringMode,
|
||||
/// Fixed gain applied to all output.
|
||||
pub output_gain: f32,
|
||||
/// Currently active modal, if any.
|
||||
pub mode: Option<SamplerMode>,
|
||||
/// Size of rendered sampler.
|
||||
pub size: Measure<TuiOut>,
|
||||
/// Lowest note displayed.
|
||||
pub note_lo: AtomicUsize,
|
||||
/// Currently selected note.
|
||||
pub note_pt: AtomicUsize,
|
||||
/// Selected note as row/col.
|
||||
pub cursor: (AtomicUsize, AtomicUsize),
|
||||
}
|
||||
|
||||
impl Default for Sampler {
|
||||
fn default () -> Self {
|
||||
Self {
|
||||
midi_in: None,
|
||||
audio_ins: vec![],
|
||||
input_meter: vec![0.0;2],
|
||||
audio_outs: vec![],
|
||||
name: "tek_sampler".to_string(),
|
||||
mapped: [const { None };128],
|
||||
unmapped: vec![],
|
||||
voices: Arc::new(RwLock::new(vec![])),
|
||||
buffer: vec![vec![0.0;16384];2],
|
||||
output_gain: 1.,
|
||||
recording: None,
|
||||
mode: None,
|
||||
editing: None,
|
||||
size: Default::default(),
|
||||
note_lo: 0.into(),
|
||||
note_pt: 0.into(),
|
||||
cursor: (0.into(), 0.into()),
|
||||
color: Default::default(),
|
||||
midi_in: None,
|
||||
audio_ins: vec![],
|
||||
input_meters: vec![0.0;2],
|
||||
output_meters: vec![0.0;2],
|
||||
audio_outs: vec![],
|
||||
name: "tek_sampler".to_string(),
|
||||
mapped: [const { None };128],
|
||||
unmapped: vec![],
|
||||
voices: Arc::new(RwLock::new(vec![])),
|
||||
buffer: vec![vec![0.0;16384];2],
|
||||
output_gain: 1.,
|
||||
recording: None,
|
||||
mode: None,
|
||||
editing: None,
|
||||
size: Default::default(),
|
||||
note_lo: 0.into(),
|
||||
note_pt: 0.into(),
|
||||
cursor: (0.into(), 0.into()),
|
||||
color: Default::default(),
|
||||
mixing_mode: Default::default(),
|
||||
metering_mode: Default::default(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue