pub struct Transport {
    pub playing: bool,
    pub recording: bool,
    pub preroll_active: Option<bool>,
    pub sample_rate: f32,
    pub tempo: Option<f64>,
    pub time_sig_numerator: Option<i32>,
    pub time_sig_denominator: Option<i32>,
    /* private fields */
}
Expand description

Information about the plugin’s transport. Depending on the plugin API and the host not all fields may be available.

Fields§

§playing: bool

Whether the transport is currently running.

§recording: bool

Whether recording is enabled in the project.

§preroll_active: Option<bool>

Whether the pre-roll is currently active, if the plugin API reports this information.

§sample_rate: f32

The sample rate in Hertz. Also passed in Plugin::initialize(), so if you need this then you can also store that value.

§tempo: Option<f64>

The project’s tempo in beats per minute.

§time_sig_numerator: Option<i32>

The time signature’s numerator.

§time_sig_denominator: Option<i32>

The time signature’s denominator.

Implementations§

source§

impl Transport

source

pub fn pos_samples(&self) -> Option<i64>

The position in the song in samples. Will be calculated from other information if needed.

source

pub fn pos_seconds(&self) -> Option<f64>

The position in the song in seconds. Can be used to calculate the time in samples if needed.

source

pub fn pos_beats(&self) -> Option<f64>

The position in the song in quarter notes. Will be calculated from other information if needed.

source

pub fn bar_start_pos_beats(&self) -> Option<f64>

The last bar’s start position in beats. Will be calculated from other information if needed.

source

pub fn bar_number(&self) -> Option<i32>

The number of the bar at bar_start_pos_beats. This starts at 0 for the very first bar at the start of the song. Will be calculated from other information if needed.

source

pub fn loop_range_samples(&self) -> Option<(i64, i64)>

The loop range in samples, if the loop is active and this information is available. None of the plugin API docs mention whether this is exclusive or inclusive, but just assume that the end is exclusive. Will be calculated from other information if needed.

source

pub fn loop_range_seconds(&self) -> Option<(f64, f64)>

The loop range in seconds, if the loop is active and this information is available. None of the plugin API docs mention whether this is exclusive or inclusive, but just assume that the end is exclusive. Will be calculated from other information if needed.

source

pub fn loop_range_beats(&self) -> Option<(f64, f64)>

The loop range in quarter notes, if the loop is active and this information is available. None of the plugin API docs mention whether this is exclusive or inclusive, but just assume that the end is exclusive. Will be calculated from other information if needed.

Trait Implementations§

source§

impl Debug for Transport

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 Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<S> FromSample<S> for S

§

fn from_sample_(s: S) -> S

source§

impl<T, U> Into<U> for Twhere 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.

§

impl<T> Pointable for T

§

const ALIGN: usize = mem::align_of::<T>()

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
§

impl<T, U> ToSample<U> for Twhere U: FromSample<T>,

§

fn to_sample_(self) -> U

source§

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

§

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 Twhere U: TryFrom<T>,

§

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.
§

impl<T> Any for Twhere T: Any,

§

impl<S, T> Duplex<S> for Twhere T: FromSample<S> + ToSample<S>,