1 /* GSequencer - Advanced GTK Sequencer
2  * Copyright (C) 2005-2020 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_PRIORITY_H__
21 #define __AGS_PRIORITY_H__
22 
23 #include <glib.h>
24 #include <glib-object.h>
25 
26 G_BEGIN_DECLS
27 
28 #define AGS_TYPE_PRIORITY                (ags_priority_get_type ())
29 #define AGS_TYPE_PRIORITY_FLAGS          (ags_priority_flags_get_type())
30 #define AGS_PRIORITY(obj)                (G_TYPE_CHECK_INSTANCE_CAST((obj), AGS_TYPE_PRIORITY, AgsPriority))
31 #define AGS_PRIORITY_CLASS(class)        (G_TYPE_CHECK_CLASS_CAST((class), AGS_TYPE_PRIORITY, AgsPriorityClass))
32 #define AGS_IS_PRIORITY(obj)             (G_TYPE_CHECK_INSTANCE_TYPE((obj), AGS_TYPE_PRIORITY))
33 #define AGS_IS_PRIORITY_CLASS(class)     (G_TYPE_CHECK_CLASS_TYPE((class), AGS_TYPE_PRIORITY))
34 #define AGS_PRIORITY_GET_CLASS(obj)      (G_TYPE_INSTANCE_GET_CLASS((obj), AGS_TYPE_PRIORITY, AgsPriorityClass))
35 
36 #define AGS_PRIORITY_GET_OBJ_MUTEX(obj) (&(((AgsPriority *) obj)->obj_mutex))
37 
38 #define AGS_PRIORITY_DEFAULT_VERSION "2.4.2"
39 #define AGS_PRIORITY_DEFAULT_BUILD_ID "Mon Dec  2 08:15:02 UTC 2019"
40 
41 #define AGS_PRIORITY_RT_THREAD "rt-thread"
42 
43 #define AGS_PRIORITY_KEY_LIBAGS "libags"
44 
45 #define AGS_PRIORITY_KEY_SERVER_MAIN_LOOP "server-main-loop"
46 
47 #define AGS_PRIORITY_KEY_AUDIO_MAIN_LOOP "audio-main-loop"
48 #define AGS_PRIORITY_KEY_AUDIO "audio"
49 #define AGS_PRIORITY_KEY_OSC_SERVER_MAIN_LOOP "osc-server-main-loop"
50 
51 #define AGS_PRIORITY_KEY_GUI_MAIN_LOOP "gui-main-loop"
52 
53 typedef struct _AgsPriority AgsPriority;
54 typedef struct _AgsPriorityClass AgsPriorityClass;
55 
56 /**
57  * AgsPriorityFlags:
58  * @AGS_PRIORITY_CONNECTED: the priority was connected by calling #AgsConnectable::connect()
59  *
60  * Enum values to control the behavior or indicate internal state of #AgsPriority by
61  * enable/disable as flags.
62  */
63 typedef enum{
64   AGS_PRIORITY_CONNECTED    = 1,
65 }AgsPriorityFlags;
66 
67 struct _AgsPriority
68 {
69   GObject gobject;
70 
71   guint flags;
72 
73   GRecMutex obj_mutex;
74 
75   gchar *version;
76   gchar *build_id;
77 
78   GKeyFile *key_file;
79 };
80 
81 struct _AgsPriorityClass
82 {
83   GObjectClass gobject;
84 
85   void (*load_defaults)(AgsPriority *priority);
86 
87   void (*set_value)(AgsPriority *priority, gchar *group, gchar *key, gchar *value);
88   gchar* (*get_value)(AgsPriority *priority, gchar *group, gchar *key);
89 };
90 
91 GType ags_priority_get_type();
92 GType ags_priority_flags_get_type();
93 
94 void ags_priority_load_defaults(AgsPriority *priority);
95 void ags_priority_load_from_file(AgsPriority *priority, gchar *filename);
96 
97 void ags_priority_set_value(AgsPriority *priority, gchar *group, gchar *key, gchar *value);
98 gchar* ags_priority_get_value(AgsPriority *priority, gchar *group, gchar *key);
99 
100 AgsPriority* ags_priority_get_instance();
101 AgsPriority* ags_priority_new();
102 
103 G_END_DECLS
104 
105 #endif /*__AGS_PRIORITY_H__*/
106