Open Broadcaster Software
Free, open source software for live streaming and recording
Main Page
Related Pages
Data Structures
Files
File List
Globals
audio-math.h
Go to the documentation of this file.
1
/******************************************************************************
2
Copyright (C) 2015 by Hugh Bailey <obs.jim@gmail.com>
3
4
This program is free software: you can redistribute it and/or modify
5
it under the terms of the GNU General Public License as published by
6
the Free Software Foundation, either version 2 of the License, or
7
(at your option) any later version.
8
9
This program is distributed in the hope that it will be useful,
10
but WITHOUT ANY WARRANTY; without even the implied warranty of
11
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
GNU General Public License for more details.
13
14
You should have received a copy of the GNU General Public License
15
along with this program. If not, see <http://www.gnu.org/licenses/>.
16
******************************************************************************/
17
18
#pragma once
19
20
#include "../util/c99defs.h"
21
#include <math.h>
22
23
#ifdef _MSC_VER
24
#include <float.h>
25
26
#pragma warning(push)
27
#pragma warning(disable : 4056)
28
#pragma warning(disable : 4756)
29
#endif
30
31
static
inline
float
mul_to_db(
const
float
mul)
32
{
33
return
(mul == 0.0f) ? -INFINITY : (20.0f * log10f(mul));
34
}
35
36
static
inline
float
db_to_mul(
const
float
db)
37
{
38
return
isfinite((
double
)db) ? powf(10.0f, db / 20.0f) : 0.0f;
39
}
40
41
#ifdef _MSC_VER
42
#pragma warning(pop)
43
#endif
libobs
media-io
audio-math.h
Generated on Sat Jul 8 2017 12:07:08 for Open Broadcaster Software by
1.8.11