pub struct PitchBend { /* private fields */ }Expand description
The value of a pitch bend, represented as 14 bits.
A value of 0x0000 indicates full bend downwards.
A value of 0x2000 indicates no bend.
A value of 0x3FFF indicates full bend upwards.
This value is available via PitchBend::value
Implementations§
Source§impl PitchBend
impl PitchBend
Sourcepub fn new(lsb: u8, msb: u8) -> Result<Self, Error>
pub fn new(lsb: u8, msb: u8) -> Result<Self, Error>
Creates a new pitch bend given the least significant and most significant bytes.
Checks for byte correctness (leading 0 bit)
Sourcepub const fn new_unchecked(lsb: u8, msb: u8) -> Self
pub const fn new_unchecked(lsb: u8, msb: u8) -> Self
Creates a new pitch bend given the least significant and most significant bytes.
Does not check for correctness
Source§impl PitchBend
impl PitchBend
Sourcepub const MAX_VALUE: u16 = 16_383u16
pub const MAX_VALUE: u16 = 16_383u16
The maximum value of 0x3FFF, indicating full bend upwards.
Sourcepub fn from_int(int: i16) -> Self
pub fn from_int(int: i16) -> Self
Create a PitchBend value from an int in the range [-0x2000, 0x1FFF].
Integers outside this range will be clamped.
Sourcepub fn from_f32(float: f32) -> Self
pub fn from_f32(float: f32) -> Self
Create a PitchBend value from a number in the range [-1.0, 1.0).
Floats outside this range will be clamped.
Sourcepub fn from_f64(float: f64) -> Self
pub fn from_f64(float: f64) -> Self
Create a PitchBend value from a number in the range [-1.0, 1.0).
Floats outside this range will be clamped.