gavl
peakdetector.h
Go to the documentation of this file.
1/*****************************************************************
2 * gavl - a general purpose audio/video processing library
3 *
4 * Copyright (c) 2001 - 2024 Members of the Gmerlin project
5 * http://github.com/bplaum
6 *
7 * This program is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 * *****************************************************************/
20
21
22
27
28#ifndef GAVL_PEAKDETECTORS_H_INCLUDED
29#define GAVL_PEAKDETECTORS_H_INCLUDED
30
31#include <gavl/connectors.h>
32
33#ifdef __cplusplus
34extern "C" {
35#endif
36
46
51
52typedef struct gavl_peak_detector_s gavl_peak_detector_t;
53
54/* Create / destroy */
55
65
66typedef void (*gavl_update_peak_callback)(void * priv,
67 int samples,
68 double min, double max, double abs);
69
79
80typedef void (*gavl_update_peaks_callback)(void * priv,
81 int samples,
82 const double * min,
83 const double * max,
84 const double * abs);
85
89
90GAVL_PUBLIC
92
101
102GAVL_PUBLIC
104 gavl_update_peak_callback peak_callback,
105 gavl_update_peaks_callback peaks_callback,
106 void * priv);
107
108
112
113GAVL_PUBLIC
115
123
124GAVL_PUBLIC
126 const gavl_audio_format_t * format);
127
134
135GAVL_PUBLIC const gavl_audio_format_t *
137
138
143
144GAVL_PUBLIC
146 gavl_audio_frame_t * frame);
147
157
158GAVL_PUBLIC
160
171
172GAVL_PUBLIC
174 double * min, double * max,
175 double * abs);
176
187
188GAVL_PUBLIC
190 double * min, double * max,
191 double * abs);
192
196
197GAVL_PUBLIC
199
203
204
205
206#ifdef __cplusplus
207}
208#endif
209
210#endif // GAVL_PEAKDETECTORS_H_INCLUDED
struct gavl_peak_detector_s gavl_peak_detector_t
Opaque structure for peak detector.
Definition peakdetector.h:52
GAVL_PUBLIC void gavl_peak_detector_get_peaks(gavl_peak_detector_t *pd, double *min, double *max, double *abs)
Get the peak volume for all channels separate.
void(* gavl_update_peak_callback)(void *priv, int samples, double min, double max, double abs)
Callback for getting the peaks across all channels.
Definition peakdetector.h:66
GAVL_PUBLIC void gavl_peak_detector_set_format(gavl_peak_detector_t *pd, const gavl_audio_format_t *format)
Set format for a peak detector.
GAVL_PUBLIC gavl_peak_detector_t * gavl_peak_detector_create(void)
Create peak detector.
GAVL_PUBLIC void gavl_peak_detector_reset(gavl_peak_detector_t *pd)
Reset a peak detector.
GAVL_PUBLIC void gavl_peak_detector_set_callbacks(gavl_peak_detector_t *pd, gavl_update_peak_callback peak_callback, gavl_update_peaks_callback peaks_callback, void *priv)
Set callbacks.
GAVL_PUBLIC void gavl_peak_detector_update(gavl_peak_detector_t *pd, gavl_audio_frame_t *frame)
Feed the peak detector with a new frame.
void(* gavl_update_peaks_callback)(void *priv, int samples, const double *min, const double *max, const double *abs)
Callback for getting the peaks for all channels separately.
Definition peakdetector.h:80
GAVL_PUBLIC gavl_audio_sink_t * gavl_peak_detector_get_sink(gavl_peak_detector_t *pd)
Get the audio sink.
GAVL_PUBLIC void gavl_peak_detector_get_peak(gavl_peak_detector_t *pd, double *min, double *max, double *abs)
Get the peak volume across all channels.
GAVL_PUBLIC const gavl_audio_format_t * gavl_peak_detector_get_format(gavl_peak_detector_t *pd)
Get format.
GAVL_PUBLIC void gavl_peak_detector_destroy(gavl_peak_detector_t *pd)
Destroys a peak detector and frees all associated memory.
struct gavl_audio_sink_s gavl_audio_sink_t
Audio sink.
Definition gavl.h:74
Audio Format.
Definition gavl.h:273
Generic container for audio samples.
Definition gavl.h:624