*/
int audio_in_unprepare(audio_in_h input);
+/**
+ * @brief Flushes and discards buffered audio data from the input stream.
+ *
+ * @since_tizen 2.4
+ *
+ * @param[in] input The handle to the audio input
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #AUDIO_IO_ERROR_NONE Successful
+ * @retval #AUDIO_IO_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #AUDIO_IO_ERROR_NOT_SUPPORTED Not supported
+ * @retval #AUDIO_IO_ERROR_INVALID_STATE Invalid state
+ *
+ * @pre The state should be #AUDIO_IO_STATE_RUNNING or #AUDIO_IO_STATE_PAUSED.
+ */
+int audio_in_flush(audio_in_h input);
+
/**
* @brief Reads audio data from the audio input buffer.
*
* @param[in] input The handle to the audio input
* @param[out] buffer The PCM buffer address
* @param[in] length The length of the PCM data buffer (in bytes)
- * @return The number of read bytes on success,
+ * @return The number of read bytes on success,
* otherwise a negative error value
* @retval #AUDIO_IO_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #AUDIO_IO_ERROR_INVALID_BUFFER Invalid buffer pointer
*/
int audio_out_unprepare(audio_out_h output);
+/**
+ * @brief Drains buffered audio data from the output stream.
+ *
+ * @details This function waits until drains stream buffer completely. (e.g end of playback)
+ *
+ * @since_tizen 2.4
+ *
+ * @param[in] output The handle to the audio output
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #AUDIO_IO_ERROR_NONE Successful
+ * @retval #AUDIO_IO_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #AUDIO_IO_ERROR_INVALID_STATE Invalid state
+ *
+ * @pre The state should be #AUDIO_IO_STATE_RUNNING or #AUDIO_IO_STATE_PAUSED.
+ * @see audio_out_flush()
+ */
+int audio_out_drain(audio_out_h output);
+
+/**
+ * @brief Flushes and discards buffered audio data from the output stream.
+ *
+ * @since_tizen 2.4
+ *
+ * @param[in] output The handle to the audio output
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #AUDIO_IO_ERROR_NONE Successful
+ * @retval #AUDIO_IO_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #AUDIO_IO_ERROR_INVALID_STATE Invalid state
+ *
+ * @pre The state should be #AUDIO_IO_STATE_RUNNING or #AUDIO_IO_STATE_PAUSED.
+ * @see audio_out_drain()
+ */
+int audio_out_flush(audio_out_h output);
+
/**
* @brief Starts writing the audio data to the device.
*
* @param[in] output The handle to the audio output
* @param[in,out] buffer The PCM buffer address
* @param[in] length The length of the PCM buffer (in bytes)
- * @return The written data size on success,
+ * @return The written data size on success,
* otherwise a negative error value
* @retval #AUDIO_IO_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #AUDIO_IO_ERROR_INVALID_BUFFER Invalid buffer pointer
return AUDIO_IO_ERROR_NONE;
}
+int audio_in_flush(audio_in_h input)
+{
+ AUDIO_IO_NULL_ARG_CHECK(input);
+ audio_in_s *handle = (audio_in_s *) input;
+ int ret = MM_ERROR_NONE;
+
+ ret = mm_sound_pcm_capture_flush(handle->mm_handle);
+ if (ret != MM_ERROR_NONE) {
+ return __convert_audio_io_error_code(ret, (char*)__FUNCTION__);
+ }
+
+ LOGI("[%s] mm_sound_pcm_capture_flush() success",__FUNCTION__);
+ return AUDIO_IO_ERROR_NONE;
+}
+
int audio_in_read(audio_in_h input, void *buffer, unsigned int length )
{
AUDIO_IO_NULL_ARG_CHECK(input);
return AUDIO_IO_ERROR_NONE;
}
+int audio_out_drain(audio_out_h output)
+{
+ AUDIO_IO_NULL_ARG_CHECK(output);
+ audio_out_s *handle = (audio_out_s *) output;
+ int ret = MM_ERROR_NONE;
+
+ ret = mm_sound_pcm_play_drain(handle->mm_handle);
+ if (ret != MM_ERROR_NONE) {
+ return __convert_audio_io_error_code(ret, (char*)__FUNCTION__);
+ }
+
+ LOGI("[%s] mm_sound_pcm_play_drain() success",__FUNCTION__);
+ return AUDIO_IO_ERROR_NONE;
+}
+
+int audio_out_flush(audio_out_h output)
+{
+ AUDIO_IO_NULL_ARG_CHECK(output);
+ audio_out_s *handle = (audio_out_s *) output;
+ int ret = MM_ERROR_NONE;
+
+ ret = mm_sound_pcm_play_flush(handle->mm_handle);
+ if (ret != MM_ERROR_NONE) {
+ return __convert_audio_io_error_code(ret, (char*)__FUNCTION__);
+ }
+
+ LOGI("[%s] mm_sound_pcm_play_flush() success",__FUNCTION__);
+ return AUDIO_IO_ERROR_NONE;
+}
+
int audio_out_write(audio_out_h output, void* buffer, unsigned int length)
{
AUDIO_IO_NULL_ARG_CHECK(output);