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:
pub use crate::jack::*;
/// Run the main loop.
pub fn run <T> (state: Arc<RwLock<T>>) -> Usually<Arc<RwLock<T>>>
where T: Render + Handle + Send + Sync + Sized + 'static
{

View file

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

View file

@ -1,6 +1,8 @@
//! Wrap JACK-enabled [Device]s.
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 {
/// The active JACK client of this device.
pub client: DynamicAsyncClient,

View file

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

View file

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