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_RECALL_ID_H__
21 #define __AGS_RECALL_ID_H__
22 
23 #include <glib.h>
24 #include <glib-object.h>
25 
26 #include <ags/libags.h>
27 
28 #include <ags/audio/ags_sound_enums.h>
29 #include <ags/audio/ags_recycling_context.h>
30 
31 G_BEGIN_DECLS
32 
33 #define AGS_TYPE_RECALL_ID                (ags_recall_id_get_type ())
34 #define AGS_RECALL_ID(obj)                (G_TYPE_CHECK_INSTANCE_CAST ((obj), AGS_TYPE_RECALL_ID, AgsRecallID))
35 #define AGS_RECALL_ID_CLASS(class)        (G_TYPE_CHECK_CLASS_CAST ((class), AGS_TYPE_RECALL_ID, AgsRecallIDClass))
36 #define AGS_IS_RECALL_ID(obj)             (G_TYPE_CHECK_INSTANCE_TYPE ((obj), AGS_TYPE_RECALL_ID))
37 #define AGS_IS_RECALL_ID_CLASS(class)     (G_TYPE_CHECK_CLASS_TYPE ((class), AGS_TYPE_RECALL_ID))
38 #define AGS_RECALL_ID_GET_CLASS(obj)      (G_TYPE_INSTANCE_GET_CLASS ((obj), AGS_TYPE_RECALL_ID, AgsRecallIDClass))
39 
40 #define AGS_RECALL_ID_GET_OBJ_MUTEX(obj) (&(((AgsRecallID *) obj)->obj_mutex))
41 
42 typedef struct _AgsRecallID AgsRecallID;
43 typedef struct _AgsRecallIDClass AgsRecallIDClass;
44 
45 struct _AgsRecallID
46 {
47   GObject gobject;
48 
49   guint flags;
50   gint sound_scope;
51   guint staging_flags;
52   guint state_flags;
53 
54   GRecMutex obj_mutex;
55 
56   AgsRecyclingContext *recycling_context;
57 };
58 
59 struct _AgsRecallIDClass
60 {
61   GObjectClass gobject;
62 };
63 
64 GType ags_recall_id_get_type(void);
65 
66 /* scope */
67 void ags_recall_id_set_sound_scope(AgsRecallID *recall_id, gint sound_scope);
68 
69 gboolean ags_recall_id_check_sound_scope(AgsRecallID *recall_id, gint sound_scope);
70 
71 /* staging flags */
72 gboolean ags_recall_id_test_staging_flags(AgsRecallID *recall_id, guint staging_flags);
73 void ags_recall_id_set_staging_flags(AgsRecallID *recall_id, guint staging_flags);
74 void ags_recall_id_unset_staging_flags(AgsRecallID *recall_id, guint staging_flags);
75 
76 gboolean ags_recall_id_check_staging_flags(AgsRecallID *recall_id, guint staging_flags);
77 
78 /* state flags */
79 gboolean ags_recall_id_test_state_flags(AgsRecallID *recall_id, guint state_flags);
80 void ags_recall_id_set_state_flags(AgsRecallID *recall_id, guint state_flags);
81 void ags_recall_id_unset_state_flags(AgsRecallID *recall_id, guint state_flags);
82 
83 gboolean ags_recall_id_check_state_flags(AgsRecallID *recall_id, guint state_flags);
84 
85 /* properties */
86 AgsRecyclingContext* ags_recall_id_get_recycling_context(AgsRecallID *recall_id);
87 void ags_recall_id_set_recycling_context(AgsRecallID *recall_id, AgsRecyclingContext *recycling_context);
88 
89 /* query recycling context */
90 AgsRecallID* ags_recall_id_find_recycling_context(GList *recall_id,
91 						  AgsRecyclingContext *recycling_context);
92 AgsRecallID* ags_recall_id_find_parent_recycling_context(GList *recall_id,
93 							 AgsRecyclingContext *parent_recycling_context);
94 
95 /* instantiate */
96 AgsRecallID* ags_recall_id_new();
97 
98 G_END_DECLS
99 
100 #endif /*__AGS_RECALL_ID_H__*/
101