peakdetector.h
Go to the documentation of this file.
/*****************************************************************
* gavl - a general purpose audio/video processing library
*
* Copyright (c) 2001 - 2024 Members of the Gmerlin project
* http://github.com/bplaum
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* *****************************************************************/
#ifndef GAVL_PEAKDETECTORS_H_INCLUDED
#define GAVL_PEAKDETECTORS_H_INCLUDED
#include <gavl/connectors.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef struct gavl_peak_detector_s gavl_peak_detector_t;
/* Create / destroy */
typedef void (*gavl_update_peak_callback)(void * priv,
int samples,
double min, double max, double abs);
typedef void (*gavl_update_peaks_callback)(void * priv,
int samples,
const double * min,
const double * max,
const double * abs);
GAVL_PUBLIC
gavl_peak_detector_t * gavl_peak_detector_create(void);
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);
GAVL_PUBLIC
void gavl_peak_detector_destroy(gavl_peak_detector_t *pd);
GAVL_PUBLIC
void gavl_peak_detector_set_format(gavl_peak_detector_t *pd,
const gavl_audio_format_t * format);
GAVL_PUBLIC const gavl_audio_format_t *
gavl_peak_detector_get_format(gavl_peak_detector_t * pd);
GAVL_PUBLIC
void gavl_peak_detector_update(gavl_peak_detector_t *pd,
gavl_audio_frame_t * frame);
GAVL_PUBLIC
gavl_audio_sink_t * gavl_peak_detector_get_sink(gavl_peak_detector_t *pd);
GAVL_PUBLIC
void gavl_peak_detector_get_peak(gavl_peak_detector_t * pd,
double * min, double * max,
double * abs);
GAVL_PUBLIC
void gavl_peak_detector_get_peaks(gavl_peak_detector_t * pd,
double * min, double * max,
double * abs);
GAVL_PUBLIC
void gavl_peak_detector_reset(gavl_peak_detector_t * pd);
#ifdef __cplusplus
}
#endif
#endif // GAVL_PEAKDETECTORS_H_INCLUDED
gavl_peak_detector_t
struct gavl_peak_detector_s gavl_peak_detector_t
Opaque structure for peak detector.
Definition peakdetector.h:52
gavl_peak_detector_get_peaks
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.
gavl_update_peak_callback
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_peak_detector_set_format
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_peak_detector_create
GAVL_PUBLIC gavl_peak_detector_t * gavl_peak_detector_create(void)
Create peak detector.
gavl_peak_detector_reset
GAVL_PUBLIC void gavl_peak_detector_reset(gavl_peak_detector_t *pd)
Reset a peak detector.
gavl_peak_detector_set_callbacks
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_peak_detector_update
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.
gavl_update_peaks_callback
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_peak_detector_get_sink
GAVL_PUBLIC gavl_audio_sink_t * gavl_peak_detector_get_sink(gavl_peak_detector_t *pd)
Get the audio sink.
gavl_peak_detector_get_peak
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_peak_detector_get_format
GAVL_PUBLIC const gavl_audio_format_t * gavl_peak_detector_get_format(gavl_peak_detector_t *pd)
Get format.
gavl_peak_detector_destroy
GAVL_PUBLIC void gavl_peak_detector_destroy(gavl_peak_detector_t *pd)
Destroys a peak detector and frees all associated memory.
gavl_audio_sink_t
struct gavl_audio_sink_s gavl_audio_sink_t
Audio sink.
Definition gavl.h:74
gavl_audio_format_t
Audio Format.
Definition gavl.h:273
gavl_audio_frame_t
Generic container for audio samples.
Definition gavl.h:624