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 #include <ags/audio/ags_sound_provider.h>
21
22 void ags_sound_provider_class_init(AgsSoundProviderInterface *ginterface);
23
24 /**
25 * SECTION:ags_sound_provider
26 * @short_description: provide accoustics
27 * @title: AgsSoundProvider
28 * @section_id: AgsSoundProvider
29 * @include: ags/audio/ags_sound_provider.h
30 *
31 * The #AgsSoundProvider provides you the advanced audio capabilities.
32 */
33
34 GType
ags_sound_provider_get_type()35 ags_sound_provider_get_type()
36 {
37 static volatile gsize g_define_type_id__volatile = 0;
38
39 if(g_once_init_enter (&g_define_type_id__volatile)){
40 GType ags_type_sound_provider = 0;
41
42 ags_type_sound_provider = g_type_register_static_simple(G_TYPE_INTERFACE,
43 "AgsSoundProvider",
44 sizeof(AgsSoundProviderInterface),
45 (GClassInitFunc) ags_sound_provider_class_init,
46 0, NULL, 0);
47
48 g_once_init_leave(&g_define_type_id__volatile, ags_type_sound_provider);
49 }
50
51 return g_define_type_id__volatile;
52 }
53
54 void
ags_sound_provider_class_init(AgsSoundProviderInterface * ginterface)55 ags_sound_provider_class_init(AgsSoundProviderInterface *ginterface)
56 {
57 /* empty */
58 }
59
60 /**
61 * ags_sound_provider_set_default_soundcard:
62 * @sound_provider: the #AgsSoundProvider
63 * @soundcard: the #GObject implementing #AgsSoundcard
64 *
65 * Set default soundcard.
66 *
67 * Since: 3.0.0
68 */
69 void
ags_sound_provider_set_default_soundcard(AgsSoundProvider * sound_provider,GObject * soundcard)70 ags_sound_provider_set_default_soundcard(AgsSoundProvider *sound_provider,
71 GObject *soundcard)
72 {
73 AgsSoundProviderInterface *sound_provider_interface;
74
75 g_return_if_fail(AGS_IS_SOUND_PROVIDER(sound_provider));
76 sound_provider_interface = AGS_SOUND_PROVIDER_GET_INTERFACE(sound_provider);
77 g_return_if_fail(sound_provider_interface->set_default_soundcard);
78
79 sound_provider_interface->set_default_soundcard(sound_provider,
80 soundcard);
81 }
82
83 /**
84 * ags_sound_provider_get_default_soundcard:
85 * @sound_provider: the #AgsSoundProvider
86 *
87 * Get default soundcard thread.
88 *
89 * Returns: (transfer full): the #GObject implementing #AgsSoundcard
90 *
91 * Since: 3.0.0
92 */
93 GObject*
ags_sound_provider_get_default_soundcard(AgsSoundProvider * sound_provider)94 ags_sound_provider_get_default_soundcard(AgsSoundProvider *sound_provider)
95 {
96 AgsSoundProviderInterface *sound_provider_interface;
97
98 g_return_val_if_fail(AGS_IS_SOUND_PROVIDER(sound_provider), NULL);
99 sound_provider_interface = AGS_SOUND_PROVIDER_GET_INTERFACE(sound_provider);
100 g_return_val_if_fail(sound_provider_interface->get_default_soundcard, NULL);
101
102 return(sound_provider_interface->get_default_soundcard(sound_provider));
103 }
104
105 /**
106 * ags_sound_provider_set_default_soundcard_thread:
107 * @sound_provider: the #AgsSoundProvider
108 * @soundcard_thread: the default #AgsThread
109 *
110 * Set default soundcard thread.
111 *
112 * Since: 3.0.0
113 */
114 void
ags_sound_provider_set_default_soundcard_thread(AgsSoundProvider * sound_provider,GObject * soundcard_thread)115 ags_sound_provider_set_default_soundcard_thread(AgsSoundProvider *sound_provider,
116 GObject *soundcard_thread)
117 {
118 AgsSoundProviderInterface *sound_provider_interface;
119
120 g_return_if_fail(AGS_IS_SOUND_PROVIDER(sound_provider));
121 sound_provider_interface = AGS_SOUND_PROVIDER_GET_INTERFACE(sound_provider);
122 g_return_if_fail(sound_provider_interface->set_default_soundcard_thread);
123
124 sound_provider_interface->set_default_soundcard_thread(sound_provider,
125 soundcard_thread);
126 }
127
128 /**
129 * ags_sound_provider_get_default_soundcard_thread:
130 * @sound_provider: the #AgsSoundProvider
131 *
132 * Get default soundcard thread.
133 *
134 * Returns: (transfer full): the #AgsThread
135 *
136 * Since: 3.0.0
137 */
138 GObject*
ags_sound_provider_get_default_soundcard_thread(AgsSoundProvider * sound_provider)139 ags_sound_provider_get_default_soundcard_thread(AgsSoundProvider *sound_provider)
140 {
141 AgsSoundProviderInterface *sound_provider_interface;
142
143 g_return_val_if_fail(AGS_IS_SOUND_PROVIDER(sound_provider), NULL);
144 sound_provider_interface = AGS_SOUND_PROVIDER_GET_INTERFACE(sound_provider);
145 g_return_val_if_fail(sound_provider_interface->get_default_soundcard_thread, NULL);
146
147 return(sound_provider_interface->get_default_soundcard_thread(sound_provider));
148 }
149
150 /**
151 * ags_sound_provider_set_soundcard:
152 * @sound_provider: the #AgsSoundProvider
153 * @soundcard: (element-type GObject) (transfer full): a #GList-struct containing #AgsSoundcard
154 *
155 * Set soundcards.
156 *
157 * Since: 3.0.0
158 */
159 void
ags_sound_provider_set_soundcard(AgsSoundProvider * sound_provider,GList * soundcard)160 ags_sound_provider_set_soundcard(AgsSoundProvider *sound_provider,
161 GList *soundcard)
162 {
163 AgsSoundProviderInterface *sound_provider_interface;
164
165 g_return_if_fail(AGS_IS_SOUND_PROVIDER(sound_provider));
166 sound_provider_interface = AGS_SOUND_PROVIDER_GET_INTERFACE(sound_provider);
167 g_return_if_fail(sound_provider_interface->set_soundcard);
168
169 sound_provider_interface->set_soundcard(sound_provider,
170 soundcard);
171 }
172
173 /**
174 * ags_sound_provider_get_soundcard:
175 * @sound_provider: the #AgsSoundProvider
176 *
177 * Get soundcards.
178 *
179 * Returns: (element-type GObject) (transfer full): a #GList-struct containing #AgsSoundcard
180 *
181 * Since: 3.0.0
182 */
183 GList*
ags_sound_provider_get_soundcard(AgsSoundProvider * sound_provider)184 ags_sound_provider_get_soundcard(AgsSoundProvider *sound_provider)
185 {
186 AgsSoundProviderInterface *sound_provider_interface;
187
188 g_return_val_if_fail(AGS_IS_SOUND_PROVIDER(sound_provider), NULL);
189 sound_provider_interface = AGS_SOUND_PROVIDER_GET_INTERFACE(sound_provider);
190 g_return_val_if_fail(sound_provider_interface->get_soundcard, NULL);
191
192 return(sound_provider_interface->get_soundcard(sound_provider));
193 }
194
195 /**
196 * ags_sound_provider_set_sequencer:
197 * @sound_provider: the #AgsSoundProvider
198 * @sequencer: (element-type GObject) (transfer full): a #GList-struct containing #AgsSequencer
199 *
200 * Set sequencers.
201 *
202 * Since: 3.0.0
203 */
204 void
ags_sound_provider_set_sequencer(AgsSoundProvider * sound_provider,GList * sequencer)205 ags_sound_provider_set_sequencer(AgsSoundProvider *sound_provider,
206 GList *sequencer)
207 {
208 AgsSoundProviderInterface *sound_provider_interface;
209
210 g_return_if_fail(AGS_IS_SOUND_PROVIDER(sound_provider));
211 sound_provider_interface = AGS_SOUND_PROVIDER_GET_INTERFACE(sound_provider);
212 g_return_if_fail(sound_provider_interface->set_sequencer);
213
214 sound_provider_interface->set_sequencer(sound_provider,
215 sequencer);
216 }
217
218 /**
219 * ags_sound_provider_get_sequencer:
220 * @sound_provider: the #AgsSoundProvider
221 *
222 * Get sequencers.
223 *
224 * Returns: (element-type GObject) (transfer full): a #GList-struct containing #AgsSequencer
225 *
226 * Since: 3.0.0
227 */
228 GList*
ags_sound_provider_get_sequencer(AgsSoundProvider * sound_provider)229 ags_sound_provider_get_sequencer(AgsSoundProvider *sound_provider)
230 {
231 AgsSoundProviderInterface *sound_provider_interface;
232
233 g_return_val_if_fail(AGS_IS_SOUND_PROVIDER(sound_provider), NULL);
234 sound_provider_interface = AGS_SOUND_PROVIDER_GET_INTERFACE(sound_provider);
235 g_return_val_if_fail(sound_provider_interface->get_sequencer, NULL);
236
237 return(sound_provider_interface->get_sequencer(sound_provider));
238 }
239
240 /**
241 * ags_sound_provider_set_audio:
242 * @sound_provider: the #AgsSoundProvider
243 * @audio: (element-type AgsAudio.Audio) (transfer full): a #GList-struct containing #AgsAudio
244 *
245 * Set audio objects.
246 *
247 * Since: 3.0.0
248 */
249 void
ags_sound_provider_set_audio(AgsSoundProvider * sound_provider,GList * audio)250 ags_sound_provider_set_audio(AgsSoundProvider *sound_provider,
251 GList *audio)
252 {
253 AgsSoundProviderInterface *sound_provider_interface;
254
255 g_return_if_fail(AGS_IS_SOUND_PROVIDER(sound_provider));
256 sound_provider_interface = AGS_SOUND_PROVIDER_GET_INTERFACE(sound_provider);
257 g_return_if_fail(sound_provider_interface->set_audio);
258
259 sound_provider_interface->set_audio(sound_provider,
260 audio);
261 }
262
263 /**
264 * ags_sound_provider_get_audio:
265 * @sound_provider: the #AgsSoundProvider
266 *
267 * Get audio objects.
268 *
269 * Returns: (element-type AgsAudio.Audio) (transfer full): a #GList-struct containing #AgsAudio
270 *
271 * Since: 3.0.0
272 */
273 GList*
ags_sound_provider_get_audio(AgsSoundProvider * sound_provider)274 ags_sound_provider_get_audio(AgsSoundProvider *sound_provider)
275 {
276 AgsSoundProviderInterface *sound_provider_interface;
277
278 g_return_val_if_fail(AGS_IS_SOUND_PROVIDER(sound_provider), NULL);
279 sound_provider_interface = AGS_SOUND_PROVIDER_GET_INTERFACE(sound_provider);
280 g_return_val_if_fail(sound_provider_interface->get_audio, NULL);
281
282 return(sound_provider_interface->get_audio(sound_provider));
283 }
284
285 /**
286 * ags_sound_provider_set_sound_server:
287 * @sound_provider: the #AgsSoundProvider
288 * @sound_server: (element-type GObject) (transfer full): a #GList-struct containing #AgsSoundServer
289 *
290 * Get sound server.
291 *
292 * Since: 3.0.0
293 */
294 void
ags_sound_provider_set_sound_server(AgsSoundProvider * sound_provider,GList * sound_server)295 ags_sound_provider_set_sound_server(AgsSoundProvider *sound_provider,
296 GList *sound_server)
297 {
298 AgsSoundProviderInterface *sound_provider_interface;
299
300 g_return_if_fail(AGS_IS_SOUND_PROVIDER(sound_provider));
301 sound_provider_interface = AGS_SOUND_PROVIDER_GET_INTERFACE(sound_provider);
302 g_return_if_fail(sound_provider_interface->set_sound_server);
303
304 sound_provider_interface->set_sound_server(sound_provider,
305 sound_server);
306 }
307
308 /**
309 * ags_sound_provider_get_sound_server:
310 * @sound_provider: the #AgsSoundProvider
311 *
312 * Set sound server.
313 *
314 * Returns: (element-type GObject) (transfer full): a #GList-struct containing #AgsSoundServer
315 *
316 * Since: 3.0.0
317 */
318 GList*
ags_sound_provider_get_sound_server(AgsSoundProvider * sound_provider)319 ags_sound_provider_get_sound_server(AgsSoundProvider *sound_provider)
320 {
321 AgsSoundProviderInterface *sound_provider_interface;
322
323 g_return_val_if_fail(AGS_IS_SOUND_PROVIDER(sound_provider), NULL);
324 sound_provider_interface = AGS_SOUND_PROVIDER_GET_INTERFACE(sound_provider);
325 g_return_val_if_fail(sound_provider_interface->get_sound_server, NULL);
326
327 return(sound_provider_interface->get_sound_server(sound_provider));
328 }
329
330 /**
331 * ags_sound_provider_set_osc_server:
332 * @sound_provider: the #AgsSoundProvider
333 * @osc_server: (element-type GObject) (transfer full): a #GList-struct containing #AgsOscServer
334 *
335 * Set OSC server.
336 *
337 * Since: 3.0.0
338 */
339 void
ags_sound_provider_set_osc_server(AgsSoundProvider * sound_provider,GList * osc_server)340 ags_sound_provider_set_osc_server(AgsSoundProvider *sound_provider,
341 GList *osc_server)
342 {
343 AgsSoundProviderInterface *sound_provider_interface;
344
345 g_return_if_fail(AGS_IS_SOUND_PROVIDER(sound_provider));
346 sound_provider_interface = AGS_SOUND_PROVIDER_GET_INTERFACE(sound_provider);
347 g_return_if_fail(sound_provider_interface->set_osc_server);
348
349 sound_provider_interface->set_osc_server(sound_provider,
350 osc_server);
351 }
352
353 /**
354 * ags_sound_provider_get_osc_server:
355 * @sound_provider: the #AgsSoundProvider
356 *
357 * Set distributed manager.
358 *
359 * Returns: (element-type GObject) (transfer full): a #GList-struct containing #AgsOscServer
360 *
361 * Since: 3.0.0
362 */
363 GList*
ags_sound_provider_get_osc_server(AgsSoundProvider * sound_provider)364 ags_sound_provider_get_osc_server(AgsSoundProvider *sound_provider)
365 {
366 AgsSoundProviderInterface *sound_provider_interface;
367
368 g_return_val_if_fail(AGS_IS_SOUND_PROVIDER(sound_provider), NULL);
369 sound_provider_interface = AGS_SOUND_PROVIDER_GET_INTERFACE(sound_provider);
370 g_return_val_if_fail(sound_provider_interface->get_osc_server, NULL);
371
372 return(sound_provider_interface->get_osc_server(sound_provider));
373 }
374