1 /* GSequencer - Advanced GTK Sequencer
2  * Copyright (C) 2005-2021 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_SOUNDCARD_EDITOR_H__
21 #define __AGS_SOUNDCARD_EDITOR_H__
22 
23 #include <glib.h>
24 #include <glib-object.h>
25 
26 #include <gtk/gtk.h>
27 
28 #include <ags/libags.h>
29 #include <ags/libags-audio.h>
30 #include <ags/libags-gui.h>
31 
32 G_BEGIN_DECLS
33 
34 #define AGS_TYPE_SOUNDCARD_EDITOR                (ags_soundcard_editor_get_type())
35 #define AGS_SOUNDCARD_EDITOR(obj)                (G_TYPE_CHECK_INSTANCE_CAST((obj), AGS_TYPE_SOUNDCARD_EDITOR, AgsSoundcardEditor))
36 #define AGS_SOUNDCARD_EDITOR_CLASS(class)        (G_TYPE_CHECK_CLASS_CAST((class), AGS_TYPE_SOUNDCARD_EDITOR, AgsSoundcardEditorClass))
37 #define AGS_IS_SOUNDCARD_EDITOR(obj)             (G_TYPE_CHECK_INSTANCE_TYPE ((obj), AGS_TYPE_SOUNDCARD_EDITOR))
38 #define AGS_IS_SOUNDCARD_EDITOR_CLASS(class)     (G_TYPE_CHECK_CLASS_TYPE ((class), AGS_TYPE_SOUNDCARD_EDITOR))
39 #define AGS_SOUNDCARD_EDITOR_GET_CLASS(obj)      (G_TYPE_INSTANCE_GET_CLASS ((obj), AGS_TYPE_SOUNDCARD_EDITOR, AgsSoundcardEditorClass))
40 
41 typedef struct _AgsSoundcardEditor AgsSoundcardEditor;
42 typedef struct _AgsSoundcardEditorClass AgsSoundcardEditorClass;
43 
44 typedef enum{
45   AGS_SOUNDCARD_EDITOR_CONNECTED     = 1,
46   AGS_SOUNDCARD_EDITOR_BLOCK_RESET   = 1 <<  1,
47   AGS_SOUNDCARD_EDITOR_BLOCK_BACKEND = 1 <<  2,
48   AGS_SOUNDCARD_EDITOR_BLOCK_CARD    = 1 <<  3,
49   AGS_SOUNDCARD_EDITOR_BLOCK_ADD     = 1 <<  4,
50   AGS_SOUNDCARD_EDITOR_BLOCK_LOAD    = 1 <<  5,
51 }AgsSoundcardEditorFlags;
52 
53 struct _AgsSoundcardEditor
54 {
55   GtkBox box;
56 
57   guint flags;
58 
59   GObject *soundcard;
60   GObject *soundcard_thread;
61 
62   GtkComboBoxText *backend;
63   GtkComboBoxText *card;
64 
65   GtkBox *port_hbox;
66   GtkButton *add_port;
67   GtkButton *remove_port;
68 
69   GtkComboBoxText *capability;
70 
71   GtkSpinButton *audio_channels;
72   GtkSpinButton *samplerate;
73   GtkSpinButton *buffer_size;
74   GtkComboBoxText *format;
75 
76   GtkCheckButton *use_cache;
77   GtkSpinButton *cache_buffer_size;
78 
79   GtkLabel *wasapi_share_mode_label;
80   GtkComboBoxText *wasapi_share_mode;
81 
82   GtkLabel *wasapi_buffer_size_label;
83   GtkSpinButton *wasapi_buffer_size;
84 
85   GtkButton *remove;
86 };
87 
88 struct _AgsSoundcardEditorClass
89 {
90   GtkBoxClass box;
91 };
92 
93 GType ags_soundcard_editor_get_type(void);
94 
95 void ags_soundcard_editor_add_port(AgsSoundcardEditor *soundcard_editor,
96 				   gchar *device);
97 void ags_soundcard_editor_remove_port(AgsSoundcardEditor *soundcard_editor,
98 				      gchar *device);
99 
100 void ags_soundcard_editor_add_soundcard(AgsSoundcardEditor *soundcard_editor,
101 					GObject *soundcard);
102 void ags_soundcard_editor_remove_soundcard(AgsSoundcardEditor *soundcard_editor,
103 					   GObject *soundcard);
104 
105 void ags_soundcard_editor_load_core_audio_card(AgsSoundcardEditor *soundcard_editor);
106 void ags_soundcard_editor_load_pulse_card(AgsSoundcardEditor *soundcard_editor);
107 void ags_soundcard_editor_load_jack_card(AgsSoundcardEditor *soundcard_editor);
108 void ags_soundcard_editor_load_wasapi_card(AgsSoundcardEditor *soundcard_editor);
109 void ags_soundcard_editor_load_alsa_card(AgsSoundcardEditor *soundcard_editor);
110 void ags_soundcard_editor_load_oss_card(AgsSoundcardEditor *soundcard_editor);
111 
112 void ags_soundcard_editor_show_wasapi_control(AgsSoundcardEditor *soundcard_editor);
113 void ags_soundcard_editor_hide_wasapi_control(AgsSoundcardEditor *soundcard_editor);
114 
115 AgsSoundcardEditor* ags_soundcard_editor_new();
116 
117 G_END_DECLS
118 
119 #endif /*__AGS_SOUNDCARD_EDITOR_H__*/
120