aboutsummaryrefslogtreecommitdiffstats
path: root/src/common/display.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/common/display.h')
-rw-r--r--src/common/display.h45
1 files changed, 44 insertions, 1 deletions
diff --git a/src/common/display.h b/src/common/display.h
index 850e4d8..386a2d7 100644
--- a/src/common/display.h
+++ b/src/common/display.h
@@ -1,4 +1,5 @@
-#define DISPLAY_INTERVAL 0.04
+#define DISPLAY_INTERVAL 0.04 /* time (in seconds) for each interval */
+#define DISPLAY_PARAM_HISTORIES 25 /* number of intervals (should result in one seconds) */
#define MAX_DISPLAY_WIDTH 1024
@@ -11,6 +12,40 @@ typedef struct display_wave {
sample_t buffer[MAX_DISPLAY_WIDTH];
} dispwav_t;
+enum display_measurements_type {
+ DISPLAY_MEAS_LAST, /* display last value */
+ DISPLAY_MEAS_PEAK, /* display peak value */
+ DISPLAY_MEAS_PEAK2PEAK, /* display peak value of min..max range */
+ DISPLAY_MEAS_AVG, /* display average value */
+};
+
+enum display_measurements_bar {
+ DISPLAY_MEAS_LEFT, /* bar graph from left */
+ DISPLAY_MEAS_CENTER, /* bar graph from center */
+};
+
+typedef struct display_measurements_param {
+ struct display_measurements_param *next;
+ char name[32]; /* parameter name (e.g. 'Deviation') */
+ char format[32]; /* unit name (e.g. "%.2f KHz") */
+ enum display_measurements_type type;
+ enum display_measurements_bar bar;
+ double min; /* minimum value */
+ double max; /* maximum value */
+ double mark; /* mark (target) value */
+ double value; /* current value (peak, sum...) */
+ double value2; /* max value for min..max range */
+ double last; /* last valid value (used for DISPLAY_MEAS_LAST) */
+ int value_count; /* count number of values of one interval */
+ double value_history[DISPLAY_PARAM_HISTORIES]; /* history of values of last second */
+ double value2_history[DISPLAY_PARAM_HISTORIES]; /* stores max for min..max range */
+ int value_history_pos; /* next history value to write */
+} dispmeasparam_t;
+
+typedef struct display_measurements {
+ dispmeasparam_t *head;
+} dispmeas_t;
+
#define MAX_DISPLAY_IQ 1024
typedef struct display_iq {
@@ -44,6 +79,14 @@ void display_status_channel(int channel, const char *type, const char *state);
void display_status_subscriber(const char *number, const char *state);
void display_status_end(void);
+void display_measurements_init(sender_t *sender, int samplerate);
+void display_measurements_exit(sender_t *sender);
+void display_measurements_on(int on);
+void display_measurements_limit_scroll(int on);
+dispmeasparam_t *display_measurements_add(sender_t *sender, char *name, char *format, enum display_measurements_type type, enum display_measurements_bar bar, double min, double max, double mark);
+void display_measurements_update(dispmeasparam_t *param, double value, double value2);
+void display_measurements(double elapsed);
+
void display_iq_init(int samplerate);
void display_iq_on(int on);
void display_iq_limit_scroll(int on);