1 /* GSequencer - Advanced GTK Sequencer
2  * Copyright (C) 2005-2019 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_LINE_H__
21 #define __AGS_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 #include <ags/libags-gui.h>
31 
32 G_BEGIN_DECLS
33 
34 #define AGS_TYPE_LINE                (ags_line_get_type())
35 #define AGS_LINE(obj)                (G_TYPE_CHECK_INSTANCE_CAST((obj), AGS_TYPE_LINE, AgsLine))
36 #define AGS_LINE_CLASS(class)        (G_TYPE_CHECK_CLASS_CAST((class), AGS_TYPE_LINE, AgsLineClass))
37 #define AGS_IS_LINE(obj)             (G_TYPE_CHECK_INSTANCE_TYPE ((obj), AGS_TYPE_LINE))
38 #define AGS_IS_LINE_CLASS(class)     (G_TYPE_CHECK_CLASS_TYPE ((class), AGS_TYPE_LINE))
39 #define AGS_LINE_GET_CLASS(obj)      (G_TYPE_INSTANCE_GET_CLASS ((obj), AGS_TYPE_LINE, AgsLineClass))
40 
41 #define AGS_LINE_PLUGIN(ptr) ((AgsLinePlugin *)(ptr))
42 
43 #define AGS_LINE_DEFAULT_VERSION "0.7.0"
44 #define AGS_LINE_DEFAULT_BUILD_ID "CEST 31-10-2015 19:49"
45 
46 #define AGS_LINE_COLUMNS_COUNT (2)
47 #define AGS_LINE_SEPARATOR_FILENAME "ags-line-separator-filename"
48 #define AGS_LINE_SEPARATOR_EFFECT "ags-line-separator-effect"
49 
50 typedef struct _AgsLine AgsLine;
51 typedef struct _AgsLinePlugin AgsLinePlugin;
52 typedef struct _AgsLineClass AgsLineClass;
53 
54 typedef enum{
55   AGS_LINE_CONNECTED         = 1,
56   AGS_LINE_GROUPED           = 1 << 1,
57   AGS_LINE_MAPPED_RECALL     = 1 << 2,
58   AGS_LINE_PREMAPPED_RECALL  = 1 << 3,
59 }AgsLineFlags;
60 
61 struct _AgsLine
62 {
63   GtkBox box;
64 
65   guint flags;
66 
67   gchar *version;
68   gchar *build_id;
69 
70   guint samplerate;
71   guint buffer_size;
72   guint format;
73 
74   gchar *name;
75 
76   AgsChannel *channel;
77 
78   GtkWidget *pad;
79 
80   GtkLabel *label;
81   GtkToggleButton *group;
82 
83   AgsExpander *expander;
84 
85   GtkWidget *indicator;
86 
87   GList *plugin;
88 
89   GList *queued_drawing;
90 };
91 
92 struct _AgsLineClass
93 {
94   GtkBoxClass box;
95 
96   void (*samplerate_changed)(AgsLine *line,
97 			     guint samplerate, guint old_samplerate);
98   void (*buffer_size_changed)(AgsLine *line,
99 			      guint buffer_size, guint old_buffer_size);
100   void (*format_changed)(AgsLine *line,
101 			 guint format, guint old_format);
102 
103   void (*set_channel)(AgsLine *line, AgsChannel *channel);
104 
105   void (*group_changed)(AgsLine *line);
106 
107   void (*add_plugin)(AgsLine *line,
108 		     GList *control_type_name,
109 		     AgsRecallContainer *play_container, AgsRecallContainer *recall_container,
110 		     gchar *plugin_name,
111 		     gchar *filename,
112 		     gchar *effect,
113 		     guint start_audio_channel, guint stop_audio_channel,
114 		     guint start_pad, guint stop_pad,
115 		     gint position,
116 		     guint create_flags, guint recall_flags);
117   void (*remove_plugin)(AgsLine *line,
118 			guint nth);
119 
120   void (*map_recall)(AgsLine *line,
121 		     guint output_pad_start);
122   GList* (*find_port)(AgsLine *line);
123 
124   void (*stop)(AgsLine *line,
125 	       GList *recall_id, gint sound_scope);
126 };
127 
128 struct _AgsLinePlugin
129 {
130   AgsRecallContainer *play_container;
131   AgsRecallContainer *recall_container;
132 
133   gchar *plugin_name;
134 
135   gchar *filename;
136   gchar *effect;
137 
138   GList *control_type_name;
139 
140   guint control_count;
141 };
142 
143 GType ags_line_get_type(void);
144 
145 AgsLinePlugin* ags_line_plugin_alloc(AgsRecallContainer *play_container, AgsRecallContainer *recall_container,
146 				     gchar *plugin_name,
147 				     gchar *filename,
148 				     gchar *effect);
149 void ags_line_plugin_free(AgsLinePlugin *line_plugin);
150 
151 void ags_line_samplerate_changed(AgsLine *line,
152 				 guint samplerate, guint old_samplerate);
153 void ags_line_buffer_size_changed(AgsLine *line,
154 				  guint buffer_size, guint old_buffer_size);
155 void ags_line_format_changed(AgsLine *line,
156 			     guint format, guint old_format);
157 
158 void ags_line_set_channel(AgsLine *line, AgsChannel *channel);
159 
160 void ags_line_group_changed(AgsLine *line);
161 
162 void ags_line_add_plugin(AgsLine *line,
163 			 GList *control_type_name,
164 			 AgsRecallContainer *play_container, AgsRecallContainer *recall_container,
165 			 gchar *plugin_name,
166 			 gchar *filename,
167 			 gchar *effect,
168 			 guint start_audio_channel, guint stop_audio_channel,
169 			 guint start_pad, guint stop_pad,
170 			 gint position,
171 			 guint create_flags, guint recall_flags);
172 void ags_line_remove_plugin(AgsLine *line,
173 			    guint nth);
174 
175 void ags_line_map_recall(AgsLine *line,
176 			 guint output_pad_start);
177 GList* ags_line_find_port(AgsLine *line);
178 
179 void ags_line_stop(AgsLine *line,
180 		   GList *recall_id, gint sound_scope);
181 
182 GList* ags_line_find_next_grouped(GList *line);
183 
184 void ags_line_check_message(AgsLine *line);
185 
186 gboolean ags_line_indicator_queue_draw_timeout(GtkWidget *widget);
187 
188 AgsLine* ags_line_new(GtkWidget *pad, AgsChannel *channel);
189 
190 G_END_DECLS
191 
192 #endif /*__AGS_LINE_H__*/
193