Debian Codegraph @

plugins/LadspaEffect/swh/util/db.c

raw
1 #include <stdio.h>
2 #include <math.h>
3
4 #include "db.h"
5
6 float db_data[DB_TABLE_SIZE];
7 float lin_data[LIN_TABLE_SIZE];
8
9 void db_init()
10 {
11 unsigned int i;
12
13 for (i=0; i<LIN_TABLE_SIZE; i++) {
14 lin_data[i] = powf(10.0f, ((DB_MAX - DB_MIN) *
15 (float)i/(float)LIN_TABLE_SIZE + DB_MIN) / 20.0f);
16 }
17
18 for (i=0; i<DB_TABLE_SIZE; i++) {
19 db_data[i] = 20.0f * log10f((LIN_MAX - LIN_MIN) *
20 (float)i/(float)DB_TABLE_SIZE + LIN_MIN);
21 }
22 }