Beast - Music Synthesizer and Composer  0.11.1+10.g2da35
bsetype.hh
Go to the documentation of this file.
1  // Licensed GNU LGPL v2.1 or later: http://www.gnu.org/licenses/lgpl.html
2 #ifndef __BSE_TYPE_H__
3 #define __BSE_TYPE_H__
4 
5 #include <bse/bsedefs.hh>
6 
7 /* --- typedefs --- */
8 #define BSE_TYPE_PROCEDURE G_TYPE_MAKE_FUNDAMENTAL (G_TYPE_RESERVED_BSE_FIRST + 3)
9 
10 /* type macros
11  */
12 #define BSE_TYPE_IS_PROCEDURE(type) (G_TYPE_FUNDAMENTAL (type) == BSE_TYPE_PROCEDURE)
13 #define BSE_CLASS_NAME(class) (g_type_name (G_TYPE_FROM_CLASS (class)))
14 #define BSE_CLASS_TYPE(class) (G_TYPE_FROM_CLASS (class))
15 #define BSE_TYPE_IS_OBJECT(type) (g_type_is_a ((type), BSE_TYPE_OBJECT))
16 
17 /* --- extra types --- */
18 extern GType bse_type_id_packed_pointer;
19 #define BSE_TYPE_PACKED_POINTER (bse_type_id_packed_pointer)
20 
21 
22 /* --- prototypes --- */
23 void bse_type_init (void);
24 void bse_type_add_options (GType type,
25  const gchar *options);
26 const gchar* bse_type_get_options (GType type);
27 void bse_type_add_blurb (GType type,
28  const gchar *blurb,
29  const gchar *file,
30  guint line);
31 const gchar* bse_type_get_blurb (GType type);
32 const gchar* bse_type_get_file (GType type);
33 guint bse_type_get_line (GType type);
34 void bse_type_add_authors (GType type,
35  const gchar *authors);
36 const gchar* bse_type_get_authors (GType type);
37 void bse_type_add_license (GType type,
38  const gchar *license);
39 const gchar* bse_type_get_license (GType type);
40 GType bse_type_register_static (GType parent_type,
41  const gchar *type_name,
42  const gchar *type_blurb,
43  const gchar *file,
44  guint line,
45  const GTypeInfo *info);
46 GType bse_type_register_abstract (GType parent_type,
47  const gchar *type_name,
48  const gchar *type_blurb,
49  const gchar *file,
50  guint line,
51  const GTypeInfo *info);
52 GType bse_type_register_dynamic (GType parent_type,
53  const gchar *type_name,
54  GTypePlugin *plugin);
55 GType bse_type_register_loadable_boxed (BseExportNodeBoxed *bnode,
56  GTypePlugin *plugin);
57 void bse_type_reinit_boxed (BseExportNodeBoxed *bnode);
58 void bse_type_uninit_boxed (BseExportNodeBoxed *bnode);
59 
60 
61 /* --- implementation details --- */
62 
63 /* magic macros to define type initialization function within
64  * .c files. they identify builtin type functions for magic post
65  * processing and help resolving runtime type id retrival.
66  */
67 #define BSE_TYPE_ID(BseTypeName) (bse_type_builtin_id_##BseTypeName)
68 #ifdef BSE_COMPILATION
69 # define BSE_BUILTIN_PROTO(BseTypeName) GType bse_type_builtin_register_##BseTypeName (void)
70 # define BSE_BUILTIN_TYPE(BseTypeName) BSE_BUILTIN_PROTO (BseTypeName); BSE_BUILTIN_PROTO (BseTypeName)
71 # define BSE_DUMMY_TYPE(BseTypeName) BSE_BUILTIN_PROTO (BseTypeName); \
72  BSE_BUILTIN_PROTO (BseTypeName) { return 0; }
73 #endif /* BSE_COMPILATION */
74 
75 
76 /* --- customized pspec constructors --- */
77 GParamSpec* bse_param_spec_enum (const gchar *name,
78  const gchar *nick,
79  const gchar *blurb,
80  gint default_value, /* can always be 0 */
81  GType enum_type,
82  const gchar *hints);
83 
84 // == type initializers ==
85 void bse_type_register_enums ();
86 void bse_type_register_procedure_info (GTypeInfo *info);
87 void bse_type_register_object_info (GTypeInfo *info);
88 void bse_param_types_init ();
89 
90 /* -- auto generated type ids --- */
91 #include <bse/bsegentypes.h>
92 
93 
94 /* --- dynamic config --- */
95 #define BSE_GCONFIG(cfg) (bse_global_config->cfg)
96 extern BseGConfig *bse_global_config; /* from bsegconfig.[hc] */
97 
98 
99 /* --- provide IDL pspec initializers --- */
100 #define sfidl_pspec_Bool sfidl_pspec_SfiBool
101 #define sfidl_pspec_SfiBool(group, locfile, locline, name, nick, blurb, dflt, options) \
102  sfi_pspec_set_group (sfi_pspec_bool (name, nick, blurb, dflt, options), group)
103 #define sfidl_pspec_Bool_default(group, locfile, locline, name) \
104  sfi_pspec_set_group (sfi_pspec_bool (name, NULL, NULL, FALSE, SFI_PARAM_STANDARD), group)
105 #define sfidl_pspec_Trigger(group, locfile, locline, name, nick, blurb, options) \
106  sfi_pspec_set_group (sfi_pspec_bool (name, nick, blurb, FALSE, "trigger:skip-undo:" options), group)
107 #define sfidl_pspec_Int sfidl_pspec_SfiInt
108 #define sfidl_pspec_SfiInt(group, locfile, locline, name, nick, blurb, dflt, min, max, step, options) \
109  sfi_pspec_set_group (sfi_pspec_int (name, nick, blurb, dflt, min, max, step, options), group)
110 #define sfidl_pspec_Int_default(group, locfile, locline, name) \
111  sfi_pspec_set_group (sfi_pspec_int (name, NULL, NULL, 0, G_MININT, G_MAXINT, 256, SFI_PARAM_STANDARD), group)
112 #define sfidl_pspec_Num sfidl_pspec_SfiNum
113 #define sfidl_pspec_SfiNum(group, locfile, locline, name, nick, blurb, dflt, min, max, step, options) \
114  sfi_pspec_set_group (sfi_pspec_num (name, nick, blurb, dflt, min, max, step, options), group)
115 #define sfidl_pspec_Num_default(group, locfile, locline, name) \
116  sfi_pspec_set_group (sfi_pspec_num (name, NULL, NULL, 0, SFI_MINNUM, SFI_MAXNUM, 1000, SFI_PARAM_STANDARD), group)
117 #define sfidl_pspec_SfiUInt(group, locfile, locline, name, nick, blurb, dflt, options) \
118  sfi_pspec_set_group (sfi_pspec_int (name, nick, blurb, dflt, 0, G_MAXINT, 1, options), group)
119 #define sfidl_pspec_Real sfidl_pspec_SfiReal
120 #define sfidl_pspec_SfiReal(group, locfile, locline, name, nick, blurb, dflt, min, max, step, options) \
121  sfi_pspec_set_group (sfi_pspec_real (name, nick, blurb, dflt, min, max, step, options), group)
122 #define sfidl_pspec_Real_default(group, locfile, locline, name) \
123  sfi_pspec_set_group (sfi_pspec_real (name, NULL, NULL, 0, -SFI_MAXREAL, SFI_MAXREAL, 10, SFI_PARAM_STANDARD), group)
124 #define sfidl_pspec_Perc(group, locfile, locline, name, nick, blurb, dflt, options) \
125  sfi_pspec_set_group (sfi_pspec_real (name, nick, blurb, dflt, 0.0, 100.0, 5.0, "scale:" options), group)
126 #define sfidl_pspec_DBVolume(group, locfile, locline, name, nick, blurb, dfltdb, mindb, maxdb, options) \
127  sfi_pspec_set_group (sfi_pspec_real (name, nick, blurb, bse_db_to_factor (dfltdb), bse_db_to_factor (mindb), bse_db_to_factor (maxdb), \
128  bse_db_to_factor (MIN (0.5, ABS (maxdb - mindb) / 10.0)), "scale:db-volume:" options), group)
129 #define sfidl_pspec_Balance(group, locfile, locline, name, nick, blurb, dflt, options) \
130  sfi_pspec_set_group (sfi_pspec_real (name, nick, blurb, dflt, -100.0, +100.0, 5.0, "scale:" options), group)
131 #define sfidl_pspec_Note(group, locfile, locline, name, nick, blurb, dflt, options) \
132  sfi_pspec_set_group (sfi_pspec_note (name, nick, blurb, dflt, SFI_MIN_NOTE, SFI_MAX_NOTE, FALSE, options), group)
133 #define sfidl_pspec_Octave(group, locfile, locline, name, nick, blurb, dflt, options) \
134  sfi_pspec_set_group (sfi_pspec_int (name, nick, blurb, dflt, BSE_MIN_OCTAVE, BSE_MAX_OCTAVE, 4, options), group)
135 #define sfidl_pspec_Frequency(group, locfile, locline, name, nick, blurb, dflt, min, max, options) \
136  sfi_pspec_set_group (bse_param_spec_freq (name, nick, blurb, dflt, min, max, "scale:" options), group)
137 #define sfidl_pspec_Freq(group, locfile, locline, name, nick, blurb, dflt, options) \
138  sfidl_pspec_Frequency (group, locfile, locline, name, nick, blurb, dflt, BSE_MIN_OSC_FREQUENCY, BSE_MAX_OSC_FREQUENCY, options)
139 #define sfidl_pspec_Gain(group, locfile, locline, name, nick, blurb, dflt, min, max, step, options) \
140  sfi_pspec_set_group (sfi_pspec_real (name, nick, blurb, dflt, min, max, step, options), group)
141 #define sfidl_pspec_FineTune(group, locfile, locline, name, nick, blurb, options) \
142  sfi_pspec_set_group (sfi_pspec_int (name, nick, blurb, 0, BSE_MIN_FINE_TUNE, BSE_MAX_FINE_TUNE, 10, options), group)
143 #define sfidl_pspec_LogScale(group, locfile, locline, name, nick, blurb, dflt, min, max, step, center, base, n_steps, options) \
144  sfi_pspec_set_group (sfi_pspec_log_scale (name, nick, blurb, dflt, min, max, step, center, base, n_steps, "scale:" options), group)
145 #define sfidl_pspec_Choice(group, locfile, locline, name, nick, blurb, dval, options, cvalues) \
146  sfi_pspec_set_group (sfi_pspec_choice (name, nick, blurb, #dval, cvalues, SFI_PARAM_STANDARD), group)
147 #define sfidl_pspec_Choice_default(group, locfile, locline, name, cvalues) \
148  sfidl_pspec_Choice (group, locfile, locline, name, NULL, NULL, NULL, SFI_PARAM_STANDARD, cvalues)
149 #define sfidl_pspec_SfiString(group, locfile, locline, name, nick, blurb, dflt, options) \
150  sfi_pspec_set_group (sfi_pspec_string (name, nick, blurb, dflt, options), group)
151 #define sfidl_pspec_SfiString_default(group, locfile, locline, name) \
152  sfidl_pspec_SfiString (group, locfile, locline, name, NULL, NULL, NULL, SFI_PARAM_STANDARD)
153 #define sfidl_pspec_BBlock(group, locfile, locline, name, nick, blurb, options) \
154  sfi_pspec_set_group (sfi_pspec_bblock (name, nick, blurb, options), group)
155 #define sfidl_pspec_BBlock_default(group, locfile, locline, name) \
156  sfidl_pspec_BBlock (group, locfile, locline, name, NULL, NULL, SFI_PARAM_STANDARD)
157 #define sfidl_pspec_FBlock(group, locfile, locline, name, nick, blurb, options) \
158  sfi_pspec_set_group (sfi_pspec_fblock (name, nick, blurb, options), group)
159 #define sfidl_pspec_FBlock_default(group, locfile, locline, name) \
160  sfidl_pspec_FBlock (group, locfile, locline, name, NULL, NULL, SFI_PARAM_STANDARD)
161 #define sfidl_pspec_Rec(group, locfile, locline, name, nick, blurb, options) \
162  sfi_pspec_set_group (sfi_pspec_rec_generic (name, nick, blurb, options), group)
163 #define sfidl_pspec_Rec_default(group, locfile, locline, name, fields) \
164  sfidl_pspec_Rec (group, locfile, locline, name, NULL, NULL, SFI_PARAM_STANDARD)
165 #define sfidl_pspec_Record(group, locfile, locline, name, nick, blurb, options, fields) \
166  sfi_pspec_set_group (sfi_pspec_rec (name, nick, blurb, fields, options), group)
167 #define sfidl_pspec_Record_default(group, locfile, locline, name, fields) \
168  sfidl_pspec_Record (group, locfile, locline, name, NULL, NULL, SFI_PARAM_STANDARD, fields)
169 #define sfidl_pspec_Sequence(group, locfile, locline, name, nick, blurb, options, element) \
170  sfi_pspec_set_group (sfi_pspec_seq (name, nick, blurb, element, options), group)
171 #define sfidl_pspec_Sequence_default(group, locfile, locline, name, element) \
172  sfidl_pspec_Sequence (group, locfile, locline, name, NULL, NULL, SFI_PARAM_STANDARD, element)
173 #define sfidl_pspec_Object_default(group, locfile, locline, name) \
174  sfi_pspec_set_group (sfi_pspec_proxy (name, NULL, NULL, SFI_PARAM_STANDARD), group)
175 #define sfidl_pspec_Object(group, locfile, locline, name, nick, blurb, options) \
176  sfi_pspec_set_group (sfi_pspec_proxy (name, nick, blurb, options), group)
177 /* pspecs with GType */
178 #define sfidl_pspec_GEnum(group, locfile, locline, name, nick, blurb, dval, options, etype) \
179  sfi_pspec_set_group (bse_param_spec_genum (name, nick, blurb, etype, dval, options), group)
180 #define sfidl_pspec_GEnum_default(group, locfile, locline, name, etype) \
181  sfi_pspec_set_group (bse_param_spec_genum (name, NULL, NULL, etype, 0, SFI_PARAM_STANDARD), group)
182 #define sfidl_pspec_BoxedRec(group, locfile, locline, name, nick, blurb, options, rectype) \
183  sfi_pspec_set_group (bse_param_spec_boxed (name, nick, blurb, rectype, options), group)
184 #define sfidl_pspec_BoxedRec_default(group, locfile, locline, name, rectype) \
185  sfidl_pspec_BoxedRec (group, locfile, locline, name, NULL, NULL, SFI_PARAM_STANDARD, rectype)
186 #define sfidl_pspec_BoxedSeq(group, locfile, locline, name, nick, blurb, options, seqtype) \
187  sfi_pspec_set_group (bse_param_spec_boxed (name, nick, blurb, seqtype, options), group)
188 #define sfidl_pspec_BoxedSeq_default(group, locfile, locline, name, seqtype) \
189  sfidl_pspec_BoxedSeq (group, locfile, locline, name, NULL, NULL, SFI_PARAM_STANDARD, seqtype)
190 #define sfidl_pspec_TypedObject_default(group, locfile, locline, name, otype) \
191  sfi_pspec_set_group (bse_param_spec_object (name, NULL, NULL, otype, SFI_PARAM_STANDARD), group)
192 #define sfidl_pspec_TypedObject(group, locfile, locline, name, nick, blurb, options, otype) \
193  sfi_pspec_set_group (bse_param_spec_object (name, nick, blurb, otype, options), group)
194 
195 
196 #endif /* __BSE_TYPE_H__ */
void info(const char *format, const Args &...args)
Issue an informative printf-like message.
Definition: bcore.hh:135