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_EFFECT_BRIDGE_H__
21 #define __AGS_EFFECT_BRIDGE_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_BRIDGE                (ags_effect_bridge_get_type())
36 #define AGS_EFFECT_BRIDGE(obj)                (G_TYPE_CHECK_INSTANCE_CAST((obj), AGS_TYPE_EFFECT_BRIDGE, AgsEffectBridge))
37 #define AGS_EFFECT_BRIDGE_CLASS(class)        (G_TYPE_CHECK_CLASS_CAST((class), AGS_TYPE_EFFECT_BRIDGE, AgsEffectBridgeClass))
38 #define AGS_IS_EFFECT_BRIDGE(obj)             (G_TYPE_CHECK_INSTANCE_TYPE((obj), AGS_TYPE_EFFECT_BRIDGE))
39 #define AGS_IS_EFFECT_BRIDGE_CLASS(class)     (G_TYPE_CHECK_CLASS_TYPE((class), AGS_TYPE_EFFECT_BRIDGE))
40 #define AGS_EFFECT_BRIDGE_GET_CLASS(obj)      (G_TYPE_INSTANCE_GET_CLASS((obj), AGS_TYPE_EFFECT_BRIDGE, AgsEffectBridgeClass))
41 
42 #define AGS_EFFECT_BRIDGE_DEFAULT_VERSION "0.7.8"
43 #define AGS_EFFECT_BRIDGE_DEFAULT_BUILD_ID "CEST 01-03-2016 00:23"
44 
45 #define AGS_EFFECT_BRIDGE_MAX_COLUMNS (2)
46 
47 typedef struct _AgsEffectBridge AgsEffectBridge;
48 typedef struct _AgsEffectBridgeClass AgsEffectBridgeClass;
49 
50 typedef enum{
51   AGS_EFFECT_BRIDGE_MAPPED_RECALL     = 1,
52   AGS_EFFECT_BRIDGE_PREMAPPED_RECALL  = 1 <<  1,
53   AGS_EFFECT_BRIDGE_CONNECTED         = 1 <<  2,
54   AGS_EFFECT_BRIDGE_DISPLAY_INPUT     = 1 <<  3,
55   AGS_EFFECT_BRIDGE_BULK_OUTPUT       = 1 <<  4,
56   AGS_EFFECT_BRIDGE_DISPLAY_OUTPUT    = 1 <<  5,
57   AGS_EFFECT_BRIDGE_BULK_INPUT        = 1 <<  6,
58 }AgsEffectBridgeFlags;
59 
60 struct _AgsEffectBridge
61 {
62   GtkBox box;
63 
64   guint flags;
65 
66   gchar *name;
67 
68   gchar *version;
69   gchar *build_id;
70 
71   guint samplerate;
72   guint buffer_size;
73   guint format;
74 
75   guint audio_channels;
76 
77   guint output_pads;
78   guint input_pads;
79 
80   AgsAudio *audio;
81 
82   GType bulk_output_type;
83   GtkWidget *bulk_output;
84 
85   GType output_pad_type;
86   GType output_line_type;
87   GtkHBox *output;
88 
89   GType bulk_input_type;
90   GtkWidget *bulk_input;
91 
92   GType input_pad_type;
93   GType input_line_type;
94   GtkHBox *input;
95 };
96 
97 struct _AgsEffectBridgeClass
98 {
99   GtkBoxClass box;
100 
101   void (*samplerate_changed)(AgsEffectBridge *effect_bridge,
102 			     guint samplerate, guint old_samplerate);
103   void (*buffer_size_changed)(AgsEffectBridge *effect_bridge,
104 			      guint buffer_size, guint old_buffer_size);
105   void (*format_changed)(AgsEffectBridge *effect_bridge,
106 			 guint format, guint old_format);
107 
108   void (*resize_audio_channels)(AgsEffectBridge *effect_bridge,
109 				guint new_size, guint old_size);
110   void (*resize_pads)(AgsEffectBridge *effect_bridge,
111 		      GType channel_type,
112 		      guint new_size, guint old_size);
113 
114   void (*map_recall)(AgsEffectBridge *effect_bridge);
115   GList* (*find_port)(AgsEffectBridge *effect_bridge);
116 };
117 
118 GType ags_effect_bridge_get_type(void);
119 
120 void ags_effect_bridge_samplerate_changed(AgsEffectBridge *effect_bridge,
121 					  guint samplerate, guint old_samplerate);
122 void ags_effect_bridge_buffer_size_changed(AgsEffectBridge *effect_bridge,
123 					   guint buffer_size, guint old_buffer_size);
124 void ags_effect_bridge_format_changed(AgsEffectBridge *effect_bridge,
125 				      guint format, guint old_format);
126 
127 void ags_effect_bridge_resize_audio_channels(AgsEffectBridge *effect_bridge,
128 					     guint new_size, guint old_size);
129 void ags_effect_bridge_resize_pads(AgsEffectBridge *effect_bridge,
130 				   GType channel_type,
131 				   guint new_size, guint old_size);
132 
133 void ags_effect_bridge_map_recall(AgsEffectBridge *effect_bridge);
134 GList* ags_effect_bridge_find_port(AgsEffectBridge *effect_bridge);
135 
136 AgsEffectBridge* ags_effect_bridge_new(AgsAudio *audio);
137 
138 G_END_DECLS
139 
140 #endif /*__AGS_EFFECT_BRIDGE_H__*/
141