File: db.c

package info (click to toggle)
swh-plugins 0.4.17-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 3,264 kB
  • sloc: ansic: 23,551; xml: 12,633; perl: 1,114; sh: 964; makefile: 218
file content (22 lines) | stat: -rw-r--r-- 436 bytes parent folder | download | duplicates (17)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include <stdio.h>
#include <math.h>

#include "db.h"

float db_data[DB_TABLE_SIZE];
float lin_data[LIN_TABLE_SIZE];

void db_init()
{
	unsigned int i;

	for (i=0; i<LIN_TABLE_SIZE; i++) {
		lin_data[i] = powf(10.0f, ((DB_MAX - DB_MIN) *
		   	(float)i/(float)LIN_TABLE_SIZE + DB_MIN) / 20.0f);
	}

	for (i=0; i<DB_TABLE_SIZE; i++) {
		db_data[i] = 20.0f * log10f((LIN_MAX - LIN_MIN) *
			(float)i/(float)DB_TABLE_SIZE + LIN_MIN);
	}
}