2 * Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
4 * gstlevel.c: signals RMS, peak and decaying peak levels
5 * Copyright (C) 2000,2001,2002,2003
6 * Thomas Vander Stichele <thomas at apestaart dot org>
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either
11 * version 2 of the License, or (at your option) any later version.
13 * This library 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 GNU
16 * Library General Public License for more details.
18 * You should have received a copy of the GNU Library General Public
19 * License along with this library; if not, write to the
20 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
21 * Boston, MA 02111-1307, USA.
25 #ifndef __GST_LEVEL_H__
26 #define __GST_LEVEL_H__
30 #include <gst/base/gstbasetransform.h>
36 #define GST_TYPE_LEVEL \
37 (gst_level_get_type())
38 #define GST_LEVEL(obj) \
39 (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_LEVEL,GstLevel))
40 #define GST_LEVEL_CLASS(klass) \
41 (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_ULAW,GstLevel))
42 #define GST_IS_LEVEL(obj) \
43 (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_LEVEL))
44 #define GST_IS_LEVEL_CLASS(obj) \
45 (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_LEVEL))
48 typedef struct _GstLevel GstLevel;
49 typedef struct _GstLevelClass GstLevelClass;
53 GstBaseTransform element;
55 gboolean signal; /* whether or not to emit signals */
56 gdouble interval; /* how many seconds between emits */
58 gint rate; /* caps variables */
62 gdouble decay_peak_ttl; /* time to live for peak in seconds */
63 gdouble decay_peak_falloff; /* falloff in dB/sec */
64 gdouble num_samples; /* cumulative sample count */
66 /* per-channel arrays for intermediate values */
67 gdouble *CS; /* normalized Cumulative Square */
68 gdouble *peak; /* normalized Peak value over buffer */
69 gdouble *last_peak; /* last normalized Peak value over interval */
70 gdouble *decay_peak; /* running decaying normalized Peak */
71 gdouble *MS; /* normalized Mean Square of buffer */
72 gdouble *RMS_dB; /* RMS in dB to emit */
73 gdouble *decay_peak_age; /* age of last peak */
76 struct _GstLevelClass {
77 GstBaseTransformClass parent_class;
81 GType gst_level_get_type(void);
87 #endif /* __GST_LEVEL_H__ */