pub trait Pitched {
// Required method
fn pitch(&self) -> Pitch;
// Provided method
fn find_in_tuning<K, T: Tuning<K>>(&self, tuning: T) -> Approximation<K> { ... }
}
Expand description
Objects which have a Pitch
assigned.
Required Methods§
Provided Methods§
sourcefn find_in_tuning<K, T: Tuning<K>>(&self, tuning: T) -> Approximation<K>
fn find_in_tuning<K, T: Tuning<K>>(&self, tuning: T) -> Approximation<K>
Finds a key or note for any Pitched
object in the given tuning
.
Examples
use tune::pitch::Pitched;
let a4 = NoteLetter::A.in_octave(4);
let tuning = ConcertPitch::from_a4_pitch(Pitch::from_hz(432.0));
let approximation = a4.find_in_tuning(tuning);
assert_eq!(approximation.approx_value, a4);
assert_approx_eq!(approximation.deviation.as_cents(), 31.766654);
Object Safety§
This trait is not object safe.