Struct tune::tuning::ConcertPitch
source · pub struct ConcertPitch { /* private fields */ }
Expand description
A ConcertPitch
enables Note
s to sound at a Pitch
different to what would be expected in 440 Hz standard tuning.
To access the full potential of ConcertPitch
es have a look at the Tuning
and PitchedNote
traits.
Implementations§
source§impl ConcertPitch
impl ConcertPitch
sourcepub fn from_a4_pitch(a4_pitch: impl Pitched) -> Self
pub fn from_a4_pitch(a4_pitch: impl Pitched) -> Self
Creates a ConcertPitch
with the given a4_pitch
.
sourcepub fn from_note_and_pitch(note: Note, pitched: impl Pitched) -> Self
pub fn from_note_and_pitch(note: Note, pitched: impl Pitched) -> Self
Creates a ConcertPitch
from the given note
and pitched
value.
Examples
let c4 = NoteLetter::C.in_octave(4);
let fixed_c4_tuning = ConcertPitch::from_note_and_pitch(c4, Pitch::from_hz(260.0));
assert_approx_eq!(fixed_c4_tuning.a4_pitch().as_hz(), 437.266136);
Trait Implementations§
source§impl Clone for ConcertPitch
impl Clone for ConcertPitch
source§fn clone(&self) -> ConcertPitch
fn clone(&self) -> ConcertPitch
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 ConcertPitch
impl Debug for ConcertPitch
source§impl Default for ConcertPitch
impl Default for ConcertPitch
The default ConcertPitch
is A4 sounding at 440 Hz.
Examples
assert_approx_eq!(ConcertPitch::default().a4_pitch().as_hz(), 440.0);
source§impl PartialEq for ConcertPitch
impl PartialEq for ConcertPitch
source§fn eq(&self, other: &ConcertPitch) -> bool
fn eq(&self, other: &ConcertPitch) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl PartialOrd for ConcertPitch
impl PartialOrd for ConcertPitch
source§fn partial_cmp(&self, other: &ConcertPitch) -> Option<Ordering>
fn partial_cmp(&self, other: &ConcertPitch) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moresource§impl Tuning<Note> for ConcertPitch
impl Tuning<Note> for ConcertPitch
A ConcertPitch
maps Note
s to Pitch
es and is considered a Tuning
.
Examples
use tune::tuning::Tuning;
let c4 = NoteLetter::C.in_octave(4);
let a4 = NoteLetter::A.in_octave(4);
let standard_tuning = ConcertPitch::default();
assert_approx_eq!(standard_tuning.pitch_of(c4).as_hz(), 261.625565);
assert_approx_eq!(standard_tuning.pitch_of(a4).as_hz(), 440.0);
let healing_tuning = ConcertPitch::from_a4_pitch(Pitch::from_hz(432.0));
assert_approx_eq!(healing_tuning.pitch_of(c4).as_hz(), 256.868737);
assert_approx_eq!(healing_tuning.pitch_of(a4).as_hz(), 432.0);
source§fn find_by_pitch(&self, pitch: Pitch) -> Approximation<Note>
fn find_by_pitch(&self, pitch: Pitch) -> Approximation<Note>
source§fn as_linear_mapping(self) -> LinearMapping<Self>where
Self: Sized,
fn as_linear_mapping(self) -> LinearMapping<Self>where
Self: Sized,
Wraps
self
in a type adapter s.t. it can be used in functions that are generic over KeyboardMapping<K>
.impl Copy for ConcertPitch
impl StructuralPartialEq for ConcertPitch
Auto Trait Implementations§
impl RefUnwindSafe for ConcertPitch
impl Send for ConcertPitch
impl Sync for ConcertPitch
impl Unpin for ConcertPitch
impl UnwindSafe for ConcertPitch
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