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
§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
impl TransportBBT
sourcepub fn with_bbt(&mut self, bar: usize, beat: usize, tick: usize) -> &mut Self
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);
sourcepub fn with_timesig(&mut self, num: f32, denom: f32) -> &mut Self
pub fn with_timesig(&mut self, num: f32, denom: f32) -> &mut Self
Set the time signature.
sourcepub fn with_ticks_per_beat(&mut self, ticks_per_beat: f64) -> &mut Self
pub fn with_ticks_per_beat(&mut self, ticks_per_beat: f64) -> &mut Self
Set ticks per beat.
sourcepub fn with_bar_start_tick(&mut self, tick: f64) -> &mut Self
pub fn with_bar_start_tick(&mut self, tick: f64) -> &mut Self
Set bar start tick.
sourcepub fn validated(&self) -> Result<Self, TransportBBTValidationError>
pub fn validated(&self) -> Result<Self, TransportBBTValidationError>
Validate contents.
pub fn valid(&self) -> bool
Trait Implementations§
source§impl Clone for TransportBBT
impl Clone for TransportBBT
source§fn clone(&self) -> TransportBBT
fn clone(&self) -> TransportBBT
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for TransportBBT
impl Debug for TransportBBT
source§impl Default for TransportBBT
impl Default for TransportBBT
source§impl PartialEq<TransportBBT> for TransportBBT
impl PartialEq<TransportBBT> for TransportBBT
source§fn eq(&self, other: &TransportBBT) -> bool
fn eq(&self, other: &TransportBBT) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.