JUCE  v5.4.1-191-g0ab5e696f
JUCE API
Looking for a senior C++ dev?
I'm looking for work. Hire me!
juce::Decibels Class Reference

This class contains some helpful static methods for dealing with decibel values. More...

#include <juce_Decibels.h>

Static Public Member Functions

template<typename Type >
static Type decibelsToGain (Type decibels, Type minusInfinityDb=Type(defaultMinusInfinitydB))
 Converts a dBFS value to its equivalent gain level. More...
 
template<typename Type >
static Type gainToDecibels (Type gain, Type minusInfinityDb=Type(defaultMinusInfinitydB))
 Converts a gain level into a dBFS value. More...
 
template<typename Type >
static String toString (Type decibels, int decimalPlaces=2, Type minusInfinityDb=Type(defaultMinusInfinitydB), bool shouldIncludeSuffix=true, StringRef customMinusInfinityString={})
 Converts a decibel reading to a string. More...
 

Private Types

enum  { defaultMinusInfinitydB = -100 }
 

Private Member Functions

 Decibels ()=delete
 

Detailed Description

This class contains some helpful static methods for dealing with decibel values.

{Audio}

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
private
Enumerator
defaultMinusInfinitydB 

Constructor & Destructor Documentation

◆ Decibels()

juce::Decibels::Decibels ( )
privatedelete

Member Function Documentation

◆ decibelsToGain()

template<typename Type >
static Type juce::Decibels::decibelsToGain ( Type  decibels,
Type  minusInfinityDb = Type (defaultMinusInfinitydB) 
)
inlinestatic

Converts a dBFS value to its equivalent gain level.

A gain of 1.0 = 0 dB, and lower gains map onto negative decibel values. Any decibel value lower than minusInfinityDb will return a gain of 0.

◆ gainToDecibels()

template<typename Type >
static Type juce::Decibels::gainToDecibels ( Type  gain,
Type  minusInfinityDb = Type (defaultMinusInfinitydB) 
)
inlinestatic

Converts a gain level into a dBFS value.

A gain of 1.0 = 0 dB, and lower gains map onto negative decibel values. If the gain is 0 (or negative), then the method will return the value provided as minusInfinityDb.

References juce::jmax().

◆ toString()

template<typename Type >
static String juce::Decibels::toString ( Type  decibels,
int  decimalPlaces = 2,
Type  minusInfinityDb = Type (defaultMinusInfinitydB),
bool  shouldIncludeSuffix = true,
StringRef  customMinusInfinityString = {} 
)
inlinestatic

Converts a decibel reading to a string.

By default the returned string will have the 'dB' suffix added, but this can be removed by setting the shouldIncludeSuffix argument to false. If a customMinusInfinityString argument is provided this will be returned if the value is lower than minusInfinityDb, otherwise the return value will be "-INF".

References juce::String::preallocateBytes(), and juce::roundToInt().


The documentation for this class was generated from the following file: