pub struct SampleZone {
pub id: String,
pub file_path: String,
pub root_note: u8,
pub note_low: u8,
pub note_high: u8,
pub velocity_low: u8,
pub velocity_high: u8,
pub articulation: ArticulationType,
pub volume_db: f32,
pub tune_cents: f32,
pub release_file: Option<String>,
}Expand description
A single sample zone — maps a note/velocity range to an audio file.
Fields§
§id: StringUnique identifier.
file_path: StringPath to the audio file.
root_note: u8The MIDI note this sample was recorded at (root pitch).
note_low: u8Lowest MIDI note this zone responds to.
note_high: u8Highest MIDI note this zone responds to.
velocity_low: u8Minimum velocity (0–127) this zone responds to.
velocity_high: u8Maximum velocity (0–127) this zone responds to.
articulation: ArticulationTypePlayback behavior.
volume_db: f32Volume trim in dB (0.0 = no change).
tune_cents: f32Tune offset in cents (0.0 = no change).
release_file: Option<String>Optional separate release sample file.
Implementations§
Source§impl SampleZone
impl SampleZone
Sourcepub fn matches(&self, note: u8, velocity: u8) -> bool
pub fn matches(&self, note: u8, velocity: u8) -> bool
Does this zone respond to the given note and velocity?
Sourcepub fn pitch_ratio(&self, target_note: u8, tuning: &TuningTable) -> f32
pub fn pitch_ratio(&self, target_note: u8, tuning: &TuningTable) -> f32
Pitch ratio to shift from root_note to target_note.
Sourcepub fn volume_linear(&self) -> f32
pub fn volume_linear(&self) -> f32
Linear volume multiplier from volume_db.
Trait Implementations§
Source§impl Clone for SampleZone
impl Clone for SampleZone
Source§fn clone(&self) -> SampleZone
fn clone(&self) -> SampleZone
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 SampleZone
impl Debug for SampleZone
Source§impl<'de> Deserialize<'de> for SampleZone
impl<'de> Deserialize<'de> for SampleZone
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for SampleZone
impl RefUnwindSafe for SampleZone
impl Send for SampleZone
impl Sync for SampleZone
impl Unpin for SampleZone
impl UnsafeUnpin for SampleZone
impl UnwindSafe for SampleZone
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more