Skip to main content

ClockMode

Enum ClockMode 

Source
#[non_exhaustive]
pub enum ClockMode { Master { tempo_bpm: f64, send_transport: bool, }, Slave { clock_input_port: String, timeout_ns: u64, }, Passthrough { clock_input_port: String, timeout_ns: u64, multiply: u8, divide: u8, }, }
Expand description

Selects how the RT thread generates or tracks MIDI clock.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

Master

This system is the clock master: it generates clock ticks at the specified tempo and optionally sends MIDI transport messages.

Fields

§tempo_bpm: f64

Initial tempo in beats per minute.

§send_transport: bool

Whether to send MIDI Start/Stop/Continue messages on the output ports.

§

Slave

This system tracks an external MIDI clock source on the given input port, using a PLL to smooth jitter.

Fields

§clock_input_port: String

Name (or substring) of the MIDI input port carrying the external clock.

§timeout_ns: u64

Timeout in nanoseconds: if no clock tick is received within this window, the slave reports RtErrorCode::ClockDropout.

§

Passthrough

This system receives an external MIDI clock and re-emits it on all output ports, optionally multiplied or divided.

Unlike Slave, passthrough mode does not apply PLL smoothing or oscillator interpolation. It forwards clock ticks directly, making it suitable for deterministic clock distribution chains where jitter smoothing is undesirable.

Fields

§clock_input_port: String

Name (or substring) of the MIDI input port carrying the external clock.

§timeout_ns: u64

Timeout in nanoseconds: if no clock tick is received within this window, a RtErrorCode::ClockDropout event is emitted.

§multiply: u8

Clock multiplication factor (1 = forward unchanged). For each input tick, multiply / divide output ticks are emitted.

§divide: u8

Clock division factor (1 = forward unchanged). For each input tick, multiply / divide output ticks are emitted.

Trait Implementations§

Source§

impl Clone for ClockMode

Source§

fn clone(&self) -> ClockMode

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ClockMode

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.