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_SFZ_GROUP_H__
21 #define __AGS_SFZ_GROUP_H__
22 
23 #include <glib.h>
24 #include <glib-object.h>
25 
26 #include <ags/libags.h>
27 
28 G_BEGIN_DECLS
29 
30 #define AGS_TYPE_SFZ_GROUP                (ags_sfz_group_get_type())
31 #define AGS_SFZ_GROUP(obj)                (G_TYPE_CHECK_INSTANCE_CAST((obj), AGS_TYPE_SFZ_GROUP, AgsSFZGroup))
32 #define AGS_SFZ_GROUP_CLASS(class)        (G_TYPE_CHECK_CLASS_CAST((class), AGS_TYPE_SFZ_GROUP, AgsSFZGroupClass))
33 #define AGS_IS_SFZ_GROUP(obj)             (G_TYPE_CHECK_INSTANCE_TYPE ((obj), AGS_TYPE_SFZ_GROUP))
34 #define AGS_IS_SFZ_GROUP_CLASS(class)     (G_TYPE_CHECK_CLASS_TYPE ((class), AGS_TYPE_SFZ_GROUP))
35 #define AGS_SFZ_GROUP_GET_CLASS(obj)      (G_TYPE_INSTANCE_GET_CLASS ((obj), AGS_TYPE_SFZ_GROUP, AgsSFZGroupClass))
36 
37 #define AGS_SFZ_GROUP_GET_OBJ_MUTEX(obj) (&(((AgsSFZGroup *) obj)->obj_mutex))
38 
39 typedef struct _AgsSFZGroup AgsSFZGroup;
40 typedef struct _AgsSFZGroupClass AgsSFZGroupClass;
41 
42 /**
43  * AgsSFZGroupFlags:
44  * @AGS_SFZ_GROUP_ADDED_TO_REGISTRY: the sfz group was added to registry, see #AgsConnectable::add_to_registry()
45  * @AGS_SFZ_GROUP_CONNECTED: indicates the sfz group was connected by calling #AgsConnectable::connect()
46  *
47  * Enum values to control the behavior or indicate internal state of #AgsSFZGroup by
48  * enable/disable as flags.
49  */
50 typedef enum{
51   AGS_SFZ_GROUP_ADDED_TO_REGISTRY    = 1,
52   AGS_SFZ_GROUP_CONNECTED            = 1 <<  1,
53 }AgsSFZGroupFlags;
54 
55 struct _AgsSFZGroup
56 {
57   GObject gobject;
58 
59   guint flags;
60 
61   GRecMutex obj_mutex;
62 
63   AgsUUID *uuid;
64 
65   gint nth_group;
66 
67   GList *region;
68   GObject *sample;
69 
70   GHashTable *control;
71 };
72 
73 struct _AgsSFZGroupClass
74 {
75   GObjectClass gobject;
76 };
77 
78 GType ags_sfz_group_get_type();
79 
80 gboolean ags_sfz_group_test_flags(AgsSFZGroup *sfz_group, guint flags);
81 void ags_sfz_group_set_flags(AgsSFZGroup *sfz_group, guint flags);
82 void ags_sfz_group_unset_flags(AgsSFZGroup *sfz_group, guint flags);
83 
84 void ags_sfz_group_insert_control(AgsSFZGroup *sfz_group,
85 				  gchar *key,
86 				  gchar *value);
87 gchar* ags_sfz_group_lookup_control(AgsSFZGroup *sfz_group,
88 				    gchar *key);
89 
90 /* instantiate */
91 AgsSFZGroup* ags_sfz_group_new();
92 
93 G_END_DECLS
94 
95 #endif /*__AGS_SFZ_GROUP_H__*/
96