mirror of
https://codeberg.org/unspeaker/tek.git
synced 2026-03-13 11:50:44 +01:00
closer and closer to testing it away
This commit is contained in:
parent
817d2a722c
commit
4aef21f60d
10 changed files with 1782 additions and 2028 deletions
|
|
@ -147,10 +147,13 @@ pub struct JackNotify<T: Fn(JackEvent) + Send>(pub T);
|
|||
pub modes: Modes,
|
||||
}
|
||||
|
||||
/// An input binding.
|
||||
/// An map of input events (e.g. [TuiEvent]) to [Binding]s.
|
||||
///
|
||||
/// ```
|
||||
/// let bind = tek::Bind::<(), ()>::default();
|
||||
/// let lang = "(@x (nop)) (@y (nop) (nop))";
|
||||
/// let bind = tek::Bind::<tek::tengri::TuiEvent, std::sync::Arc<str>>::load(&lang).unwrap();
|
||||
/// assert_eq!(bind.query(&'x'.into()).map(|x|x.len()), Some(1));
|
||||
/// //assert_eq!(bind.query(&'y'.into()).map(|x|x.len()), Some(2));
|
||||
/// ```
|
||||
#[derive(Debug)] pub struct Bind<E, C>(
|
||||
/// Map of each event (e.g. key combination) to
|
||||
|
|
@ -159,10 +162,12 @@ pub struct JackNotify<T: Fn(JackEvent) + Send>(pub T);
|
|||
pub BTreeMap<E, Vec<Binding<C>>>
|
||||
);
|
||||
|
||||
/// An input binding.
|
||||
/// A sequence of zero or more commands (e.g. [AppCommand]),
|
||||
/// optionally filtered by [Condition] to form layers.
|
||||
///
|
||||
/// ```
|
||||
/// let binding: tek::Binding<()> = Default::default();
|
||||
/// //FIXME: Why does it overflow?
|
||||
/// //let binding: Binding<()> = tek::Binding { ..Default::default() };
|
||||
/// ```
|
||||
#[derive(Debug, Clone)] pub struct Binding<C> {
|
||||
pub commands: Arc<[C]>,
|
||||
|
|
@ -302,7 +307,7 @@ pub struct JackNotify<T: Fn(JackEvent) + Send>(pub T);
|
|||
/// Temporal resolutions: sample rate, tempo, MIDI pulses per quaver (beat)
|
||||
///
|
||||
/// ```
|
||||
///
|
||||
/// let _ = tek::Timebase::default();
|
||||
/// ```
|
||||
#[derive(Debug, Clone)] pub struct Timebase {
|
||||
/// Audio samples per second
|
||||
|
|
@ -316,15 +321,28 @@ pub struct JackNotify<T: Fn(JackEvent) + Send>(pub T);
|
|||
/// Iterator that emits subsequent ticks within a range.
|
||||
///
|
||||
/// ```
|
||||
/// let iter = tek::TicksIterator::default();
|
||||
/// let iter = tek::Ticker::default();
|
||||
/// ```
|
||||
#[derive(Debug, Default)] pub struct TicksIterator {
|
||||
#[derive(Debug, Default)] pub struct Ticker {
|
||||
pub spp: f64,
|
||||
pub sample: usize,
|
||||
pub start: usize,
|
||||
pub end: usize,
|
||||
}
|
||||
|
||||
///
|
||||
/// ```
|
||||
/// let _ = tek::MidiCursor::default();
|
||||
/// ```
|
||||
#[derive(Debug, Clone)] pub struct MidiCursor {
|
||||
/// Time coordinate of cursor
|
||||
pub time_pos: Arc<AtomicUsize>,
|
||||
/// Note coordinate of cursor
|
||||
pub note_pos: Arc<AtomicUsize>,
|
||||
/// Length of note that will be inserted, in pulses
|
||||
pub note_len: Arc<AtomicUsize>,
|
||||
}
|
||||
|
||||
///
|
||||
/// ```
|
||||
/// use tek::{TimeRange, NoteRange};
|
||||
|
|
@ -341,19 +359,6 @@ pub struct JackNotify<T: Fn(JackEvent) + Send>(pub T);
|
|||
/// let _ = model.get_note_axis();
|
||||
/// let _ = model.get_note_hi();
|
||||
/// ```
|
||||
#[derive(Debug, Clone)] pub struct MidiCursor {
|
||||
/// Time coordinate of cursor
|
||||
pub time_pos: Arc<AtomicUsize>,
|
||||
/// Note coordinate of cursor
|
||||
pub note_pos: Arc<AtomicUsize>,
|
||||
/// Length of note that will be inserted, in pulses
|
||||
pub note_len: Arc<AtomicUsize>,
|
||||
}
|
||||
|
||||
///
|
||||
/// ```
|
||||
///
|
||||
/// ```
|
||||
#[derive(Debug, Clone, Default)] pub struct MidiSelection {
|
||||
pub time_len: Arc<AtomicUsize>,
|
||||
/// Length of visible time axis
|
||||
|
|
@ -373,7 +378,7 @@ pub struct JackNotify<T: Fn(JackEvent) + Send>(pub T);
|
|||
/// A point in time in all time scales (microsecond, sample, MIDI pulse)
|
||||
///
|
||||
/// ```
|
||||
///
|
||||
/// let _ = tek::Moment::default();
|
||||
/// ```
|
||||
#[derive(Debug, Default, Clone)] pub struct Moment {
|
||||
pub timebase: Arc<Timebase>,
|
||||
|
|
@ -387,7 +392,7 @@ pub struct JackNotify<T: Fn(JackEvent) + Send>(pub T);
|
|||
|
||||
///
|
||||
/// ```
|
||||
///
|
||||
/// let _ = tek::Moment2::default();
|
||||
/// ```
|
||||
#[derive(Debug, Clone, Default)] pub enum Moment2 {
|
||||
#[default] None,
|
||||
|
|
@ -834,28 +839,18 @@ pub struct PoolView<'a>(pub &'a Pool);
|
|||
pub name: Arc<str>,
|
||||
/// Device color.
|
||||
pub color: ItemTheme,
|
||||
/// Audio input ports. Samples get recorded here.
|
||||
#[cfg(feature = "port")] pub audio_ins: Vec<AudioInput>,
|
||||
/// Audio input meters.
|
||||
#[cfg(feature = "meter")] pub input_meters: Vec<f32>,
|
||||
/// Sample currently being recorded.
|
||||
pub recording: Option<(usize, Option<Arc<RwLock<Sample>>>)>,
|
||||
pub recording: Option<(usize, Option<Arc<RwLock<Sample>>>)>,
|
||||
/// Recording buffer.
|
||||
pub buffer: Vec<Vec<f32>>,
|
||||
pub buffer: Vec<Vec<f32>>,
|
||||
/// Samples mapped to MIDI notes.
|
||||
pub samples: SampleKit<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.
|
||||
#[cfg(feature = "port")] pub midi_in: Option<MidiInput>,
|
||||
pub samples: SampleKit<128>,
|
||||
/// Collection of currently playing instances of samples.
|
||||
pub voices: Arc<RwLock<Vec<Voice>>>,
|
||||
/// Audio output ports. Voices get played here.
|
||||
#[cfg(feature = "port")] pub audio_outs: Vec<AudioOutput>,
|
||||
/// Audio output meters.
|
||||
#[cfg(feature = "meter")] pub output_meters: Vec<f32>,
|
||||
/// Samples that are not mapped to MIDI notes.
|
||||
pub unmapped: Vec<Arc<RwLock<Sample>>>,
|
||||
/// Sample currently being edited.
|
||||
pub editing: Option<Arc<RwLock<Sample>>>,
|
||||
/// How to mix the voices.
|
||||
pub mixing_mode: MixingMode,
|
||||
/// How to meter the inputs and outputs.
|
||||
|
|
@ -872,6 +867,16 @@ pub struct PoolView<'a>(pub &'a Pool);
|
|||
pub note_pt: AtomicUsize,
|
||||
/// Selected note as row/col.
|
||||
pub cursor: (AtomicUsize, AtomicUsize),
|
||||
/// Audio input meters.
|
||||
#[cfg(feature = "meter")] pub input_meters: Vec<f32>,
|
||||
/// Audio input ports. Samples are recorded from here.
|
||||
#[cfg(feature = "port")] pub audio_ins: Vec<AudioInput>,
|
||||
/// MIDI input port. Sampler are triggered from here.
|
||||
#[cfg(feature = "port")] pub midi_in: Option<MidiInput>,
|
||||
/// Audio output ports. Voices are played into here.
|
||||
#[cfg(feature = "port")] pub audio_outs: Vec<AudioOutput>,
|
||||
/// Audio output meters.
|
||||
#[cfg(feature = "meter")] pub output_meters: Vec<f32>,
|
||||
}
|
||||
|
||||
/// Collection of samples, one per slot, fixed number of slots.
|
||||
|
|
@ -909,7 +914,7 @@ pub struct PoolView<'a>(pub &'a Pool);
|
|||
pub velocity: f32,
|
||||
}
|
||||
|
||||
pub struct AddSampleModal {
|
||||
#[derive(Default, Debug)] pub struct SampleAdd {
|
||||
pub exited: bool,
|
||||
pub dir: PathBuf,
|
||||
pub subdirs: Vec<OsString>,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue