Skip to main content

Transport

Struct Transport 

Source
pub struct Transport {
Show 15 fields 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>, pub pos_samples: Option<i64>, pub pos_seconds: Option<f64>, pub pos_beats: Option<f64>, pub bar_start_pos_beats: Option<f64>, pub bar_number: Option<i32>, pub loop_range_samples: Option<(i64, i64)>, pub loop_range_seconds: Option<(f64, f64)>, pub loop_range_beats: Option<(f64, f64)>,
}
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.

§pos_samples: Option<i64>

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

§pos_seconds: Option<f64>

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

§pos_beats: Option<f64>

The position in the song in quarter notes. Can be calculated from the time in seconds and the tempo if needed.

§bar_start_pos_beats: Option<f64>

The last bar’s start position in beats. Can be calculated from the beat position and time signature if needed.

§bar_number: 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. Can be calculated from the beat position and time signature if needed.

§loop_range_samples: 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. Can be calculated from the other loop range information if needed.

§loop_range_seconds: 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. Can be calculated from the other loop range information if needed.

§loop_range_beats: 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. Can be calculated from the other loop range information if needed.

Implementations§

Source§

impl Transport

Source

pub fn new(sample_rate: f32) -> Self

Initialize the transport struct without any information.

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