aboutsummaryrefslogtreecommitdiffstats
path: root/src/common/emphasis.c
diff options
context:
space:
mode:
authorAndreas Eversberg <jolly@eversberg.eu>2017-01-29 07:25:12 +0100
committerAndreas Eversberg <jolly@eversberg.eu>2017-02-18 21:01:13 +0100
commit7e45f556cec493c3c77fcb6400d8ae211faf2220 (patch)
treecb5903509228c36e7dcd52ae0a049b380e81f401 /src/common/emphasis.c
parentbd7ccc5fa05587606757adbacb6e1bf12f12fd2c (diff)
Correcting all levels and move all remaining integer samples to sample_t
The leves are based on the standards of each mobile network. They are adjusted to the specified frequency deviation now.
Diffstat (limited to 'src/common/emphasis.c')
-rw-r--r--src/common/emphasis.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/common/emphasis.c b/src/common/emphasis.c
index 524c37b..3fb6679 100644
--- a/src/common/emphasis.c
+++ b/src/common/emphasis.c
@@ -21,6 +21,7 @@
#include <stdint.h>
#include <string.h>
#include <math.h>
+#include "sample.h"
#include "filter.h"
#include "emphasis.h"
#include "debug.h"
@@ -29,7 +30,7 @@
#define CUT_OFF_H 100.0 /* cut-off frequency for high-pass filter */
-static void gen_sine(double *samples, int num, int samplerate, double freq)
+static void gen_sine(sample_t *samples, int num, int samplerate, double freq)
{
int i;
@@ -37,7 +38,7 @@ static void gen_sine(double *samples, int num, int samplerate, double freq)
samples[i] = cos(2.0 * M_PI * freq / (double)samplerate * (double)i);
}
-static double get_level(double *samples, int num)
+static double get_level(sample_t *samples, int num)
{
int i;
double envelope = 0;
@@ -52,7 +53,7 @@ static double get_level(double *samples, int num)
int init_emphasis(emphasis_t *state, int samplerate, double cut_off)
{
double factor;
- double test_samples[samplerate / 10];
+ sample_t test_samples[samplerate / 10];
memset(state, 0, sizeof(*state));
@@ -78,7 +79,7 @@ int init_emphasis(emphasis_t *state, int samplerate, double cut_off)
return 0;
}
-void pre_emphasis(emphasis_t *state, double *samples, int num)
+void pre_emphasis(emphasis_t *state, sample_t *samples, int num)
{
double x, y, x_last, factor, amp;
int i;
@@ -101,7 +102,7 @@ void pre_emphasis(emphasis_t *state, double *samples, int num)
state->p.x_last = x_last;
}
-void de_emphasis(emphasis_t *state, double *samples, int num)
+void de_emphasis(emphasis_t *state, sample_t *samples, int num)
{
double x, y, y_last, factor, amp;
int i;
@@ -125,7 +126,7 @@ void de_emphasis(emphasis_t *state, double *samples, int num)
}
/* high pass filter to remove DC and low frequencies */
-void dc_filter(emphasis_t *state, double *samples, int num)
+void dc_filter(emphasis_t *state, sample_t *samples, int num)
{
filter_process(&state->d.hp, samples, num);
}