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 - 2012 Members of the Gmerlin project
5  * gmerlin-general@lists.sourceforge.net
6  * http://gmerlin.sourceforge.net
7  *
8  * This program is free software: you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation, either version 2 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program. If not, see <http://www.gnu.org/licenses/>.
20  * *****************************************************************/
21 
27 #ifndef GAVL_PEAKDETECTORS_H_INCLUDED
28 #define GAVL_PEAKDETECTORS_H_INCLUDED
29 
30 #include <gavl/connectors.h>
31 
32 #ifdef __cplusplus
33 extern "C" {
34 #endif
35 
51 typedef struct gavl_peak_detector_s gavl_peak_detector_t;
52 
53 /* Create / destroy */
54 
65 typedef void (*gavl_update_peak_callback)(void * priv,
66  int samples,
67  double min, double max, double abs);
68 
79 typedef void (*gavl_update_peaks_callback)(void * priv,
80  int samples,
81  const double * min,
82  const double * max,
83  const double * abs);
84 
89 GAVL_PUBLIC
91 
101 GAVL_PUBLIC
103  gavl_update_peak_callback peak_callback,
104  gavl_update_peaks_callback peaks_callback,
105  void * priv);
106 
107 
112 GAVL_PUBLIC
114 
123 GAVL_PUBLIC
125  const gavl_audio_format_t * format);
126 
134 GAVL_PUBLIC const gavl_audio_format_t *
136 
137 
143 GAVL_PUBLIC
145  gavl_audio_frame_t * frame);
146 
157 GAVL_PUBLIC
159 
171 GAVL_PUBLIC
173  double * min, double * max,
174  double * abs);
175 
187 GAVL_PUBLIC
189  double * min, double * max,
190  double * abs);
191 
196 GAVL_PUBLIC
198 
205 #ifdef __cplusplus
206 }
207 #endif
208 
209 #endif // GAVL_PEAKDETECTORS_H_INCLUDED
struct gavl_peak_detector_s gavl_peak_detector_t
Opaque structure for peak detector.
Definition: peakdetector.h:51
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_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:65
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 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:79
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 gavl_peak_detector_t * gavl_peak_detector_create()
Create peak detector.
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:72
Audio Format.
Definition: gavl.h:321
Generic container for audio samples.
Definition: gavl.h:668