more doc strings; limit jack reexport

This commit is contained in:
🪞👃🪞 2024-07-12 21:39:20 +03:00
parent f5ebc16067
commit c85fa3cd06
7 changed files with 21 additions and 9 deletions

View file

@ -71,6 +71,7 @@ pub use crate::{submod, pubmod, render, handle, process, phrase, keymap, ports};
// Reexport JACK proto-lib: // Reexport JACK proto-lib:
pub use crate::jack::*; pub use crate::jack::*;
/// Run the main loop.
pub fn run <T> (state: Arc<RwLock<T>>) -> Usually<Arc<RwLock<T>>> pub fn run <T> (state: Arc<RwLock<T>>) -> Usually<Arc<RwLock<T>>>
where T: Render + Handle + Send + Sync + Sized + 'static where T: Render + Handle + Send + Sync + Sized + 'static
{ {

View file

@ -4,7 +4,7 @@ use crate::core::*;
submod!( device event factory ports ); submod!( device event factory ports );
pub use ::_jack::{ pub(crate) use ::_jack::{
AsyncClient, AsyncClient,
AudioIn, AudioIn,
AudioOut, AudioOut,
@ -23,15 +23,14 @@ pub use ::_jack::{
PortFlags, PortFlags,
PortId, PortId,
PortSpec, PortSpec,
ProcessHandler,
ProcessScope, ProcessScope,
RawMidi, RawMidi,
Transport, Transport,
TransportState, TransportState,
TransportStatePosition,
Unowned Unowned
}; };
/// Wraps [Client] or [DynamicAsyncClient] in place.
pub enum JackClient { pub enum JackClient {
Inactive(Client), Inactive(Client),
Active(DynamicAsyncClient), Active(DynamicAsyncClient),

View file

@ -1,6 +1,8 @@
//! Wrap JACK-enabled [Device]s.
use super::*; use super::*;
/// A Device bound to a JACK client and a set of ports. /// A [Device] bound to a JACK client and a set of ports.
pub struct JackDevice { pub struct JackDevice {
/// The active JACK client of this device. /// The active JACK client of this device.
pub client: DynamicAsyncClient, pub client: DynamicAsyncClient,

View file

@ -1,9 +1,14 @@
//! JACK event handling.
use super::*; use super::*;
/// Notification handler used by the [Jack] factory
/// when constructing [JackDevice]s.
pub type DynamicNotifications = pub type DynamicNotifications =
Notifications<Box<dyn Fn(AppEvent) + Send + Sync>>; Notifications<Box<dyn Fn(AppEvent) + Send + Sync>>;
#[derive(Debug)] #[derive(Debug)]
/// Event enum for JACK events in [AppEvent].
pub enum JackEvent { pub enum JackEvent {
ThreadInit, ThreadInit,
Shutdown(ClientStatus, String), Shutdown(ClientStatus, String),
@ -17,6 +22,7 @@ pub enum JackEvent {
XRun, XRun,
} }
/// Generic notification handler that emits [AppEvent]::Jack([JackEvent])s.
pub struct Notifications<T: Fn(AppEvent) + Send>(pub T); pub struct Notifications<T: Fn(AppEvent) + Send>(pub T);
impl<T: Fn(AppEvent) + Send> NotificationHandler for Notifications<T> { impl<T: Fn(AppEvent) + Send> NotificationHandler for Notifications<T> {

View file

@ -1,3 +1,4 @@
//! Encapsulate and run [Device]s as [JackDevice]s.
use super::*; use super::*;
/// `JackDevice` factory. Creates JACK `Client`s, performs port registration /// `JackDevice` factory. Creates JACK `Client`s, performs port registration

View file

@ -1,6 +1,8 @@
//! Handling JACK ports.
use super::*; use super::*;
#[derive(Default)] #[derive(Default)]
/// Collection of JACK ports as [AudioIn]/[AudioOut]/[MidiIn]/[MidiOut].
pub struct JackPorts { pub struct JackPorts {
pub audio_ins: BTreeMap<String, Port<AudioIn>>, pub audio_ins: BTreeMap<String, Port<AudioIn>>,
pub midi_ins: BTreeMap<String, Port<MidiIn>>, pub midi_ins: BTreeMap<String, Port<MidiIn>>,
@ -9,11 +11,12 @@ pub struct JackPorts {
} }
#[derive(Default)] #[derive(Default)]
/// Collection of JACK ports as [Unowned].
pub struct UnownedJackPorts { pub struct UnownedJackPorts {
pub audio_ins: BTreeMap<String, Port<::jack::Unowned>>, pub audio_ins: BTreeMap<String, Port<Unowned>>,
pub midi_ins: BTreeMap<String, Port<::jack::Unowned>>, pub midi_ins: BTreeMap<String, Port<Unowned>>,
pub audio_outs: BTreeMap<String, Port<::jack::Unowned>>, pub audio_outs: BTreeMap<String, Port<Unowned>>,
pub midi_outs: BTreeMap<String, Port<::jack::Unowned>>, pub midi_outs: BTreeMap<String, Port<Unowned>>,
} }
impl JackPorts { impl JackPorts {

View file

@ -21,7 +21,7 @@ impl TransportFocus {
} }
} }
/// Stored and displays time-related state. /// Stores and displays time-related state.
pub struct TransportToolbar { pub struct TransportToolbar {
/// Enable metronome? /// Enable metronome?
pub metronome: bool, pub metronome: bool,