Skip to main content

AmpScaleSpec

Trait AmpScaleSpec 

Source
pub trait AmpScaleSpec:
    Sized
    + Send
    + Sync {
    // Required methods
    fn apply_from_power<T: Sample>(power: T) -> T;
    fn apply_db_in_place<T: Sample>(
        x: &mut [T],
        floor_db: f64,
    ) -> SpectrogramResult<()>;
}
Expand description

Marker trait so we can specialise behaviour by AmpScale.

Required Methods§

Source

fn apply_from_power<T: Sample>(power: T) -> T

Apply conversion from power-domain value to the desired amplitude scale.

§Arguments
  • power: input power-domain value.
§Returns

Converted amplitude value.

Source

fn apply_db_in_place<T: Sample>( x: &mut [T], floor_db: f64, ) -> SpectrogramResult<()>

Apply dB conversion in-place on a power-domain vector.

This is a no-op for Power and Magnitude scales.

§Arguments
  • x: power-domain values to convert to dB in-place.
  • floor_db: dB floor value to apply.
§Returns

SpectrogramResult<()>: Ok on success, error on invalid input.

§Errors
  • If floor_db is not finite.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§