File: db.h

package info (click to toggle)
silentjack 0.2-1
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 456 kB
  • ctags: 24
  • sloc: sh: 3,451; ansic: 205; makefile: 7
file content (38 lines) | stat: -rw-r--r-- 919 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
/*
 *  db.h
 *
 *  Copyright (C) 2003,2006 Steve Harris, Nicholas Humfrey
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  Originally Stolen from JAMIN <http://jamin.sf.net/>
 */

#ifndef DB_H
#define DB_H

static inline float
db2lin( float db )
{
	if (db <= -90.0f) return 0.0f;
	else {
		return powf(10.0f, db * 0.05f);
	}
}

static inline float
lin2db( float lin )
{
	if (lin == 0.0f) return -90.0f;
	else return (20.0f * log10f(lin));
}

#endif