Skip to content
Snippets Groups Projects
Commit cbc0c6f7 authored by Alexandre Savard's avatar Alexandre Savard
Browse files

#8672: Add linear to decibel conversion functions in audio layer

parent ca08bac9
No related branches found
No related tags found
No related merge requests found
...@@ -110,6 +110,20 @@ class AudioLayer { ...@@ -110,6 +110,20 @@ class AudioLayer {
*/ */
static void applyGain(SFLDataFormat *src , int samples, int gain); static void applyGain(SFLDataFormat *src , int samples, int gain);
/**
* Convert audio amplitude value from linear value to dB
*/
static double amplitudeLinearToDB(double value) {
return 20.0 * log10(value);
}
/**
* Convert audio amplitude from dB to Linear value
*/
static double ampluitudeDBToLinear(double value) {
return pow(10.0, value / 20.0);
}
/** /**
* Set capture stream gain (microphone) * Set capture stream gain (microphone)
*/ */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment