diff options
author | Jinkun Jang <jinkun.jang@samsung.com> | 2013-03-16 01:11:40 +0900 |
---|---|---|
committer | Jinkun Jang <jinkun.jang@samsung.com> | 2013-03-16 01:11:40 +0900 |
commit | 0c48e05d828d40f7a0f484f86a2de7da12046ba2 (patch) | |
tree | 8aef0c8c6e5dfb8f17a6bcf520bac6c8dfdc1d07 /test | |
parent | 5daceca0f6e8f383c6e761b6611411051ed5786f (diff) | |
download | audio-io-0c48e05d828d40f7a0f484f86a2de7da12046ba2.tar.gz audio-io-0c48e05d828d40f7a0f484f86a2de7da12046ba2.tar.bz2 audio-io-0c48e05d828d40f7a0f484f86a2de7da12046ba2.zip |
merge with master
Diffstat (limited to 'test')
-rwxr-xr-x | test/audio_io_test.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/test/audio_io_test.c b/test/audio_io_test.c index 2647c16..9aba129 100755 --- a/test/audio_io_test.c +++ b/test/audio_io_test.c @@ -21,6 +21,33 @@ int audio_io_test() { + int ret, size; + audio_in_h input; + if ((ret = audio_in_create(44100, AUDIO_CHANNEL_STEREO ,AUDIO_SAMPLE_TYPE_S16_LE, &input)) == AUDIO_IO_ERROR_NONE) { + ret = audio_in_ignore_session(input); + if (ret != 0) { + printf ("ERROR, set session mix\n"); + audio_in_destroy(input); + return 0; + } + + audio_in_prepare(input); + if ((ret = audio_in_get_buffer_size(input, &size)) == AUDIO_IO_ERROR_NONE) { + size = 500000; + char *buffer = alloca(size); + if ((ret = audio_in_read(input, (void*)buffer, size)) > AUDIO_IO_ERROR_NONE) { + FILE* fp = fopen ("/root/test.raw", "wb+"); + fwrite (buffer, size, sizeof(char), fp); + fclose (fp); + printf ("PASS, size=%d, ret=%d\n", size, ret); + } + else { + printf ("FAIL, size=%d, ret=%d\n", size, ret); + } + } + audio_in_destroy(input); + } + return 1; } |