#[repr(transparent)]pub struct CenterSliderInput {
pub position: f32,
}Expand description
A continuous fader or knob with a symmetric center position.
Fields§
§position: f32Position in the interval [-1, 1]
Implementations§
Source§impl CenterSliderInput
impl CenterSliderInput
pub const MIN_POSITION: f32 = -1f32
pub const MAX_POSITION: f32 = 1f32
pub const POSITION_RANGE: RangeInclusive<f32>
pub const CENTER_POSITION: f32 = 0f32
pub const fn clamp_position(position: f32) -> f32
pub fn from_u7(input: u8) -> Self
pub fn from_u14(input: u16) -> Self
pub fn inverse(self) -> Self
pub fn map_position_linear<T>( self, min_value: T, center_value: T, max_value: T, ) -> T
Sourcepub fn map_position_to_gain_ratio(self, min_db: f32, max_db: f32) -> f32
pub fn map_position_to_gain_ratio(self, min_db: f32, max_db: f32) -> f32
Interpret the position as a ratio for tuning the volume of a signal.
The position is interpreted as a volume level between the min_db
(< 0 dB) and max_db (> 0 dB), e.g. -26 dB and +6 dB (Pioneer DJM).
Multiply the signal with the returned value to tune the volume.
Trait Implementations§
Source§impl Clone for CenterSliderInput
impl Clone for CenterSliderInput
Source§fn clone(&self) -> CenterSliderInput
fn clone(&self) -> CenterSliderInput
Returns a duplicate 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 CenterSliderInput
impl Debug for CenterSliderInput
Source§impl From<CenterSliderInput> for ControlValue
impl From<CenterSliderInput> for ControlValue
Source§fn from(from: CenterSliderInput) -> Self
fn from(from: CenterSliderInput) -> Self
Converts to this type from the input type.
Source§impl From<ControlValue> for CenterSliderInput
impl From<ControlValue> for CenterSliderInput
Source§fn from(from: ControlValue) -> Self
fn from(from: ControlValue) -> Self
Converts to this type from the input type.
Source§impl PartialEq for CenterSliderInput
impl PartialEq for CenterSliderInput
impl Copy for CenterSliderInput
impl StructuralPartialEq for CenterSliderInput
Auto Trait Implementations§
impl Freeze for CenterSliderInput
impl RefUnwindSafe for CenterSliderInput
impl Send for CenterSliderInput
impl Sync for CenterSliderInput
impl Unpin for CenterSliderInput
impl UnwindSafe for CenterSliderInput
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more