2 * Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
3 * Copyright (C) <2009> Sebastian Dröge <sebastian.droege@collabora.co.uk>
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Library General Public License for more details.
15 * You should have received a copy of the GNU Library General Public
16 * License along with this library; if not, write to the
17 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 * Boston, MA 02111-1307, USA.
22 #ifndef __GST_SPECTRUM_H__
23 #define __GST_SPECTRUM_H__
26 #include <gst/audio/gstaudiofilter.h>
27 #include <gst/fft/gstfftf32.h>
31 #define GST_TYPE_SPECTRUM (gst_spectrum_get_type())
32 #define GST_SPECTRUM(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_SPECTRUM,GstSpectrum))
33 #define GST_IS_SPECTRUM(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_SPECTRUM))
34 #define GST_SPECTRUM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), GST_TYPE_SPECTRUM,GstSpectrumClass))
35 #define GST_IS_SPECTRUM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GST_TYPE_SPECTRUM))
36 typedef struct _GstSpectrum GstSpectrum;
37 typedef struct _GstSpectrumClass GstSpectrumClass;
41 GstAudioFilter parent;
44 gboolean post_messages; /* whether or not to post messages */
45 gboolean message_magnitude;
46 gboolean message_phase;
47 guint64 interval; /* how many nanoseconds between emits */
48 guint64 frames_per_interval; /* how many frames per interval */
49 guint bands; /* number of spectrum bands */
50 gint threshold; /* energy level treshold */
52 guint64 num_frames; /* frame count (1 sample per channel)
54 guint64 num_fft; /* number of FFTs since last emit */
55 GstClockTime message_ts; /* starttime for next message */
61 GstFFTF32Complex *freqdata;
62 gfloat *spect_magnitude;
66 guint64 error_per_interval;
67 guint64 accumulated_error;
70 struct _GstSpectrumClass
72 GstAudioFilterClass parent_class;
75 GType gst_spectrum_get_type (void);
79 #endif /* __GST_SPECTRUM_H__ */