diff options
Diffstat (limited to 'test-sine.c')
-rw-r--r-- | test-sine.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/test-sine.c b/test-sine.c new file mode 100644 index 0000000..ae9ac9e --- /dev/null +++ b/test-sine.c @@ -0,0 +1,27 @@ +#include <assert.h> + +#include "sydney.h" + +#define ASSERT_SUCCESS(x) assert(x == SA_SUCCESS) + +#define FREQ 440 + +int main(int argc, char *argv[]) { + + sa_device_t *dev; + float data[4] = { 0.0, 1.0, 0.0, -1.0 }; + int i; + + ASSERT_SUCCESS(sa_device_create_pcm(&dev, argv[0], SA_MODE_WRONLY, SA_PCM_FORMAT_FLOAT32_NE, FREQ * 4, 1)); + ASSERT_SUCCESS(sa_device_change_device(dev, "/dev/dsp1")); + ASSERT_SUCCESS(sa_device_open(dev)); + + for (i = 0; i < 10; i++) + ASSERT_SUCCESS(sa_device_write(dev, data, sizeof(data))); + + ASSERT_SUCCESS(sa_device_drain(dev)); + + ASSERT_SUCCESS(sa_device_destroy(dev)); + + return 0; +} |