2 * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
26 if ((ret = audio_in_create(44100, AUDIO_CHANNEL_STEREO ,AUDIO_SAMPLE_TYPE_S16_LE, &input)) == AUDIO_IO_ERROR_NONE) {
27 ret = audio_in_ignore_session(input);
29 printf ("ERROR, set session mix\n");
30 audio_in_destroy(input);
34 audio_in_prepare(input);
35 if ((ret = audio_in_get_buffer_size(input, &size)) == AUDIO_IO_ERROR_NONE) {
37 char *buffer = alloca(size);
38 if ((ret = audio_in_read(input, (void*)buffer, size)) > AUDIO_IO_ERROR_NONE) {
39 FILE* fp = fopen ("/root/test.raw", "wb+");
40 fwrite (buffer, size, sizeof(char), fp);
42 printf ("PASS, size=%d, ret=%d\n", size, ret);
45 printf ("FAIL, size=%d, ret=%d\n", size, ret);
48 audio_in_destroy(input);
54 int main(int argc, char ** argv)