1 /* GSequencer - Advanced GTK Sequencer 2 * Copyright (C) 2005-2018 Joël Krähemann 3 * 4 * This file is part of GSequencer. 5 * 6 * GSequencer is free software: you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License as published by 8 * the Free Software Foundation, either version 3 of the License, or 9 * (at your option) any later version. 10 * 11 * GSequencer is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * GNU General Public License for more details. 15 * 16 * You should have received a copy of the GNU General Public License 17 * along with GSequencer. If not, see <http://www.gnu.org/licenses/>. 18 */ 19 20 #ifndef __AGS_ANALYSE_CHANNEL_H__ 21 #define __AGS_ANALYSE_CHANNEL_H__ 22 23 #include <glib.h> 24 #include <glib-object.h> 25 26 #include <complex.h> 27 #include <fftw3.h> 28 29 #include <ags/libags.h> 30 31 #include <ags/audio/ags_channel.h> 32 #include <ags/audio/ags_recall_channel.h> 33 #include <ags/audio/ags_port.h> 34 35 G_BEGIN_DECLS 36 37 #define AGS_TYPE_ANALYSE_CHANNEL (ags_analyse_channel_get_type()) 38 #define AGS_ANALYSE_CHANNEL(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), AGS_TYPE_ANALYSE_CHANNEL, AgsAnalyseChannel)) 39 #define AGS_ANALYSE_CHANNEL_CLASS(class) (G_TYPE_CHECK_CLASS_CAST((class), AGS_TYPE_ANALYSE_CHANNEL, AgsAnalyseChannel)) 40 #define AGS_IS_ANALYSE_CHANNEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), AGS_TYPE_ANALYSE_CHANNEL)) 41 #define AGS_IS_ANALYSE_CHANNEL_CLASS(class) (G_TYPE_CHECK_CLASS_TYPE ((class), AGS_TYPE_ANALYSE_CHANNEL)) 42 #define AGS_ANALYSE_CHANNEL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), AGS_TYPE_ANALYSE_CHANNEL, AgsAnalyseChannelClass)) 43 44 #define AGS_ANALYSE_CHANNEL_GET_BUFFER_MUTEX(obj) (&(((AgsAnalyseChannel *) obj)->buffer_mutex)) 45 46 typedef struct _AgsAnalyseChannel AgsAnalyseChannel; 47 typedef struct _AgsAnalyseChannelClass AgsAnalyseChannelClass; 48 49 struct _AgsAnalyseChannel 50 { 51 AgsRecallChannel recall_channel; 52 53 GRecMutex buffer_mutex; 54 55 guint cache_samplerate; 56 guint cache_buffer_size; 57 guint cache_format; 58 59 fftw_plan plan; 60 fftw_complex *comout; 61 62 double *in; 63 double *out; 64 65 double *frequency_pre_buffer; 66 double *magnitude_pre_buffer; 67 68 AgsPort *buffer_cleared; 69 AgsPort *buffer_computed; 70 71 AgsPort *frequency_buffer; 72 AgsPort *magnitude_buffer; 73 }; 74 75 struct _AgsAnalyseChannelClass 76 { 77 AgsRecallChannelClass recall_channel; 78 }; 79 80 G_DEPRECATED_FOR(ags_fx_analyse_channel_get_type) 81 GType ags_analyse_channel_get_type(); 82 83 G_DEPRECATED 84 void ags_analyse_channel_buffer_add(AgsAnalyseChannel *analyse_channel, 85 void *buffer, 86 guint samplerate, guint buffer_size, guint format); 87 88 G_DEPRECATED 89 void ags_analyse_channel_retrieve_frequency_and_magnitude(AgsAnalyseChannel *analyse_channel); 90 91 G_DEPRECATED_FOR(ags_fx_analyse_channel_new) 92 AgsAnalyseChannel* ags_analyse_channel_new(AgsChannel *source); 93 94 G_END_DECLS 95 96 #endif /*__AGS_ANALYSE_CHANNEL_H__*/ 97