summaryrefslogtreecommitdiffstats
path: root/common.h
diff options
context:
space:
mode:
Diffstat (limited to 'common.h')
-rw-r--r--common.h58
1 files changed, 58 insertions, 0 deletions
diff --git a/common.h b/common.h
new file mode 100644
index 0000000..1500ef1
--- /dev/null
+++ b/common.h
@@ -0,0 +1,58 @@
+#ifndef foocommonh
+#define foocommonh
+
+#include "sydney.h"
+
+#define elementsof(x) (sizeof(x)/sizeof((x)[0]))
+
+struct sa_device {
+ sa_mode_t mode;
+
+ sa_pcm_format_t pcm_format;
+ unsigned rate;
+ unsigned nchannels;
+
+ char *codec;
+
+ char *client_name;
+ char *stream_name;
+
+ size_t read_lower_watermark;
+ size_t read_upper_watermark;
+ size_t write_lower_watermark;
+ size_t write_upper_watermark;
+
+ sa_channel_t *channel_map;
+
+ sa_xrun_mode_t xrun_mode;
+ int ni_enabled;
+ int dsr_enabled;
+
+ sa_event_callback_t event_callback;
+
+ char *device;
+ char *driver;
+
+ int input_volume;
+ int output_volume;
+
+ void *user_data;
+
+ sa_state_t state;
+
+ sa_adjust_t adjust_rate;
+ sa_adjust_t adjust_nchannels;
+ sa_adjust_t adjust_pcm_format;
+
+ sa_error_t error;
+ sa_notify_t notify;
+ sa_event_t event;
+};
+
+sa_device_t *device_alloc(size_t total);
+void device_free(sa_device_t *d);
+
+int device_alloc_pcm(sa_device_t **dev, size_t total, const char *client_name, sa_mode_t mode, sa_pcm_format_t format, unsigned rate, unsigned channels);
+int device_alloc_opaque(sa_device_t **dev, size_t total, const char *client_name, sa_mode_t mode, const char *codec);
+
+#endif