Beast - Music Synthesizer and Composer  0.11.1+10.g2da35
bsedevice.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_DEVICE_H__
3 #define __BSE_DEVICE_H__
4 
5 #include <bse/bseobject.hh>
6 
7 /* --- object type macros --- */
8 #define BSE_TYPE_DEVICE (BSE_TYPE_ID (BseDevice))
9 #define BSE_DEVICE(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), BSE_TYPE_DEVICE, BseDevice))
10 #define BSE_DEVICE_CLASS(class) (G_TYPE_CHECK_CLASS_CAST ((class), BSE_TYPE_DEVICE, BseDeviceClass))
11 #define BSE_IS_DEVICE(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), BSE_TYPE_DEVICE))
12 #define BSE_IS_DEVICE_CLASS(class) (G_TYPE_CHECK_CLASS_TYPE ((class), BSE_TYPE_DEVICE))
13 #define BSE_DEVICE_GET_CLASS(object) (G_TYPE_INSTANCE_GET_CLASS ((object), BSE_TYPE_DEVICE, BseDeviceClass))
14 /* flag tests */
15 #define BSE_DEVICE_OPEN(pdev) ((BSE_OBJECT_FLAGS (pdev) & BSE_DEVICE_FLAG_OPEN) != 0)
16 #define BSE_DEVICE_READABLE(pdev) ((BSE_OBJECT_FLAGS (pdev) & BSE_DEVICE_FLAG_READABLE) != 0)
17 #define BSE_DEVICE_WRITABLE(pdev) ((BSE_OBJECT_FLAGS (pdev) & BSE_DEVICE_FLAG_WRITABLE) != 0)
18 
19 
20 /* --- enums --- */
21 typedef enum /*< skip >*/
22 {
23  BSE_DEVICE_FLAG_OPEN = 1 << (BSE_OBJECT_FLAGS_USHIFT + 0),
24  BSE_DEVICE_FLAG_READABLE = 1 << (BSE_OBJECT_FLAGS_USHIFT + 1),
25  BSE_DEVICE_FLAG_WRITABLE = 1 << (BSE_OBJECT_FLAGS_USHIFT + 2)
26 } BseDeviceFlags;
27 #define BSE_DEVICE_FLAGS_USHIFT (BSE_OBJECT_FLAGS_USHIFT + 3)
28 
29 
30 /* --- BseDevice structs --- */
31 struct BseDevice : BseObject {
32  /* valid while BSE_DEVICE_OPEN() */
33  gchar *open_device_name;
34  gchar *open_device_args;
35 };
37  gint driver_rating;
38  const gchar *driver_name;
39  const gchar *driver_syntax;
40  const gchar *driver_blurb;
41  SfiRing* (*list_devices) (BseDevice *device);
42  Bse::Error (*open) (BseDevice *device,
43  gboolean require_readable,
44  gboolean require_writable,
45  guint n_args,
46  const gchar **args);
47  void (*post_open) (BseDevice *device);
48  void (*pre_close) (BseDevice *device);
49  void (*close) (BseDevice *device);
50 };
52  BseDevice *device;
53  gchar *device_args;
54  gchar *device_blurb;
55  gchar *device_group; /* usually NULL */
56  gchar *device_error; /* if device_name == NULL */
57 };
58 
59 /* --- prototypes --- */
60 void bse_device_class_setup (gpointer klass,
61  gint rating,
62  const gchar *name,
63  const gchar *syntax,
64  const gchar *blurb);
65 SfiRing* bse_device_list (BseDevice *device);
66 Bse::Error bse_device_open (BseDevice *device,
67  gboolean need_readable,
68  gboolean need_writable,
69  const gchar *arg_string);
70 void bse_device_set_opened (BseDevice *device,
71  const gchar *device_name,
72  gboolean readable,
73  gboolean writable);
74 void bse_device_close (BseDevice *device);
75 BseDeviceEntry* bse_device_entry_new (BseDevice *device,
76  gchar *orphan_args,
77  gchar *orphan_blurb);
78 BseDeviceEntry* bse_device_group_entry_new (BseDevice *device,
79  gchar *orphan_args,
80  gchar *orphan_group,
81  gchar *orphan_blurb);
82 BseDeviceEntry* bse_device_error_new (BseDevice *device,
83  gchar *orphan_error);
84 void bse_device_entry_free (BseDeviceEntry *entry);
85 void bse_device_entry_list_free (SfiRing *list);
86 SfiRing* bse_device_class_list (GType type,
87  void (*request_callback) (BseDevice *device,
88  gpointer data),
89  gpointer data);
90 void bse_device_dump_list (GType base_type,
91  const gchar *indent,
92  gboolean with_auto,
93  void (*request_callback) (BseDevice *device,
94  gpointer data),
95  gpointer data);
96 BseDevice* bse_device_open_best (GType base_type,
97  gboolean need_readable,
98  gboolean need_writable,
99  SfiRing *devices,
100  void (*request_callback) (BseDevice *device,
101  gpointer data),
102  gpointer data,
103  Bse::Error *errorp);
104 BseDevice* bse_device_open_auto (GType base_type,
105  gboolean need_readable,
106  gboolean need_writable,
107  void (*request_callback) (BseDevice *device,
108  gpointer data),
109  gpointer data,
110  Bse::Error *errorp);
111 
112 
113 #endif /* __BSE_DEVICE_H__ */
close
Definition: bseobject.hh:57
Definition: bseobject.hh:88
Definition: sfiring.hh:21
open
Definition: bsedevice.hh:31
Definition: bsedevice.hh:36
Definition: bsedevice.hh:51