Struct decibel::DecibelRatio
[−]
[src]
pub struct DecibelRatio<T: Float>(pub T);
A decibel value.
Methods
impl<T: Float> DecibelRatio<T>
[src]
fn decibel_value(&self) -> T
Returns the wrapped decibel value.
Trait Implementations
impl<T: Copy + Float> Copy for DecibelRatio<T>
[src]
impl<T: Clone + Float> Clone for DecibelRatio<T>
[src]
fn clone(&self) -> DecibelRatio<T>
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more
impl<T: Debug + Float> Debug for DecibelRatio<T>
[src]
impl<T: PartialEq + Float> PartialEq for DecibelRatio<T>
[src]
fn eq(&self, __arg_0: &DecibelRatio<T>) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &DecibelRatio<T>) -> bool
This method tests for !=
.
impl<T: Float + Constants> From<AmplitudeRatio<T>> for DecibelRatio<T>
[src]
Converts from an amplitude into a decibel value.
When used for normalized amplitudes in the range of 0 to 1, this will give the value in dBFS (decibels relative to full scale).
Example
extern crate decibel; use decibel::{AmplitudeRatio, DecibelRatio}; fn main() { // An amplitude halfway between 1 and zero should be close to -6 dBFS. let result: DecibelRatio<_> = AmplitudeRatio(0.5).into(); let expected_decibels = -6.02059991327962; assert!(result.decibel_value() >= expected_decibels - 0.001 && result.decibel_value() <= expected_decibels + 0.001); }
fn from(amplitude: AmplitudeRatio<T>) -> DecibelRatio<T>
Performs the conversion.