AUDIO_SAMPLE_TYPE_S16_LE, /**< Signed 16-bit audio samples */
AUDIO_SAMPLE_TYPE_S24_LE, /**< Signed 24-bit audio samples (Since 5.0) */
AUDIO_SAMPLE_TYPE_S24_32_LE, /**< Signed 24-bit (packed in 32-bit) audio samples (Since 5.0) */
+ AUDIO_SAMPLE_TYPE_S32_LE, /**< Signed 32-bit audio samples (Since 5.5) */
} audio_sample_type_e;
/**
* @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
*/
typedef enum {
- AUDIO_CHANNEL_MONO = 0x80, /**< 1 channel, mono */
- AUDIO_CHANNEL_STEREO, /**< 2 channel, stereo */
+ AUDIO_CHANNEL_MONO = 0x80, /**< 1 channel, mono */
+ AUDIO_CHANNEL_STEREO, /**< 2 channels, stereo */
+ AUDIO_CHANNEL_MULTI_3, /**< 3 channels (Since 5.5) */
+ AUDIO_CHANNEL_MULTI_4, /**< 4 channels (Since 5.5) */
+ AUDIO_CHANNEL_MULTI_5, /**< 5 channels (Since 5.5) */
+ AUDIO_CHANNEL_MULTI_6, /**< 6 channels (Since 5.5) */
+ AUDIO_CHANNEL_MULTI_7, /**< 7 channels (Since 5.5) */
+ AUDIO_CHANNEL_MULTI_8, /**< 8 channels (Since 5.5) */
} audio_channel_e;
/**
*
* @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
*
- * @remarks @a use audio_in_peek() to get audio in data inside callback, use audio_in_drop() after use of peeked data.
+ * @remarks Use audio_in_peek() to get audio in data inside callback, use audio_in_drop() after use of peeked data.
*
* @param[in] handle The handle to the audio input
* @param[in] nbytes The amount of available audio in data which can be peeked.
* @privilege %http://tizen.org/privilege/recorder
*
* @remarks @a input must be released using audio_in_destroy().
- *
- * @param[in] sample_rate The audio sample rate in 8000[Hz] ~ 48000[Hz] (Before 5.0), 8000[Hz] ~ 192000[Hz] (Since 5.0)
- * @param[in] channel The audio channel type (mono or stereo)
- * @param[in] type The type of audio sample (8- or 16-bit)
+ * If the channel count of the requested @a channel is different from the system's supported channel count, then channel remapping will be processed internally.
+ *
+ * @param[in] sample_rate The audio sample rate \n
+ * Before 5.0: 8000[Hz] ~ 48000[Hz] \n
+ * Since 5.0: 8000[Hz] ~ 192000[Hz]
+ * @param[in] channel The audio channel type \n
+ * Before 5.5: Mono or stereo \n
+ * Since 5.5: Mono, stereo or multi-channels
+ * @param[in] type The type of audio sample \n
+ * Before 5.0: 8 or 16-bit \n
+ * Since 5.0: 8, 16 or 24-bit \n
+ * Since 5.5: 8, 16, 24 or 32-bit
* @param[out] input An audio input handle is created on success
* @return @c 0 on success,
* otherwise a negative error value
*
* @since_tizen 3.0
*
- * @remarks @a the sound stream information includes audio routing and volume type.
+ * @remarks The sound stream information includes audio routing and volume type.
* For more details, you can refer to @ref CAPI_MEDIA_SOUND_MANAGER_MODULE
* System, Alarm, Notification, Emergency, Voice Information, Ringtone VOIP and Ringtone Call stream types are not supported in this API.
*
* @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
*
* @param[in] input The handle to the audio input
- * @param[out] sample_rate The audio sample rate in Hertz (8000 ~ 48000) (Before 5.0), (8000 ~ 192000) (Since 5.0)
+ * @param[out] sample_rate The audio sample rate \n
+ * Before 5.0: 8000[Hz] ~ 48000[Hz] \n
+ * Since 5.0: 8000[Hz] ~ 192000[Hz]
* @return @c 0 on success,
* otherwise a negative error value
* @retval #AUDIO_IO_ERROR_NONE Successful
/**
* @brief Gets the channel type of the audio input data stream.
*
- * @details The audio channel type defines whether the audio is mono or stereo.
- *
* @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
*
* @param[in] input The handle to the audio input
- * @param[out] channel The audio channel type
+ * @param[out] channel The audio channel type \n
+ * Before 5.5: Mono or stereo \n
+ * Since 5.5: Mono, stereo or multi-channels
* @return @c 0 on success,
* otherwise a negative error value
* @retval #AUDIO_IO_ERROR_NONE Successful
int audio_in_get_channel(audio_in_h input, audio_channel_e *channel);
/**
- * @brief Gets the sample audio format (8-bit or 16-bit) of the audio input data stream.
+ * @brief Gets the sample audio format of the audio input data stream.
*
* @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
*
* @param[in] input The handle to the audio input
- * @param[out] type The audio sample type
+ * @param[out] type The type of audio sample \n
+ * Before 5.0: 8 or 16-bit \n
+ * Since 5.0: 8, 16 or 24-bit \n
+ * Since 5.5: 8, 16, 24 or 32-bit
* @return @c 0 on success,
* otherwise a negative error value
* @retval #AUDIO_IO_ERROR_NONE Successful
*
* @details @a callback will be called when you can read a PCM data.
* It might cause dead lock if change the state of audio handle in callback.
- * (ex: audio_in_destroy, audio_in_prepare, audio_in_unprepare)
+ * (ex: audio_in_destroy(), audio_in_prepare(), audio_in_unprepare())
* Recommend to use as a VOIP only.
* Recommend not to hold callback too long.(it affects latency)
*
int audio_in_unset_stream_cb(audio_in_h input);
/**
- * @brief peek from audio in buffer
+ * @brief peeks from audio in buffer.
*
* @details This function works correctly only with read, write callback. Otherwise it won't operate as intended.
*
* @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
*
- * @remarks @a Works only in asynchronous(event) mode. This will just retrieve buffer pointer from audio in buffer. Drop after use.
+ * @remarks Works only in asynchronous(event) mode. This will just retrieve buffer pointer from audio in buffer. Drop after use.
*
* @param[in] input The handle to the audio input
* @param[out] buffer start buffer pointer of peeked audio in data
int audio_in_peek(audio_in_h input, const void **buffer, unsigned int *length);
/**
- * @brief drop peeked audio buffer.
+ * @brief Drops peeked audio buffer.
*
* @details This function works correctly only with read, write callback. Otherwise it won't operate as intended.
*
* @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
*
- * @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.
+ * @remarks 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.
*
* @param[in] input The handle to the audio input
* @return 0 on success, otherwise a negative error value
*
* @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
*
- * @remarks @a use audio_out_write() to write pcm data inside this callback.
+ * @remarks Use audio_out_write() to write pcm data inside this callback.
* @param[in] handle The handle to the audio output
* @param[in] nbytes The amount of audio in data which can be written.
* @param[in] user_data The user data passed from the callback registration function
*
* @remarks @a output must be released by audio_out_destroy().
* It is recommended to call audio_out_set_sound_stream_info() after this API.
+ * Multi-channel playback is not supported.
*
- * @param[in] sample_rate The audio sample rate in 8000[Hz] ~ 48000[Hz] (Before 5.0), 8000[Hz] ~ 192000[Hz] (Since 5.0)
+ * @param[in] sample_rate The audio sample rate \n
+ * Before 5.0: 8000[Hz] ~ 48000[Hz] \n
+ * Since 5.0: 8000[Hz] ~ 192000[Hz]
* @param[in] channel The audio channel type (mono or stereo)
- * @param[in] type The type of audio sample (8-bit or 16-bit)
+ * @param[in] type The type of audio sample \n
+ * Before 5.0: 8 or 16-bit \n
+ * Since 5.0: 8, 16 or 24-bit \n
+ * Since 5.5: 8, 16, 24 or 32-bit
* @param[out] output An audio output handle is created on success
* @return @c 0 on success,
* otherwise a negative error value
*
* @since_tizen 3.0
*
- * @remarks @a the sound stream information includes audio routing and volume type.
+ * @remarks The sound stream information includes audio routing and volume type.
* For more details, you can refer to @ref CAPI_MEDIA_SOUND_MANAGER_MODULE
* Voice Recognition and Loopback stream types are not supported in this API.
*
* @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
*
* @param[in] output The handle to the audio output
- * @param[out] sample_rate The audio sample rate in Hertz (8000 ~ 48000) (Before 5.0), (8000 ~ 192000) (Since 5.0)
+ * @param[out] sample_rate The audio sample rate \n
+ * Before 5.0: 8000[Hz] ~ 48000[Hz] \n
+ * Since 5.0: 8000[Hz] ~ 192000[Hz]
* @return @c 0 on success,
* otherwise a negative error value
* @retval #AUDIO_IO_ERROR_NONE Successful
/**
* @brief Gets the channel type of the audio output data stream.
*
- * @details The audio channel type defines whether the audio is mono or stereo.
- *
* @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
*
* @param[in] output The handle to the audio output
- * @param[out] channel The audio channel type
+ * @param[out] channel The audio channel type (mono or stereo)
* @return @c 0 on success,
* otherwise a negative error value
* @retval #AUDIO_IO_ERROR_NONE Successful
int audio_out_get_channel(audio_out_h output, audio_channel_e *channel);
/**
- * @brief Gets the sample audio format (8-bit or 16-bit) of the audio output data stream.
+ * @brief Gets the sample audio format of the audio output data stream.
*
* @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
*
* @param[in] output The handle to the audio output
- * @param[out] type The audio sample type
+ * @param[out] type The type of audio sample \n
+ * Before 5.0: 8 or 16-bit \n
+ * Since 5.0: 8, 16 or 24-bit \n
+ * Since 5.5: 8, 16, 24 or 32-bit
* @return @c 0 on success,
* otherwise a negative error value
* @retval #AUDIO_IO_ERROR_NONE Successful
*
* @details @a callback will be called when you can write a PCM data.
* It might cause dead lock if change the state of audio handle in callback.
- * (ex: audio_out_destroy, audio_out_prepare, audio_out_unprepare)
+ * (ex: audio_out_destroy(), audio_out_prepare(), audio_out_unprepare())
* Recommend to use as a VOIP only.
* Recommend not to hold callback too long.(it affects latency)
*
case AUDIO_CHANNEL_STEREO:
dst_channel = CAudioInfo::EChannel::CHANNEL_STEREO;
break;
+ case AUDIO_CHANNEL_MULTI_3:
+ dst_channel = CAudioInfo::EChannel::CHANNEL_MULTI_3;
+ break;
+ case AUDIO_CHANNEL_MULTI_4:
+ dst_channel = CAudioInfo::EChannel::CHANNEL_MULTI_4;
+ break;
+ case AUDIO_CHANNEL_MULTI_5:
+ dst_channel = CAudioInfo::EChannel::CHANNEL_MULTI_5;
+ break;
+ case AUDIO_CHANNEL_MULTI_6:
+ dst_channel = CAudioInfo::EChannel::CHANNEL_MULTI_6;
+ break;
+ case AUDIO_CHANNEL_MULTI_7:
+ dst_channel = CAudioInfo::EChannel::CHANNEL_MULTI_7;
+ break;
+ case AUDIO_CHANNEL_MULTI_8:
+ dst_channel = CAudioInfo::EChannel::CHANNEL_MULTI_8;
+ break;
default:
dst_channel = CAudioInfo::EChannel::CHANNEL_MONO;
break;
case CAudioInfo::EChannel::CHANNEL_STEREO:
dst_channel = AUDIO_CHANNEL_STEREO;
break;
+ case CAudioInfo::EChannel::CHANNEL_MULTI_3:
+ dst_channel = AUDIO_CHANNEL_MULTI_3;
+ break;
+ case CAudioInfo::EChannel::CHANNEL_MULTI_4:
+ dst_channel = AUDIO_CHANNEL_MULTI_4;
+ break;
+ case CAudioInfo::EChannel::CHANNEL_MULTI_5:
+ dst_channel = AUDIO_CHANNEL_MULTI_5;
+ break;
+ case CAudioInfo::EChannel::CHANNEL_MULTI_6:
+ dst_channel = AUDIO_CHANNEL_MULTI_6;
+ break;
+ case CAudioInfo::EChannel::CHANNEL_MULTI_7:
+ dst_channel = AUDIO_CHANNEL_MULTI_7;
+ break;
+ case CAudioInfo::EChannel::CHANNEL_MULTI_8:
+ dst_channel = AUDIO_CHANNEL_MULTI_8;
+ break;
default:
dst_channel = AUDIO_CHANNEL_MONO;
break;
case AUDIO_SAMPLE_TYPE_S24_32_LE:
dst_type = CAudioInfo::ESampleType::SAMPLE_TYPE_S24_32_LE;
break;
+ case AUDIO_SAMPLE_TYPE_S32_LE:
+ dst_type = CAudioInfo::ESampleType::SAMPLE_TYPE_S32_LE;
+ break;
default:
dst_type = CAudioInfo::ESampleType::SAMPLE_TYPE_U8;
break;
case CAudioInfo::ESampleType::SAMPLE_TYPE_S24_32_LE:
dst_type = AUDIO_SAMPLE_TYPE_S24_32_LE;
break;
+ case CAudioInfo::ESampleType::SAMPLE_TYPE_S32_LE:
+ dst_type = AUDIO_SAMPLE_TYPE_S32_LE;
+ break;
default:
dst_type = AUDIO_SAMPLE_TYPE_U8;
break;
return dst_state;
}
-static void __check_audio_param(int sample_rate, audio_channel_e channel, audio_sample_type_e type) {
- if (sample_rate < 0)
+static void __check_audio_param(int sample_rate, audio_channel_e channel, audio_sample_type_e type, bool is_output) {
+ if (sample_rate < static_cast<int>(CAudioInfo::MIN_SYSTEM_SAMPLERATE) ||
+ sample_rate > static_cast<int>(CAudioInfo::MAX_SYSTEM_SAMPLERATE))
THROW_ERROR_MSG_FORMAT(CAudioError::EError::ERROR_INVALID_ARGUMENT, "Invalid sample rate :%d", sample_rate);
- if (channel != AUDIO_CHANNEL_MONO && channel != AUDIO_CHANNEL_STEREO)
+ if (channel < AUDIO_CHANNEL_MONO ||
+ channel > ((is_output) ? AUDIO_CHANNEL_STEREO : AUDIO_CHANNEL_MULTI_8))
THROW_ERROR_MSG_FORMAT(CAudioError::EError::ERROR_INVALID_ARGUMENT, "Invalid channel :%d", channel);
- if (type != AUDIO_SAMPLE_TYPE_U8 &&
- type != AUDIO_SAMPLE_TYPE_S16_LE &&
- type != AUDIO_SAMPLE_TYPE_S24_LE &&
- type != AUDIO_SAMPLE_TYPE_S24_32_LE)
+ if (type < AUDIO_SAMPLE_TYPE_U8 ||
+ type > AUDIO_SAMPLE_TYPE_S32_LE)
THROW_ERROR_MSG_FORMAT(CAudioError::EError::ERROR_INVALID_ARGUMENT, "Invalid sample type :%d", type);
}
-static void __check_audio_param(int sample_rate, audio_channel_e channel, audio_sample_type_e type, sound_type_e sound_type) {
- __check_audio_param(sample_rate, channel, type);
-
- if (sound_type < SOUND_TYPE_SYSTEM || sound_type > SOUND_TYPE_VOICE)
- THROW_ERROR_MSG_FORMAT(CAudioError::EError::ERROR_INVALID_ARGUMENT, "Invalid sound type : %d", sound_type);
-}
-
static CAudioInfo __generate_audio_input_info(int sampleRate, audio_channel_e channel, audio_sample_type_e sample_type) {
CAudioInfo::EChannel dstChannel;
CAudioInfo::ESampleType dstSampleType;
"Parameters are NULL input:%p", input);
}
- __check_audio_param(sample_rate, channel, type);
+ __check_audio_param(sample_rate, channel, type, false);
AUDIO_IO_LOGD("samplerate:[%d] channel:[0x%x] sample_type:[0x%x]", sample_rate, channel, type);
THROW_ERROR_MSG_FORMAT(CAudioError::EError::ERROR_INVALID_ARGUMENT,
"Parameters are NULL output:%p", output);
- __check_audio_param(sample_rate, channel, type, SOUND_TYPE_SYSTEM /*default check */);
+ __check_audio_param(sample_rate, channel, type, true);
AUDIO_IO_LOGD("samplerate:[%d] channel:[0x%x] sample_type:[0x%x]", sample_rate, channel, type);
CAudioInfo audioInfo = __generate_audio_output_info(sample_rate, channel, type, SOUND_TYPE_MEDIA);