aboutsummaryrefslogtreecommitdiff
path: root/wave.h
diff options
context:
space:
mode:
authorReiner Herrmann <reiner@reiner-h.de>2012-02-10 14:25:38 +0100
committerReiner Herrmann <reiner@reiner-h.de>2012-02-10 14:25:38 +0100
commita5d7e68af96d9b62821d8fd47f5039c5bae5d421 (patch)
treeab7d1a70312afb74dc7184d8b269b08f332f4b74 /wave.h
added original sam_player code
Diffstat (limited to 'wave.h')
-rw-r--r--wave.h31
1 files changed, 31 insertions, 0 deletions
diff --git a/wave.h b/wave.h
new file mode 100644
index 0000000..a28ff4e
--- /dev/null
+++ b/wave.h
@@ -0,0 +1,31 @@
+// wave.h
+
+#ifndef __WAVE_H__
+#define __WAVE_H__ 1
+
+#define WAVE_ERR_NONE 0
+#define WAVE_ERR_UNKNOWN_ERROR -1
+#define WAVE_ERR_RESOURCE_UNAVAILABLE -2
+#define WAVE_ERR_BAD_DEVICE_ID -3
+#define WAVE_ERR_DEVICE_DRIVER_UNAVAILABLE -4
+#define WAVE_ERR_OUT_OF_MEMORY -5
+#define WAVE_ERR_INVALID_WAVE -6
+#define WAVE_ERR_CANNOT_PLAY -7
+#define WAVE_ERR_INVALID_HANDLE -8
+#define WAVE_ERR_STILL_PLAYING -9
+
+typedef struct __wave
+{
+ int channels; // audio channels, mono, stereo, etc...
+ int samples_per_sec; // sample output frequency
+ int bits_per_sample; // 8 or 16
+ unsigned int frame_size; // ((bps + 7) / 8) * channels
+ unsigned int frame_count; // wave duration = (1 / frequency) * frame_count
+ const void *frame_data; // pointer to the buffer containing sample frames
+}wave_t;
+
+int wave_out(wave_t *wave);
+
+const char *wave_err_to_str(int err);
+
+#endif