summaryrefslogtreecommitdiffstats
path: root/sydney.h
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2007-05-13 01:24:01 +0000
committerLennart Poettering <lennart@poettering.net>2007-05-13 01:24:01 +0000
commit17e086aaa4960e3b4d779ad02d816e9452c0d458 (patch)
tree89b94e37b777db10b73f8e5e864a085fb1bbc9e0 /sydney.h
parent08ee90ea2e6ea839846c5670afa9d1a19c20ba78 (diff)
add missing accessors
git-svn-id: file:///home/lennart/svn/public/libsydney/trunk@8 9ba3c220-e4d3-45a2-8aa3-73fcc9aff6ce
Diffstat (limited to 'sydney.h')
-rw-r--r--sydney.h150
1 files changed, 81 insertions, 69 deletions
diff --git a/sydney.h b/sydney.h
index 7c67f86..5b3f009 100644
--- a/sydney.h
+++ b/sydney.h
@@ -18,11 +18,11 @@ async-signal safe.
/* Detect byte order, based on sys/param.h */
#if (defined(__BYTE_ORDER) && (__BYTE_ORDER == __LITTLE_ENDIAN)) || defined(WIN32)
-# define SA_LITTLE_ENDIAN
+# define SA_LITTLE_ENDIAN 1
# undef SA_BIG_ENDIAN
#elif (defined(__BYTE_ORDER) && (__BYTE_ORDER == __BIG_ENDIAN))
# undef SA_LITTLE_ENDIAN
-# define SA_BIG_ENDIAN
+# define SA_BIG_ENDIAN 1
#else
# error "Cannot determine byte order!"
#endif
@@ -84,9 +84,10 @@ typedef enum {
/** Device opening modes */
typedef enum {
- SA_MODE_RDONLY = 1,
- SA_MODE_WRONLY = 2,
- SA_MODE_RDWR = 3
+ SA_MODE_WRONLY = 1,
+ SA_MODE_RDONLY = 2,
+ SA_MODE_RDWR = 3,
+ _SA_MODE_MAX = 4,
} sa_mode_t;
/** Error codes */
@@ -103,7 +104,8 @@ typedef enum {
SA_ERROR_SYSTEM = -8,
SA_ERROR_NO_INIT = -9,
SA_ERROR_NO_META = -10,
- SA_ERROR_MAX = -11
+ SA_ERROR_NO_DATA = -11,
+ _SA_ERROR_MAX = -12
} sa_error_t;
/** Possible events for notifications */
@@ -112,7 +114,8 @@ typedef enum {
SA_NOTIFY_REQUEST_START,
SA_NOTIFY_VOLUME_CHANGED_IN,
SA_NOTIFY_VOLUME_CHANGED_OUT,
- SA_NOTIFY_DEVICE_CHANGED
+ SA_NOTIFY_DEVICE_CHANGED,
+ _SA_NOTIFY_MAX
} sa_notify_t;
/** Classes of events */
@@ -120,7 +123,8 @@ typedef enum {
SA_EVENT_REQUEST_IO,
SA_EVENT_INIT_THREAD,
SA_EVENT_NOTIFY,
- SA_EVENT_ERROR
+ SA_EVENT_ERROR,
+ _SA_EVENT_MAX
} sa_event_t;
/** List of sample position queries */
@@ -132,7 +136,7 @@ typedef enum {
SA_POSITION_READ_HARDWARE,
SA_POSITION_READ_SOFTWARE,
SA_POSITION_DUPLEX_DELAY,
- SA_POSITION_MAX
+ _SA_POSITION_MAX
} sa_position_t;
/* Channel positions */
@@ -191,7 +195,7 @@ typedef enum {
SA_CHANNEL_AUX29,
SA_CHANNEL_AUX30,
SA_CHANNEL_AUX31,
- SA_CHANNEL_MAX
+ _SA_CHANNEL_MAX
} sa_channel_t;
typedef enum {
@@ -199,11 +203,13 @@ typedef enum {
SA_STATE_RUNNING,
SA_STATE_STOPPED,
/* put more stuff */
+ _SA_STATE_MAX,
} sa_state_t;
typedef enum {
SA_XRUN_MODE_STOP,
- SA_XRUN_MODE_SPIN
+ SA_XRUN_MODE_SPIN,
+ _SA_XRUN_MODE_MAX
} sa_xrun_mode_t;
typedef enum {
@@ -225,138 +231,144 @@ typedef enum {
#define SA_META_XID "sydney.xid" /* X11 window id */
/** Main callback function */
-typedef int (*sa_event_callback_t)(sa_stream_t *dev, sa_event_t event);
+typedef int (*sa_event_callback_t)(sa_stream_t *s, sa_event_t event);
/** Create an opaque (e.g. AC3) codec stream */
-int sa_stream_create_opaque(sa_stream_t **dev, sa_mode_t mode, const char *codec);
+int sa_stream_create_opaque(sa_stream_t **s, sa_mode_t mode, const char *codec);
/** Normal way to open a PCM device */
-int sa_stream_create_pcm(sa_stream_t **dev, sa_mode_t mode, sa_pcm_format_t format, unsigned rate, unsigned nchannels);
+int sa_stream_create_pcm(sa_stream_t **s, sa_mode_t mode, sa_pcm_format_t format, unsigned rate, unsigned nchannels);
/** Initialise the device */
-int sa_stream_open(sa_stream_t *dev);
+int sa_stream_open(sa_stream_t *s);
/** Close/destroy everything */
-int sa_stream_destroy(sa_stream_t *dev);
+int sa_stream_destroy(sa_stream_t *s);
/* "Soft" params */
-int sa_stream_set_write_lower_watermark(sa_stream_t *dev, size_t size);
-int sa_stream_set_read_lower_watermark(sa_stream_t *dev, size_t size);
-
-int sa_stream_set_write_upper_watermark(sa_stream_t *dev, size_t size);
-int sa_stream_set_read_upper_watermark(sa_stream_t *dev, size_t size);
+int sa_stream_set_write_lower_watermark(sa_stream_t *s, size_t size);
+int sa_stream_set_read_lower_watermark(sa_stream_t *s, size_t size);
+int sa_stream_set_write_upper_watermark(sa_stream_t *s, size_t size);
+int sa_stream_set_read_upper_watermark(sa_stream_t *s, size_t size);
/** Set the mapping between channels and the loudspeakers */
-int sa_stream_set_channel_map(sa_stream_t *dev, const sa_channel_t map[]);
+int sa_stream_set_channel_map(sa_stream_t *s, const sa_channel_t map[]);
/** Whether xruns cause the card to reset */
-int sa_stream_set_xrun_mode(sa_stream_t *dev, sa_xrun_mode_t mode);
+int sa_stream_set_xrun_mode(sa_stream_t *s, sa_xrun_mode_t mode);
/** Set the device to non-interleaved mode */
-int sa_stream_set_ni(sa_stream_t *dev, int enable);
+int sa_stream_set_ni(sa_stream_t *s, int enable);
/** Require dynamic sample rate */
-int sa_stream_set_dynamic_rate(sa_stream_t *dev, int enable);
+int sa_stream_set_dynamic_rate(sa_stream_t *s, int enable);
/** Select driver */
-int sa_stream_set_driver(sa_stream_t *dev, const char *driver);
+int sa_stream_set_driver(sa_stream_t *s, const char *driver);
/** Start callback */
-int sa_stream_start_thread(sa_stream_t *dev, sa_event_callback_t *callback);
+int sa_stream_start_thread(sa_stream_t *s, sa_event_callback_t *callback);
/** Change the device connected to the stream */
-int sa_stream_change_device(sa_stream_t *dev, const char *device_name);
+int sa_stream_change_device(sa_stream_t *s, const char *device_name);
/** volume in hundreths of dB*/
-int sa_stream_change_input_volume(sa_stream_t *dev, const int vol[]);
+int sa_stream_change_input_volume(sa_stream_t *s, const int vol[]);
/** volume in hundreths of dB*/
-int sa_stream_change_output_volume(sa_stream_t *dev, const int vol[]);
+int sa_stream_change_output_volume(sa_stream_t *s, const int vol[]);
/** Change the sampling rate */
-int sa_stream_change_rate(sa_stream_t *dev, unsigned rate);
+int sa_stream_change_rate(sa_stream_t *s, unsigned rate);
/** Change some meta data that is attached to the stream */
-int sa_stream_change_meta_data(sa_stream_t *dev, const char *name, const void *data, size_t len);
+int sa_stream_change_meta_data(sa_stream_t *s, const char *name, const void *data, size_t size);
/** Associate opaque user data */
-int sa_stream_change_user_data(sa_stream_t *dev, void *value);
+int sa_stream_change_user_data(sa_stream_t *s, void *value);
/* Hardware-related. This is implementation-specific and hardware specific. */
-int sa_stream_adjust_rate(sa_stream_t *dev, sa_adjust_t direction);
-
-int sa_stream_adjust_nchannels(sa_stream_t *dev, sa_adjust_t direction);
-
-int sa_stream_adjust_pcm_format(sa_stream_t *dev, sa_adjust_t direction);
+int sa_stream_set_adjust_rate(sa_stream_t *s, sa_adjust_t direction);
+int sa_stream_set_adjust_nchannels(sa_stream_t *s, sa_adjust_t direction);
+int sa_stream_set_adjust_pcm_format(sa_stream_t *s, sa_adjust_t direction);
/* Query functions */
-/** Get current state of the audio device */
-int sa_stream_get_state(sa_stream_t *dev, sa_state_t *state);
-
-/** Get current sampling rate */
-int sa_stream_get_rate(sa_stream_t *dev, unsigned *rate);
+int sa_stream_get_mode(sa_stream_t *s, sa_mode_t *access_mode);
+int sa_stream_get_codec(sa_stream_t *s, const char **codec);
+int sa_stream_get_pcm_format(sa_stream_t *s, sa_pcm_format_t *format);
+int sa_stream_get_rate(sa_stream_t *s, unsigned *rate);
+int sa_stream_get_nchannels(sa_stream_t *s, int *nchannels);
+int sa_stream_get_user_data(sa_stream_t *s, void **value);
+int sa_stream_get_write_lower_watermark(sa_stream_t *s, size_t *size);
+int sa_stream_get_read_lower_watermark(sa_stream_t *s, size_t *size);
+int sa_stream_get_write_upper_watermark(sa_stream_t *s, size_t *size);
+int sa_stream_get_read_upper_watermark(sa_stream_t *s, size_t *size);
+int sa_stream_get_channel_map(sa_stream_t *s, const sa_channel_t *map[]);
+int sa_stream_get_xrun_mode(sa_stream_t *s, sa_xrun_mode_t *mode);
+int sa_stream_get_ni(sa_stream_t *s, int *enabled);
+int sa_stream_get_dynamic_rate(sa_stream_t *s, int *enabled);
+int sa_stream_get_driver(sa_stream_t *s, const char **driver);
+int sa_stream_get_device(sa_stream_t *s, const char **device_name);
+int sa_stream_get_input_volume(sa_stream_t *s, const int *vol[]);
+int sa_stream_get_output_volume(sa_stream_t *s, const int *vol[]);
+int sa_stream_get_meta_data(sa_stream_t *s, const char *name, const void **data, size_t *size);
+int sa_stream_get_adjust_rate(sa_stream_t *s, sa_adjust_t *direction);
+int sa_stream_get_adjust_nchannels(sa_stream_t *s, sa_adjust_t *direction);
+int sa_stream_get_adjust_pcm_format(sa_stream_t *s, sa_adjust_t *direction);
-/** Get number of channels */
-int sa_stream_get_nchannels(sa_stream_t *dev, int *nchannels);
-
-/** Get format being used */
-int sa_stream_get_pcm_format(sa_stream_t *dev, sa_pcm_format_t *format);
-
-/** Get opaque pointer associated to the device */
-int sa_stream_get_user_data(sa_stream_t *dev, void **value);
+/** Get current state of the audio device */
+int sa_stream_get_state(sa_stream_t *s, sa_state_t *state);
/** Obtain the error code */
-int sa_stream_get_event_error(sa_stream_t *dev, sa_error_t *error);
+int sa_stream_get_event_error(sa_stream_t *s, sa_error_t *error);
/** Obtain the notification code */
-int sa_stream_get_event_notify(sa_stream_t *dev, sa_notify_t *notify);
+int sa_stream_get_event_notify(sa_stream_t *s, sa_notify_t *notify);
/** sync/timing */
-int sa_stream_get_position(sa_stream_t *dev, sa_position_t position, int64_t *pos);
-
-
+int sa_stream_get_position(sa_stream_t *s, sa_position_t position, int64_t *pos);
/* Blocking IO calls */
/** Interleaved capture function */
-int sa_stream_read(sa_stream_t *dev, void *data, size_t nbytes);
+int sa_stream_read(sa_stream_t *s, void *data, size_t nbytes);
/** Interleaved playback function */
-int sa_stream_write(sa_stream_t *dev, const void *data, size_t nbytes);
+int sa_stream_write(sa_stream_t *s, const void *data, size_t nbytes);
/** Non-interleaved capture function */
-int sa_stream_read_ni(sa_stream_t *dev, unsigned channel, void *data, size_t nbytes);
+int sa_stream_read_ni(sa_stream_t *s, unsigned channel, void *data, size_t nbytes);
/** Non-interleaved playback function */
-int sa_stream_write_ni(sa_stream_t *dev, unsigned channel, const void *data, size_t nbytes);
+int sa_stream_write_ni(sa_stream_t *s, unsigned channel, const void *data, size_t nbytes);
/** Interleaved capture function with seek offset */
-int sa_stream_pread(sa_stream_t *dev, void *data, size_t nbytes, int64_t offset, sa_seek_t whence);
+int sa_stream_pread(sa_stream_t *s, void *data, size_t nbytes, int64_t offset, sa_seek_t whence);
/** Interleaved playback function with seek offset */
-int sa_stream_pwrite(sa_stream_t *dev, const void *data, size_t nbytes, int64_t offset, sa_seek_t whence);
+int sa_stream_pwrite(sa_stream_t *s, const void *data, size_t nbytes, int64_t offset, sa_seek_t whence);
/** Non-interleaved capture function with seek offset */
-int sa_stream_pread_ni(sa_stream_t *dev, unsigned channel, void *data, size_t nbytes, int64_t offset, sa_seek_t whence);
+int sa_stream_pread_ni(sa_stream_t *s, unsigned channel, void *data, size_t nbytes, int64_t offset, sa_seek_t whence);
/** Non-interleaved playback function with seek offset */
-int sa_stream_pwrite_ni(sa_stream_t *dev, unsigned channel, const void *data, size_t nbytes, int64_t offset, sa_seek_t whence);
+int sa_stream_pwrite_ni(sa_stream_t *s, unsigned channel, const void *data, size_t nbytes, int64_t offset, sa_seek_t whence);
/** Query how much can be read without blocking */
-int sa_stream_get_read_size(sa_stream_t *dev, size_t *size);
+int sa_stream_get_read_size(sa_stream_t *s, size_t *size);
/** Query how much can be written without blocking */
-int sa_stream_get_write_size(sa_stream_t *dev, size_t *size);
+int sa_stream_get_write_size(sa_stream_t *s, size_t *size);
/* Control/xrun */
/** Resume playing after a pause */
-int sa_stream_resume(sa_stream_t *dev);
+int sa_stream_resume(sa_stream_t *s);
/** Pause audio playback (do not empty the buffer) */
-int sa_stream_pause(sa_stream_t *dev);
+int sa_stream_pause(sa_stream_t *s);
/** Block until all audio has been played */
-int sa_stream_drain(sa_stream_t *dev);
+int sa_stream_drain(sa_stream_t *s);
/** Return a human readable error */
const char *sa_strerror(int code);