Zrythm
a highly automated and intuitive digital audio workstation
Loading...
Searching...
No Matches
meter.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: © 2020 Alexandros Theodotou <alex@zrythm.org>
2// SPDX-License-Identifier: LicenseRef-ZrythmLicense
3
10#ifndef __AUDIO_METER_H__
11#define __AUDIO_METER_H__
12
13#include <stdbool.h>
14
15#include "utils/types.h"
16
17#include <gtk/gtk.h>
18
19typedef struct TruePeakDsp TruePeakDsp;
20typedef struct KMeterDsp KMeterDsp;
21typedef struct PeakDsp PeakDsp;
22typedef struct Port Port;
23
30typedef enum MeterAlgorithm
31{
34
35 METER_ALGORITHM_DIGITAL_PEAK,
36
40 METER_ALGORITHM_RMS,
41 METER_ALGORITHM_K,
43
47typedef struct Meter
48{
51
54 TruePeakDsp * true_peak_max_processor;
55
57 float true_peak;
58 float true_peak_max;
59
62
63 PeakDsp * peak_processor;
64
71
74 float prev_max;
75
78 float last_amp;
79
83
84 gint64 last_midi_trigger_time;
85
86} Meter;
87
88Meter *
89meter_new_for_port (Port * port);
90
97void
98meter_get_value (Meter * self, AudioValueFormat format, float * val, float * max);
99
100void
101meter_free (Meter * self);
102
103#endif
float prev_max
Previous max, used when holding the max value.
Definition meter.h:74
KMeterDsp * kmeter_processor
K RMS processor, if K meter.
Definition meter.h:61
void meter_get_value(Meter *self, AudioValueFormat format, float *val, float *max)
Get the current meter value.
float true_peak
Current true peak.
Definition meter.h:57
Port * port
Port associated with this meter.
Definition meter.h:50
TruePeakDsp * true_peak_processor
True peak processor.
Definition meter.h:53
MeterAlgorithm
Definition meter.h:31
float last_amp
Last meter value (in amplitude), used to show a falloff and avoid sudden dips.
Definition meter.h:78
MeterAlgorithm algorithm
Algorithm to use.
Definition meter.h:70
gint64 last_draw_time
Time the last val was taken at (last draw time).
Definition meter.h:82
@ METER_ALGORITHM_TRUE_PEAK
Definition meter.h:39
@ METER_ALGORITHM_AUTO
Use default algorithm for the port.
Definition meter.h:33
AudioValueFormat
Definition types.h:121
A Meter used by a single GUI element.
Definition meter.h:48
Must ONLY be created via port_new()
Definition port.h:138
Custom types.