Struct decibel::DecibelRatio [] [src]

pub struct DecibelRatio<T: Float>(pub T);

A decibel value.

Methods

impl<T: Float> DecibelRatio<T>
[src]

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]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl<T: Debug + Float> Debug for DecibelRatio<T>
[src]

Formats the value using the given formatter.

impl<T: PartialEq + Float> PartialEq for DecibelRatio<T>
[src]

This method tests for self and other values to be equal, and is used by ==. Read more

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);
}

Performs the conversion.