1 /* GSequencer - Advanced GTK Sequencer
2  * Copyright (C) 2005-2021 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_PAD_H__
21 #define __AGS_PAD_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 #include <ags/X/ags_line.h>
33 
34 G_BEGIN_DECLS
35 
36 #define AGS_TYPE_PAD                (ags_pad_get_type())
37 #define AGS_PAD(obj)                (G_TYPE_CHECK_INSTANCE_CAST((obj), AGS_TYPE_PAD, AgsPad))
38 #define AGS_PAD_CLASS(class)        (G_TYPE_CHECK_CLASS_CAST((class), AGS_TYPE_PAD, AgsPadClass))
39 #define AGS_IS_PAD(obj)             (G_TYPE_CHECK_INSTANCE_TYPE((obj), AGS_TYPE_PAD))
40 #define AGS_IS_PAD_CLASS(class)     (G_TYPE_CHECK_CLASS_TYPE((class), AGS_TYPE_PAD))
41 #define AGS_PAD_GET_CLASS(obj)      (G_TYPE_INSTANCE_GET_CLASS((obj), AGS_TYPE_PAD, AgsPadClass))
42 
43 #define AGS_PAD_DEFAULT_VERSION "0.4.2"
44 #define AGS_PAD_DEFAULT_BUILD_ID "CEST 02-10-2014 19:36"
45 
46 typedef struct _AgsPad AgsPad;
47 typedef struct _AgsPadClass AgsPadClass;
48 
49 typedef enum{
50   AGS_PAD_CONNECTED           = 1,
51   AGS_PAD_SHOW_GROUPING       = 1 << 1,
52   AGS_PAD_GROUP_ALL           = 1 << 2,
53   AGS_PAD_GROUP_LINE          = 1 << 3,
54   AGS_PAD_MAPPED_RECALL       = 1 << 4,
55   AGS_PAD_PREMAPPED_RECALL    = 1 << 5,
56   AGS_PAD_BLOCK_PLAY          = 1 << 6,
57   AGS_PAD_BLOCK_STOP          = 1 << 7,
58 }AgsPadFlags;
59 
60 struct _AgsPad
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   AgsChannel *channel;
76 
77   guint cols;
78   AgsExpanderSet *expander_set;
79 
80   GtkToggleButton *group;
81   GtkToggleButton *mute;
82   GtkToggleButton *solo;
83 
84   GtkToggleButton *play;
85 };
86 
87 struct _AgsPadClass
88 {
89   GtkBoxClass box;
90 
91   void (*samplerate_changed)(AgsPad *pad,
92 			     guint samplerate, guint old_samplerate);
93   void (*buffer_size_changed)(AgsPad *pad,
94 			      guint buffer_size, guint old_buffer_size);
95   void (*format_changed)(AgsPad *pad,
96 			 guint format, guint old_format);
97 
98   void (*set_channel)(AgsPad *pad, AgsChannel *channel);
99 
100   void (*resize_lines)(AgsPad *pad, GType line_type,
101 		       guint audio_channels, guint audio_channels_old);
102   void (*map_recall)(AgsPad *pad,
103 		     guint output_pad_start);
104   GList* (*find_port)(AgsPad *pad);
105 };
106 
107 GType ags_pad_get_type(void);
108 
109 void ags_pad_samplerate_changed(AgsPad *pad,
110 				guint samplerate, guint old_samplerate);
111 void ags_pad_buffer_size_changed(AgsPad *pad,
112 				 guint buffer_size, guint old_buffer_size);
113 void ags_pad_format_changed(AgsPad *pad,
114 			    guint format, guint old_format);
115 
116 void ags_pad_set_channel(AgsPad *pad, AgsChannel *channel);
117 
118 void ags_pad_resize_lines(AgsPad *pad, GType line_type,
119 			  guint audio_channels, guint audio_channels_old);
120 
121 void ags_pad_map_recall(AgsPad *pad,
122 			guint output_pad_start);
123 
124 GList* ags_pad_find_port(AgsPad *pad);
125 
126 void ags_pad_play(AgsPad *pad);
127 
128 AgsPad* ags_pad_new(AgsChannel *channel);
129 
130 G_END_DECLS
131 
132 #endif /*__AGS_PAD_H__*/
133