Test filter uses a dB graph to show the response graphically
This commit is contained in:
@@ -23,6 +23,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
#include <errno.h>
|
||||
#include <math.h>
|
||||
#include "sample.h"
|
||||
#include "debug.h"
|
||||
#include "display.h"
|
||||
@@ -118,6 +119,26 @@ const char *debug_amplitude(double level)
|
||||
return text;
|
||||
}
|
||||
|
||||
#define level2db(level) (20 * log10(level))
|
||||
|
||||
const char *debug_db(double level_db)
|
||||
{
|
||||
static char text[128];
|
||||
int l;
|
||||
|
||||
strcpy(text, ": . : . : . : . : . : . : . : . : ");
|
||||
if (level_db <= 0.0)
|
||||
return text;
|
||||
l = (int)round(level2db(level_db));
|
||||
if (l > 3)
|
||||
return text;
|
||||
if (l < -48)
|
||||
return text;
|
||||
text[l + 48] = '*';
|
||||
|
||||
return text;
|
||||
}
|
||||
|
||||
void debug_list_cat(void)
|
||||
{
|
||||
int i;
|
||||
|
Reference in New Issue
Block a user