1 /* GSequencer - Advanced GTK Sequencer
2  * Copyright (C) 2005-2020 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_EFFECT_LINE_H__
21 #define __AGS_EFFECT_LINE_H__
22 
23 #include <glib.h>
24 #include <glib-object.h>
25 
26 #include <gtk/gtk.h>
27 
28 #include <ags/libags.h>
29 #include <ags/libags-audio.h>
30 
31 #include <ags/libags-gui.h>
32 
33 G_BEGIN_DECLS
34 
35 #define AGS_TYPE_EFFECT_LINE                (ags_effect_line_get_type())
36 #define AGS_EFFECT_LINE(obj)                (G_TYPE_CHECK_INSTANCE_CAST((obj), AGS_TYPE_EFFECT_LINE, AgsEffectLine))
37 #define AGS_EFFECT_LINE_CLASS(class)        (G_TYPE_CHECK_CLASS_CAST((class), AGS_TYPE_EFFECT_LINE, AgsEffectLineClass))
38 #define AGS_IS_EFFECT_LINE(obj)             (G_TYPE_CHECK_INSTANCE_TYPE((obj), AGS_TYPE_EFFECT_LINE))
39 #define AGS_IS_EFFECT_LINE_CLASS(class)     (G_TYPE_CHECK_CLASS_TYPE((class), AGS_TYPE_EFFECT_LINE))
40 #define AGS_EFFECT_LINE_GET_CLASS(obj)      (G_TYPE_INSTANCE_GET_CLASS((obj), AGS_TYPE_EFFECT_LINE, AgsEffectLineClass))
41 
42 #define AGS_EFFECT_LINE_PLUGIN(ptr) ((AgsEffectLinePlugin *)(ptr))
43 
44 #define AGS_EFFECT_LINE_DEFAULT_VERSION "0.7.8"
45 #define AGS_EFFECT_LINE_DEFAULT_BUILD_ID "CEST 01-03-2016 00:23"
46 
47 #define AGS_EFFECT_LINE_COLUMNS_COUNT (2)
48 #define AGS_EFFECT_LINE_SEPARATOR_FILENAME "ags-effect-line-separator-filename"
49 #define AGS_EFFECT_LINE_SEPARATOR_EFFECT "ags-effect-line-separator-effect"
50 
51 typedef struct _AgsEffectLine AgsEffectLine;
52 typedef struct _AgsEffectLinePlugin AgsEffectLinePlugin;
53 typedef struct _AgsEffectLineClass AgsEffectLineClass;
54 
55 typedef enum{
56   AGS_EFFECT_LINE_CONNECTED           = 1,
57   AGS_EFFECT_LINE_MAPPED_RECALL       = 1 <<  1,
58   AGS_EFFECT_LINE_PREMAPPED_RECALL    = 1 <<  2,
59 }AgsEffectLineFlags;
60 
61 struct _AgsEffectLine
62 {
63   GtkBox box;
64 
65   guint flags;
66 
67   gchar *name;
68 
69   gchar *version;
70   gchar *build_id;
71 
72   guint samplerate;
73   guint buffer_size;
74   guint format;
75 
76   AgsChannel *channel;
77 
78   GtkLabel *label;
79   GtkToggleButton *group;
80 
81   GtkGrid *grid;
82 
83   GList *plugin;
84 
85   GList *queued_drawing;
86 };
87 
88 struct _AgsEffectLineClass
89 {
90   GtkBoxClass box;
91 
92   void (*samplerate_changed)(AgsEffectLine *effect_line,
93 			     guint samplerate, guint old_samplerate);
94   void (*buffer_size_changed)(AgsEffectLine *effect_line,
95 			      guint buffer_size, guint old_buffer_size);
96   void (*format_changed)(AgsEffectLine *effect_line,
97 			 guint format, guint old_format);
98 
99   void (*set_channel)(AgsEffectLine *effect_line, AgsChannel *channel);
100 
101   void (*add_plugin)(AgsEffectLine *effect_line,
102 		     GList *control_type_name,
103 		     AgsRecallContainer *play_container, AgsRecallContainer *recall_container,
104 		     gchar *plugin_name,
105 		     gchar *filename,
106 		     gchar *effect,
107 		     guint start_audio_channel, guint stop_audio_channel,
108 		     guint start_pad, guint stop_pad,
109 		     gint position,
110 		     guint create_flags, guint recall_flags);
111   void (*remove_plugin)(AgsEffectLine *effect_line,
112 			guint nth);
113 
114   void (*map_recall)(AgsEffectLine *effect_line,
115 		     guint output_pad_start);
116   GList* (*find_port)(AgsEffectLine *effect_line);
117 
118   void (*done)(AgsEffectLine *effect_line,
119 	       GObject *recall_id);
120 };
121 
122 struct _AgsEffectLinePlugin
123 {
124   AgsRecallContainer *play_container;
125   AgsRecallContainer *recall_container;
126 
127   gchar *plugin_name;
128 
129   gchar *filename;
130   gchar *effect;
131 
132   GList *control_type_name;
133 
134   guint control_count;
135 };
136 
137 GType ags_effect_line_get_type(void);
138 
139 AgsEffectLinePlugin* ags_effect_line_plugin_alloc(AgsRecallContainer *play_container, AgsRecallContainer *recall_container,
140 						  gchar *plugin_name,
141 						  gchar *filename,
142 						  gchar *effect);
143 void ags_effect_line_plugin_free(AgsEffectLinePlugin *effect_line_plugin);
144 
145 void ags_effect_line_samplerate_changed(AgsEffectLine *effect_line,
146 					guint samplerate, guint old_samplerate);
147 void ags_effect_line_buffer_size_changed(AgsEffectLine *effect_line,
148 					 guint buffer_size, guint old_buffer_size);
149 void ags_effect_line_format_changed(AgsEffectLine *effect_line,
150 				    guint format, guint old_format);
151 
152 void ags_effect_line_set_channel(AgsEffectLine *effect_line, AgsChannel *channel);
153 
154 void ags_effect_line_add_plugin(AgsEffectLine *effect_line,
155 				GList *control_type_name,
156 				AgsRecallContainer *play_container, AgsRecallContainer *recall_container,
157 				gchar *plugin_name,
158 				gchar *filename,
159 				gchar *effect,
160 				guint start_audio_channel, guint stop_audio_channel,
161 				guint start_pad, guint stop_pad,
162 				gint position,
163 				guint create_flags, guint recall_flags);
164 void ags_effect_line_remove_plugin(AgsEffectLine *effect_line,
165 				   guint nth);
166 
167 void ags_effect_line_map_recall(AgsEffectLine *effect_line,
168 				guint output_pad_start);
169 GList* ags_effect_line_find_port(AgsEffectLine *effect_line);
170 
171 void ags_effect_line_done(AgsEffectLine *effect_line,
172 			  GObject *recall_id);
173 
174 GList* ags_effect_line_find_next_grouped(GList *effect_line);
175 
176 void ags_effect_line_check_message(AgsEffectLine *effect_line);
177 
178 gboolean ags_effect_line_indicator_queue_draw_timeout(GtkWidget *widget);
179 
180 AgsEffectLine* ags_effect_line_new(AgsChannel *channel);
181 
182 G_END_DECLS
183 
184 #endif /*__AGS_EFFECT_LINE_H__*/
185