Struct jack::TransportBBT

source ·
pub struct TransportBBT {
    pub bar: usize,
    pub beat: usize,
    pub tick: usize,
    pub sig_num: f32,
    pub sig_denom: f32,
    pub ticks_per_beat: f64,
    pub bpm: f64,
    pub bar_start_tick: f64,
}
Expand description

Transport Bar Beat Tick data.

Fields§

§bar: usize

Time signature bar, 1 or more.

§beat: usize

Time signature beat, 1 <= beat <= sig_num.

§tick: usize

current tick-within-beat

Remarks

  • Should be >= 0 and < ticks_per_beat: the first tick is tick 0.
§sig_num: f32

Time Signature “numerator”. Jack calls this beats_per_bar.

§sig_denom: f32

Time Signature “denominator”. Jack calls this beat_type.

§ticks_per_beat: f64

Number of ticks within a beat.

Remarks

  • Usually a moderately large integer with many denominators, such as 1920.0
§bpm: f64

BPM, quantized to block size. This means when the tempo is not constant within this block, the BPM value should adapted to compensate for this. This is different from most fields in this struct, which specify the value at the beginning of the block rather than an average.

§bar_start_tick: f64

Number of ticks that have elapsed between frame 0 and the first beat of the current measure.

Implementations§

source§

impl TransportBBT

source

pub fn with_bbt(&mut self, bar: usize, beat: usize, tick: usize) -> &mut Self

Set bar, beat, tick

Example
use jack::TransportBBT;
let bbt = TransportBBT::default().with_bbt(4, 2, 14).validated();
assert!(bbt.is_ok());
let bbt = bbt.unwrap();
assert_eq!(bbt.bar, 4);
assert_eq!(bbt.beat, 2);
assert_eq!(bbt.tick, 14);
source

pub fn with_bpm(&mut self, bpm: f64) -> &mut Self

Set Beats Per Minute.

source

pub fn with_timesig(&mut self, num: f32, denom: f32) -> &mut Self

Set the time signature.

source

pub fn with_ticks_per_beat(&mut self, ticks_per_beat: f64) -> &mut Self

Set ticks per beat.

source

pub fn with_bar_start_tick(&mut self, tick: f64) -> &mut Self

Set bar start tick.

source

pub fn validated(&self) -> Result<Self, TransportBBTValidationError>

Validate contents.

source

pub fn valid(&self) -> bool

Trait Implementations§

source§

impl Clone for TransportBBT

source§

fn clone(&self) -> TransportBBT

Returns a copy 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 TransportBBT

source§

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

Formats the value using the given formatter. Read more
source§

impl Default for TransportBBT

source§

fn default() -> Self

Returns the “default value” for a type. Read more
source§

impl PartialEq<TransportBBT> for TransportBBT

source§

fn eq(&self, other: &TransportBBT) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Copy for TransportBBT

source§

impl StructuralPartialEq for TransportBBT

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,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

const: unstable · source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

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

const: unstable · 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 Twhere
T: Clone,

§

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

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · 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.
const: unstable · source§

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

Performs the conversion.