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.
17 #ifndef __TIZEN_MEDIA_AUDIO_IO_H__
18 #define __TIZEN_MEDIA_AUDIO_IO_H__
21 #include <sound_manager.h>
22 #include <sys/types.h>
31 * @brief This file contains the Audio Input and Audio Output API.
35 * @addtogroup CAPI_MEDIA_AUDIO_IN_MODULE
40 * @brief The audio input handle.
43 typedef struct audio_in_s *audio_in_h;
50 * @addtogroup CAPI_MEDIA_AUDIO_OUT_MODULE
55 * @brief The audio output handle.
58 typedef struct audio_out_s *audio_out_h;
65 * @addtogroup CAPI_MEDIA_AUDIO_IO_MODULE
70 * @brief Enumeration for audio sample type with bit depth.
75 AUDIO_SAMPLE_TYPE_U8 = 0x70, /**< Unsigned 8-bit audio samples */
76 AUDIO_SAMPLE_TYPE_S16_LE, /**< Signed 16-bit audio samples */
77 } audio_sample_type_e;
80 * @brief Enumeration for audio channel.
84 AUDIO_CHANNEL_MONO = 0x80, /**< 1 channel, mono */
85 AUDIO_CHANNEL_STEREO, /**< 2 channel, stereo */
89 * @brief Enumeration for audio input and output error.
93 AUDIO_IO_ERROR_NONE = TIZEN_ERROR_NONE, /**< Successful */
94 AUDIO_IO_ERROR_OUT_OF_MEMORY = TIZEN_ERROR_OUT_OF_MEMORY, /**< Out of memory */
95 AUDIO_IO_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER, /**< Invalid parameter */
96 AUDIO_IO_ERROR_INVALID_OPERATION = TIZEN_ERROR_INVALID_OPERATION, /**< Invalid operation */
97 AUDIO_IO_ERROR_PERMISSION_DENIED = TIZEN_ERROR_PERMISSION_DENIED, /**< Device open error by security */
98 AUDIO_IO_ERROR_NOT_SUPPORTED = TIZEN_ERROR_NOT_SUPPORTED, /**< Not supported */
99 AUDIO_IO_ERROR_DEVICE_NOT_OPENED = TIZEN_ERROR_AUDIO_IO | 0x01, /**< Device open error */
100 AUDIO_IO_ERROR_DEVICE_NOT_CLOSED = TIZEN_ERROR_AUDIO_IO | 0x02, /**< Device close error */
101 AUDIO_IO_ERROR_INVALID_BUFFER = TIZEN_ERROR_AUDIO_IO | 0x03, /**< Invalid buffer pointer */
102 AUDIO_IO_ERROR_SOUND_POLICY = TIZEN_ERROR_AUDIO_IO | 0x04, /**< Sound policy error */
106 * @brief Enumeration for audio IO interrupted messages.
111 AUDIO_IO_INTERRUPTED_COMPLETED = 0, /**< Interrupt completed */
112 AUDIO_IO_INTERRUPTED_BY_MEDIA, /**< Interrupted by a media application */
113 AUDIO_IO_INTERRUPTED_BY_CALL, /**< Interrupted by an incoming call */
114 AUDIO_IO_INTERRUPTED_BY_EARJACK_UNPLUG, /**< Interrupted by unplugging headphones */
115 AUDIO_IO_INTERRUPTED_BY_RESOURCE_CONFLICT, /**< Interrupted by a resource conflict */
116 AUDIO_IO_INTERRUPTED_BY_ALARM, /**< Interrupted by an alarm */
117 AUDIO_IO_INTERRUPTED_BY_EMERGENCY, /**< Interrupted by an emergency */
118 AUDIO_IO_INTERRUPTED_BY_NOTIFICATION, /**< Interrupted by a notification */
119 } audio_io_interrupted_code_e;
122 * @brief Called when audio input or output is interrupted.
125 * @param[in] error_code The interrupted error code
126 * @param[in] user_data The user data passed from the callback registration function
128 * @see audio_in_set_interrupted_cb()
129 * @see audio_out_set_interrupted_cb()
130 * @see audio_in_unset_interrupted_cb()
131 * @see audio_out_unset_interrupted_cb()
133 typedef void (*audio_io_interrupted_cb)(audio_io_interrupted_code_e code, void *user_data);
140 * @addtogroup CAPI_MEDIA_AUDIO_IN_MODULE
149 * @brief Called when audio input data is available in asynchronous(event) mode.
153 * @remarks @a use audio_in_peek() to get audio in data inside callback, use audio_in_drop() after use of peeked data.
155 * @param[in] handle The handle to the audio input
156 * @param[in] nbytes The amount of available audio in data which can be peeked.
157 * @param[in] userdata The user data passed from the callback registration function
159 * @see audio_in_set_stream_cb()
161 typedef void (*audio_in_stream_cb)(audio_in_h handle, size_t nbytes, void *userdata);
164 * @brief Creates an audio device instance and returns an input handle to record PCM (pulse-code modulation) data.
168 * @privilege %http://tizen.org/privilege/recorder
170 * @details This function is used for audio input initialization.
172 * @remarks @a input must be released using audio_in_destroy().
174 * @param[in] sample_rate The audio sample rate in 8000[Hz] ~ 48000[Hz]
175 * @param[in] channel The audio channel type (mono or stereo)
176 * @param[in] type The type of audio sample (8- or 16-bit)
177 * @param[out] input An audio input handle is created on success
178 * @return @c 0 on success,
179 * otherwise a negative error value
180 * @retval #AUDIO_IO_ERROR_NONE Successful
181 * @retval #AUDIO_IO_ERROR_INVALID_PARAMETER Invalid parameter
182 * @retval #AUDIO_IO_ERROR_PERMISSION_DENIED Permission denied
183 * @retval #AUDIO_IO_ERROR_OUT_OF_MEMORY Out of memory
184 * @retval #AUDIO_IO_ERROR_DEVICE_NOT_OPENED Device not opened
185 * @retval #AUDIO_IO_ERROR_SOUND_POLICY Sound policy error
186 * @retval #AUDIO_IO_ERROR_NOT_SUPPORTED Not supported
187 * @see audio_in_destroy()
189 int audio_in_create(int sample_rate, audio_channel_e channel, audio_sample_type_e type, audio_in_h *input);
192 * @brief Creates an audio loopback device instance and returns an input handle to record PCM (pulse-code modulation) data.
196 * @privilege %http://tizen.org/privilege/recorder
198 * @details This function is used for audio loopback input initialization.
200 * @remarks @a input must be released using audio_in_destroy().
202 * @param[in] sample_rate The audio sample rate in 8000[Hz] ~ 48000[Hz]
203 * @param[in] channel The audio channel type, mono, or stereo
204 * @param[in] type The type of audio sample (8- or 16-bit)
205 * @param[out] input An audio input handle will be created, if successful
206 * @return @c 0 on success,
207 * otherwise a negative error value
208 * @retval #AUDIO_IO_ERROR_NONE Successful
209 * @retval #AUDIO_IO_ERROR_INVALID_PARAMETER Invalid parameter
210 * @retval #AUDIO_IO_ERROR_PERMISSION_DENIED Permission denied
211 * @retval #AUDIO_IO_ERROR_OUT_OF_MEMORY Out of memory
212 * @retval #AUDIO_IO_ERROR_DEVICE_NOT_OPENED Device not opened
213 * @retval #AUDIO_IO_ERROR_SOUND_POLICY Sound policy error
214 * @retval #AUDIO_IO_ERROR_NOT_SUPPORTED Not supported
215 * @see audio_in_destroy()
217 int audio_in_create_loopback(int sample_rate, audio_channel_e channel, audio_sample_type_e type , audio_in_h* input);
220 * @brief Releases the audio input handle and all its resources associated with an audio stream.
224 * @param[in] input The handle to the audio input to destroy
225 * @return @c 0 on success,
226 * otherwise a negative error value
227 * @retval #AUDIO_IO_ERROR_NONE Successful
228 * @retval #AUDIO_IO_ERROR_INVALID_PARAMETER Invalid parameter
229 * @retval #AUDIO_IO_ERROR_DEVICE_NOT_CLOSED Device not closed
230 * @retval #AUDIO_IO_ERROR_NOT_SUPPORTED Not supported
231 * @see audio_in_create()
233 int audio_in_destroy(audio_in_h input);
236 * @brief Prepares reading audio input by starting buffering of audio data from the device.
240 * @param[in] input The handle to the audio input
241 * @return @c 0 on success,
242 * otherwise a negative error value
243 * @retval #AUDIO_IO_ERROR_NONE Successful
244 * @retval #AUDIO_IO_ERROR_INVALID_PARAMETER Invalid parameter
245 * @retval #AUDIO_IO_ERROR_NOT_SUPPORTED Not supported
247 * @see audio_in_unprepare()
249 int audio_in_prepare(audio_in_h input);
252 * @brief Unprepares reading audio input by stopping buffering the audio data from the device.
256 * @param[in] input The handle to the audio input
257 * @return @c 0 on success,
258 * otherwise a negative error value
259 * @retval #AUDIO_IO_ERROR_NONE Successful
260 * @retval #AUDIO_IO_ERROR_INVALID_PARAMETER Invalid parameter
261 * @retval #AUDIO_IO_ERROR_NOT_SUPPORTED Not supported
262 * @see audio_in_prepare()
264 int audio_in_unprepare(audio_in_h input);
267 * @brief Reads audio data from the audio input buffer.
271 * @param[in] input The handle to the audio input
272 * @param[out] buffer The PCM buffer address
273 * @param[in] length The length of the PCM data buffer (in bytes)
274 * @return The number of read bytes on success,
275 * otherwise a negative error value
276 * @retval #AUDIO_IO_ERROR_INVALID_PARAMETER Invalid parameter
277 * @retval #AUDIO_IO_ERROR_INVALID_BUFFER Invalid buffer pointer
278 * @retval #AUDIO_IO_ERROR_SOUND_POLICY Sound policy error
279 * @retval #AUDIO_IO_ERROR_INVALID_OPERATION Invalid operation
280 * @retval #AUDIO_IO_ERROR_NOT_SUPPORTED Not supported
281 * @pre audio_in_start_recording().
283 int audio_in_read(audio_in_h input, void *buffer, unsigned int length);
286 * @brief Gets the size to be allocated for the audio input buffer.
290 * @param[in] input The handle to the audio input
291 * @param[out] size The buffer size (in bytes, the maximum size is 1 MB)
292 * @return @c 0 on success,
293 * otherwise a negative error value
294 * @retval #AUDIO_IO_ERROR_NONE Successful
295 * @retval #AUDIO_IO_ERROR_INVALID_PARAMETER Invalid parameter
296 * @retval #AUDIO_IO_ERROR_NOT_SUPPORTED Not supported
297 * @see audio_in_read()
299 int audio_in_get_buffer_size(audio_in_h input, int *size);
302 * @brief Gets the sample rate of the audio input data stream.
306 * @param[in] input The handle to the audio input
307 * @param[out] sample_rate The audio sample rate in Hertz (8000 ~ 48000)
308 * @return @c 0 on success,
309 * otherwise a negative error value
310 * @retval #AUDIO_IO_ERROR_NONE Successful
311 * @retval #AUDIO_IO_ERROR_INVALID_PARAMETER Invalid parameter
312 * @retval #AUDIO_IO_ERROR_NOT_SUPPORTED Not supported
314 int audio_in_get_sample_rate(audio_in_h input, int *sample_rate);
317 * @brief Gets the channel type of the audio input data stream.
321 * @details The audio channel type defines whether the audio is mono or stereo.
323 * @param[in] input The handle to the audio input
324 * @param[out] channel The audio channel type
325 * @return @c 0 on success,
326 * otherwise a negative error value
327 * @retval #AUDIO_IO_ERROR_NONE Successful
328 * @retval #AUDIO_IO_ERROR_INVALID_PARAMETER Invalid parameter
329 * @retval #AUDIO_IO_ERROR_NOT_SUPPORTED Not supported
331 int audio_in_get_channel(audio_in_h input, audio_channel_e *channel);
334 * @brief Gets the sample audio format (8-bit or 16-bit) of the audio input data stream.
338 * @param[in] input The handle to the audio input
339 * @param[out] type The audio sample type
340 * @return @c 0 on success,
341 * otherwise a negative error value
342 * @retval #AUDIO_IO_ERROR_NONE Successful
343 * @retval #AUDIO_IO_ERROR_INVALID_PARAMETER Invalid parameter
344 * @retval #AUDIO_IO_ERROR_NOT_SUPPORTED Not supported
346 int audio_in_get_sample_type(audio_in_h input, audio_sample_type_e *type);
349 * @brief Registers a callback function to be invoked when the audio input handle is interrupted or the interrupt is completed.
353 * @param[in] input The handle to the audio input
354 * @param[in] callback The callback function to register
355 * @param[in] user_data The user data to be passed to the callback function
356 * @return @c 0 on success,
357 * otherwise a negative error value
358 * @retval #AUDIO_IO_ERROR_NONE Successful
359 * @retval #AUDIO_IO_ERROR_INVALID_PARAMETER Invalid parameter
360 * @retval #AUDIO_IO_ERROR_INVALID_OPERATION Invalid operation
361 * @retval #AUDIO_IO_ERROR_NOT_SUPPORTED Not supported
362 * @post audio_io_interrupted_cb() will be invoked.
364 * @see audio_in_unset_interrupted_cb()
365 * @see audio_io_interrupted_cb()
367 int audio_in_set_interrupted_cb(audio_in_h input, audio_io_interrupted_cb callback, void *user_data);
370 * @brief Unregisters the callback function.
374 * @param[in] input The handle to the audio input
375 * @return @c 0 on success,
376 * otherwise a negative error value
377 * @retval #AUDIO_IO_ERROR_NONE Successful
378 * @retval #AUDIO_IO_ERROR_INVALID_PARAMETER Invalid parameter
379 * @retval #AUDIO_IO_ERROR_INVALID_OPERATION Invalid operation
380 * @retval #AUDIO_IO_ERROR_NOT_SUPPORTED Not supported
382 * @see audio_in_set_interrupted_cb()
384 int audio_in_unset_interrupted_cb(audio_in_h input);
387 * @brief Ignores session for input.
391 * @param[in] input The handle to the audio input
392 * @return @c 0 on success,
393 * otherwise a negative error value
394 * @retval #AUDIO_IO_ERROR_NONE Successful
395 * @retval #AUDIO_IO_ERROR_INVALID_PARAMETER Invalid parameter
396 * @retval #AUDIO_IO_ERROR_INVALID_OPERATION Invalid operation
397 * @retval #AUDIO_IO_ERROR_NOT_SUPPORTED Not supported
399 int audio_in_ignore_session(audio_in_h input);
402 * @brief Sets an asynchronous(event) callback function to handle recording PCM (pulse-code modulation) data.
406 * @details @a callback will be called when you can read a PCM data.
407 * It might cause dead lock if change the state of audio handle in callback.
408 * (ex: audio_in_destroy, audio_in_prepare, audio_in_unprepare)
409 * Recommend to use as a VOIP only.
410 * Recommend not to hold callback too long.(it affects latency)
412 * @remarks @a input must be created using audio_in_create().
414 * @param[in] input An audio input handle
415 * @param[in] callback notify stream callback when user can read data (#audio_in_stream_cb)
416 * @param[in] userdata user data to be retrieved when callback is called
417 * @return @c 0 on success,
418 * otherwise a negative error value
419 * @retval #AUDIO_IO_ERROR_NONE Successful
420 * @retval #AUDIO_IO_ERROR_INVALID_PARAMETER Invalid parameter
421 * @retval #AUDIO_IO_ERROR_OUT_OF_MEMORY Out of memory
422 * @retval #AUDIO_IO_ERROR_DEVICE_NOT_OPENED Device not opened
423 * @retval #AUDIO_IO_ERROR_SOUND_POLICY Sound policy error
424 * @retval #AUDIO_IO_ERROR_NOT_SUPPORTED Not supported
426 * @see audio_out_set_stream_cb()
428 int audio_in_set_stream_cb(audio_in_h input, audio_in_stream_cb callback, void* userdata);
431 * @brief Unregisters the callback function.
435 * @param[in] input The handle to the audio input
436 * @return @c 0 on success,
437 * otherwise a negative error value
438 * @retval #AUDIO_IO_ERROR_NONE Successful
439 * @retval #AUDIO_IO_ERROR_INVALID_PARAMETER Invalid parameter
440 * @retval #AUDIO_IO_ERROR_INVALID_OPERATION Invalid operation
441 * @retval #AUDIO_IO_ERROR_NOT_SUPPORTED Not supported
443 * @see audio_in_set_interrupted_cb()
445 int audio_in_unset_stream_cb(audio_in_h input);
448 * @brief peek from audio in buffer
452 * @details This function works correctly only with read, write callback. Otherwise it won't operate as intended.
454 * @remarks @a Works only in asynchronous(event) mode. This will just retrieve buffer pointer from audio in buffer. Drop after use.
456 * @param[in] input The handle to the audio input
457 * @param[out] buffer start buffer pointer of peeked audio in data
458 * @param[in,out] length amount of audio in data to be peeked
459 * @return @c 0 on success,
460 * otherwise a negative error value
461 * @retval #AUDIO_IO_ERROR_NONE Successful
462 * @retval #AUDIO_IO_ERROR_INVALID_PARAMETER Invalid parameter
463 * @retval #AUDIO_IO_ERROR_INVALID_OPERATION Invalid operation
464 * @retval #AUDIO_IO_ERROR_NOT_SUPPORTED Not supported
466 * @see audio_in_drop()
468 int audio_in_peek(audio_in_h input, const void **buffer, unsigned int *length);
471 * @brief drop peeked audio buffer.
473 * @details This function works correctly only with read, write callback. Otherwise it won't operate as intended.
477 * @remarks @a Works only in asynchronous(event) mode. This will remove audio in data from actual stream buffer. Use this if peeked data is not needed anymore.
479 * @param[in] input The handle to the audio input
480 * @return 0 on success, otherwise a negative error value
481 * @retval #AUDIO_IO_ERROR_NONE Successful
482 * @retval #AUDIO_IO_ERROR_INVALID_PARAMETER Invalid parameter
483 * @retval #AUDIO_IO_ERROR_INVALID_OPERATION Invalid operation
484 * @retval #AUDIO_IO_ERROR_NOT_SUPPORTED Not supported
486 * @see audio_in_peek()
488 int audio_in_drop(audio_in_h input);
501 * @addtogroup CAPI_MEDIA_AUDIO_OUT_MODULE
506 * @brief Called when audio out data can be written in asynchronous(event) mode.
510 * @remarks @a use audio_out_write() to write pcm data inside this callback.
511 * @param[in] handle The handle to the audio output
512 * @param[in] nbytes The amount of audio in data which can be written.
513 * @param[in] userdata The user data passed from the callback registration function
515 * @see audio_out_set_stream_cb()
517 typedef void (*audio_out_stream_cb)(audio_out_h handle, size_t nbytes, void *userdata);
520 * @brief Creates an audio device instance and returns an output handle to play PCM (pulse-code modulation) data.
524 * @details This function is used for audio output initialization.
526 * @remarks @a output must be released by audio_out_destroy().
528 * @param[in] sample_rate The audio sample rate in 8000[Hz] ~ 48000[Hz]
529 * @param[in] channel The audio channel type (mono or stereo)
530 * @param[in] type The type of audio sample (8- or 16-bit)
531 * @param[in] sound_type The type of sound (#sound_type_e)
532 * @param[out] output An audio output handle is created on success
533 * @return @c 0 on success,
534 * otherwise a negative error value
535 * @retval #AUDIO_IO_ERROR_NONE Successful
536 * @retval #AUDIO_IO_ERROR_INVALID_PARAMETER Invalid parameter
537 * @retval #AUDIO_IO_ERROR_OUT_OF_MEMORY Out of memory
538 * @retval #AUDIO_IO_ERROR_DEVICE_NOT_OPENED Device not opened
539 * @retval #AUDIO_IO_ERROR_SOUND_POLICY Sound policy error
541 * @see audio_out_destroy()
543 int audio_out_create(int sample_rate, audio_channel_e channel, audio_sample_type_e type, sound_type_e sound_type, audio_out_h *output);
546 * @brief Releases the audio output handle, along with all its resources.
550 * @param[in] output The handle to the audio output to destroy
551 * @return @c 0 on success,
552 * otherwise a negative error value
553 * @retval #AUDIO_IO_ERROR_NONE Successful
554 * @retval #AUDIO_IO_ERROR_INVALID_PARAMETER Invalid parameter
555 * @retval #AUDIO_IO_ERROR_OUT_OF_MEMORY Out of memory
556 * @retval #AUDIO_IO_ERROR_DEVICE_NOT_CLOSED Device not closed
558 * @see audio_out_create()
560 int audio_out_destroy(audio_out_h output);
563 * @brief Prepares playing audio output, this must be called before audio_out_write().
567 * @param[in] output The handle to the audio output
568 * @return @c 0 on success,
569 * otherwise a negative error value
570 * @retval #AUDIO_IO_ERROR_NONE Successful
571 * @retval #AUDIO_IO_ERROR_INVALID_PARAMETER Invalid parameter
573 * @see audio_out_unprepare()
575 int audio_out_prepare(audio_out_h output);
578 * @brief Unprepares playing audio output.
582 * @param[in] output The handle to the audio output
583 * @return @c 0 on success,
584 * otherwise a negative error value
585 * @retval #AUDIO_IO_ERROR_NONE Successful
586 * @retval #AUDIO_IO_ERROR_INVALID_PARAMETER Invalid parameter
588 * @see audio_out_prepare()
590 int audio_out_unprepare(audio_out_h output);
593 * @brief Starts writing the audio data to the device.
597 * @param[in] output The handle to the audio output
598 * @param[in,out] buffer The PCM buffer address
599 * @param[in] length The length of the PCM buffer (in bytes)
600 * @return The written data size on success,
601 * otherwise a negative error value
602 * @retval #AUDIO_IO_ERROR_INVALID_PARAMETER Invalid parameter
603 * @retval #AUDIO_IO_ERROR_INVALID_BUFFER Invalid buffer pointer
604 * @retval #AUDIO_IO_ERROR_SOUND_POLICY Sound policy error
606 int audio_out_write(audio_out_h output, void *buffer, unsigned int length);
609 * @brief Gets the size to be allocated for the audio output buffer.
613 * @param[in] output The handle to the audio output
614 * @param[out] size The suggested buffer size (in bytes, the maximum size is 1 MB)
615 * @return @c 0 on success,
616 * otherwise a negative error value
617 * @retval #AUDIO_IO_ERROR_NONE Successful
618 * @retval #AUDIO_IO_ERROR_INVALID_PARAMETER Invalid parameter
620 * @see audio_out_write()
622 int audio_out_get_buffer_size(audio_out_h output, int *size);
625 * @brief Gets the sample rate of the audio output data stream.
629 * @param[in] output The handle to the audio output
630 * @param[out] sample_rate The audio sample rate in Hertz (8000 ~ 48000)
631 * @return @c 0 on success,
632 * otherwise a negative error value
633 * @retval #AUDIO_IO_ERROR_NONE Successful
634 * @retval #AUDIO_IO_ERROR_INVALID_PARAMETER Invalid parameter
636 int audio_out_get_sample_rate(audio_out_h output, int *sample_rate);
639 * @brief Gets the channel type of the audio output data stream.
640 * @details The audio channel type defines whether the audio is mono or stereo.
644 * @param[in] output The handle to the audio output
645 * @param[out] channel The audio channel type
646 * @return @c 0 on success,
647 * otherwise a negative error value
648 * @retval #AUDIO_IO_ERROR_NONE Successful
649 * @retval #AUDIO_IO_ERROR_INVALID_PARAMETER Invalid parameter
651 int audio_out_get_channel(audio_out_h output, audio_channel_e *channel);
654 * @brief Gets the sample audio format (8-bit or 16-bit) of the audio output data stream.
658 * @param[in] output The handle to the audio output
659 * @param[out] type The audio sample type
660 * @return @c 0 on success,
661 * otherwise a negative error value
662 * @retval #AUDIO_IO_ERROR_NONE Successful
663 * @retval #AUDIO_IO_ERROR_INVALID_PARAMETER Invalid parameter
665 int audio_out_get_sample_type(audio_out_h output, audio_sample_type_e *type);
669 * @brief Gets the sound type supported by the audio output device.
673 * @param[in] output The handle to the audio output
674 * @param[out] type The sound type
675 * @return @c 0 on success,
676 * otherwise a negative error value
677 * @retval #AUDIO_IO_ERROR_NONE Successful
678 * @retval #AUDIO_IO_ERROR_INVALID_PARAMETER Invalid parameter
680 int audio_out_get_sound_type(audio_out_h output, sound_type_e *type);
683 * @brief Registers a callback function to be invoked when the audio output handle is interrupted or the interrupt is completed.
687 * @param[in] output The handle to the audio output
688 * @param[in] callback The callback function to register
689 * @param[in] user_data The user data to be passed to the callback function
690 * @return @c 0 on success,
691 * otherwise a negative error value
692 * @retval #AUDIO_IO_ERROR_NONE Successful
693 * @retval #AUDIO_IO_ERROR_INVALID_PARAMETER Invalid parameter
694 * @retval #AUDIO_IO_ERROR_INVALID_OPERATION Invalid operation
696 * @post audio_io_interrupted_cb() will be invoked.
697 * @see audio_out_unset_interrupted_cb()
698 * @see audio_io_interrupted_cb()
700 int audio_out_set_interrupted_cb(audio_out_h output, audio_io_interrupted_cb callback, void *user_data);
703 * @brief Unregisters the callback function.
707 * @param[in] output The handle to the audio output
708 * @return @c 0 on success,
709 * otherwise a negative error value
710 * @retval #AUDIO_IO_ERROR_NONE Successful
711 * @retval #AUDIO_IO_ERROR_INVALID_PARAMETER Invalid parameter
712 * @retval #AUDIO_IO_ERROR_INVALID_OPERATION Invalid operation
714 * @see audio_out_set_interrupted_cb()
716 int audio_out_unset_interrupted_cb(audio_out_h output);
719 * @brief Ignores session for output.
723 * @param[in] output The handle to the audio output
724 * @return @c 0 on success,
725 * otherwise a negative error value
726 * @retval #AUDIO_IO_ERROR_NONE Successful
727 * @retval #AUDIO_IO_ERROR_INVALID_PARAMETER Invalid parameter
728 * @retval #AUDIO_IO_ERROR_INVALID_OPERATION Invalid operation
730 int audio_out_ignore_session(audio_out_h output);
733 * @brief Sets an asynchronous(event) callback function to handle playing PCM (pulse-code modulation) data.
737 * @details @a callback will be called when you can write a PCM data.
738 * It might cause dead lock if change the state of audio handle in callback.
739 * (ex: audio_in_destroy, audio_in_prepare, audio_in_unprepare)
740 * Recommend to use as a VOIP only.
741 * Recommend not to hold callback too long.(it affects latency)
743 * @remarks @a output must be created using audio_out_create().
745 * @param[in] output An audio output handle
746 * @param[in] callback notify stream callback when user can write data (#audio_out_stream_cb)
747 * @param[in] userdata user data to be retrieved when callback is called
748 * @return 0 on success, otherwise a negative error value
749 * @retval #AUDIO_IO_ERROR_NONE Successful
750 * @retval #AUDIO_IO_ERROR_INVALID_PARAMETER Invalid parameter
751 * @retval #AUDIO_IO_ERROR_OUT_OF_MEMORY Out of memory
752 * @retval #AUDIO_IO_ERROR_DEVICE_NOT_OPENED Device not opened
753 * @retval #AUDIO_IO_ERROR_SOUND_POLICY Sound policy error
755 * @see audio_in_set_stream_cb()
757 int audio_out_set_stream_cb(audio_out_h output, audio_out_stream_cb callback, void* userdata);
760 * @brief Unregisters the callback function.
764 * @param[in] output The handle to the audio output
765 * @return 0 on success, otherwise a negative error value
766 * @retval #AUDIO_IO_ERROR_NONE Successful
767 * @retval #AUDIO_IO_ERROR_INVALID_PARAMETER Invalid parameter
768 * @retval #AUDIO_IO_ERROR_INVALID_OPERATION Invalid operation
770 * @see audio_out_set_stream_cb()
772 int audio_out_unset_stream_cb(audio_out_h output);
781 #endif /* __TIZEN_MEDIA_AUDIO_IO_H__ */