};
enum EAudioType {
- /* Only Input */
+ /* Input Type */
AUDIO_IN_TYPE_MEDIA = 0,
- AUDIO_IN_TYPE_SYSTEM,
- AUDIO_IN_TYPE_ALARM,
- AUDIO_IN_TYPE_NOTIFICATION,
- AUDIO_IN_TYPE_EMERGENCY,
- AUDIO_IN_TYPE_VOICE_INFORMATION,
+ //AUDIO_IN_TYPE_SYSTEM,
+ //AUDIO_IN_TYPE_ALARM,
+ //AUDIO_IN_TYPE_NOTIFICATION,
+ //AUDIO_IN_TYPE_EMERGENCY,
+ //AUDIO_IN_TYPE_VOICE_INFORMATION,
AUDIO_IN_TYPE_VOICE_RECOGNITION,
- AUDIO_IN_TYPE_RINGTONE_VOIP,
+ //AUDIO_IN_TYPE_RINGTONE_VOIP,
AUDIO_IN_TYPE_VOIP,
- AUDIO_IN_TYPE_LOOPBACK, /**< only for loopback */
+ //AUDIO_IN_TYPE_RINGTONE_CALL,
+ //AUDIO_IN_TYPE_VOICE_CALL,
+ //AUDIO_IN_TYPE_VIDEO_CALL,
+ //AUDIO_IN_TYPE_RADIO,
+ AUDIO_IN_TYPE_LOOPBACK,
- /* Only Output */
+ /* Output Type */
AUDIO_OUT_TYPE_MEDIA,
AUDIO_OUT_TYPE_SYSTEM,
AUDIO_OUT_TYPE_ALARM,
AUDIO_OUT_TYPE_NOTIFICATION,
AUDIO_OUT_TYPE_EMERGENCY,
AUDIO_OUT_TYPE_VOICE_INFORMATION,
- AUDIO_OUT_TYPE_VOICE_RECOGNITION,
+ //AUDIO_OUT_TYPE_VOICE_RECOGNITION,
AUDIO_OUT_TYPE_RINGTONE_VOIP,
AUDIO_OUT_TYPE_VOIP,
+ AUDIO_OUT_TYPE_RINGTONE_CALL,
+ //AUDIO_OUT_TYPE_VOICE_CALL,
+ //AUDIO_OUT_TYPE_VIDEO_CALL,
+ //AUDIO_OUT_TYPE_RADIO,
+ //AUDIO_OUT_TYPE_LOOPBACK,
AUDIO_TYPE_MAX
};
int mAudioIndex;
const char *StreamTypeTable[AUDIO_TYPE_MAX] = {
- /* Only Input */
+ /* Input Type */
"media", /**< AUDIO_IN_TYPE_MEDIA */
- "system", /**< AUDIO_IN_TYPE_SYSTEM */
- "alarm", /**< AUDIO_IN_TYPE_ALARM */
- "notification", /**< AUDIO_IN_TYPE_NOTIFICATION */
- "emergency", /**< AUDIO_IN_TYPE_EMERGENCY */
- "voice-information", /**< AUDIO_IN_TYPE_VOICE_INFORMATION */
+ //"system", /**< AUDIO_IN_TYPE_SYSTEM */
+ //"alarm", /**< AUDIO_IN_TYPE_ALARM */
+ //"notification", /**< AUDIO_IN_TYPE_NOTIFICATION */
+ //"emergency", /**< AUDIO_IN_TYPE_EMERGENCY */
+ //"voice-information", /**< AUDIO_IN_TYPE_VOICE_INFORMATION */
"voice-recognition", /**< AUDIO_IN_TYPE_VOICE_RECOGNITION */
- "ringtone-voip", /**< AUDIO_IN_TYPE_RINGTONE_VOIP */
+ //"ringtone-voip", /**< AUDIO_IN_TYPE_RINGTONE_VOIP */
"voip", /**< AUDIO_IN_TYPE_VOIP */
- "loopback", /**< AUDIO_IN_TYPE_LOOPBACK */ /**< only for loopback */
+ //"ringtone-call", /**< AUDIO_IN_TYPE_RINGTONE_CALL */
+ //"call-voice", /**< AUDIO_IN_TYPE_VOICE_CALL */
+ //"call-video", /**< AUDIO_IN_TYPE_VIDEO_CALL */
+ //"radio", /**< AUDIO_IN_TYPE_RADIO */
+ "loopback", /**< AUDIO_IN_TYPE_LOOPBACK */
- /* Only Output */
+ /* Output Type */
"media", /**< AUDIO_OUT_TYPE_MEDIA */
"system", /**< AUDIO_OUT_TYPE_SYSTEM */
"alarm", /**< AUDIO_OUT_TYPE_ALARM */
"notification", /**< AUDIO_OUT_TYPE_NOTIFICATION */
"emergency", /**< AUDIO_OUT_TYPE_EMERGENCY */
"voice-information", /**< AUDIO_OUT_TYPE_VOICE_INFORMATION */
- "voice-recognition", /**< AUDIO_OUT_TYPE_VOICE_RECOGNITION */
+ //"voice-recognition", /**< AUDIO_OUT_TYPE_VOICE_RECOGNITION */
"ringtone-voip", /**< AUDIO_OUT_TYPE_RINGTONE_VOIP */
"voip", /**< AUDIO_OUT_TYPE_VOIP */
+ "ringtone-call", /**< AUDIO_OUT_TYPE_RINGTONE_CALL */
+ //"call-voice", /**< AUDIO_OUT_TYPE_VOICE_CALL */
+ //"call-video", /**< AUDIO_OUT_TYPE_VIDEO_CALL */
+ //"radio", /**< AUDIO_OUT_TYPE_RADIO */
+ //"loopback", /**< AUDIO_OUT_TYPE_LOOPBACK */
};
public:
int getAudioIndex();
void setAudioIndex(int AudioIndex);
void convertAudioType2StreamType (CAudioInfo::EAudioType audioType, char **streamType);
- void convertStreamType2AudioType (char *streamType, CAudioInfo::EAudioType *audioType);
+ void convertInputStreamType2AudioType (char *streamType, CAudioInfo::EAudioType *audioType);
+ void convertOutputStreamType2AudioType (char *streamType, CAudioInfo::EAudioType *audioType);
};
} /* namespace tizen_media_audio */
case CAudioError::ERROR_NONE:
ret = AUDIO_IO_ERROR_NONE;
break;
-
case CAudioError::ERROR_INVALID_ARGUMENT:
case CAudioError::ERROR_INVALID_HANDLE:
case CAudioError::ERROR_INVALID_SAMPLERATE:
case CAudioError::ERROR_INVALID_FORMAT:
ret = AUDIO_IO_ERROR_INVALID_PARAMETER;
break;
-
case CAudioError::ERROR_DEVICE_NOT_OPENED:
ret = AUDIO_IO_ERROR_DEVICE_NOT_OPENED;
break;
-
case CAudioError::ERROR_DEVICE_NOT_CLOSED:
ret = AUDIO_IO_ERROR_DEVICE_NOT_CLOSED;
break;
-
case CAudioError::ERROR_PERMISSION_DENIED:
ret = AUDIO_IO_ERROR_PERMISSION_DENIED;
break;
-
case CAudioError::ERROR_NOT_SUPPORTED:
ret = AUDIO_IO_ERROR_NOT_SUPPORTED;
break;
-
+ case CAudioError::ERROR_NOT_SUPPORTED_TYPE:
+ ret = AUDIO_IO_ERROR_NOT_SUPPORTED_TYPE;
+ break;
case CAudioError::ERROR_MAX:
case CAudioError::ERROR_INTERNAL_OPERATION:
case CAudioError::ERROR_NOT_INITIALIZED:
case CAudioError::ERROR_INVALID_OPERATION:
ret = AUDIO_IO_ERROR_INVALID_OPERATION;
break;
-
case CAudioError::ERROR_OUT_OF_MEMORY:
case CAudioError::ERROR_INVALID_POINTER:
ret = AUDIO_IO_ERROR_INVALID_BUFFER;
break;
-
case CAudioError::ERROR_POLICY_BLOCKED:
case CAudioError::ERROR_POLICY_INTERRUPTED:
case CAudioError::ERROR_POLICY_DUPLICATED:
ret = AUDIO_IO_ERROR_SOUND_POLICY;
break;
}
- return ret;
+ return ret;
}
static void _convert_channel_2_audio_info_channel(const audio_channel_e& src_channel, CAudioInfo::EChannel& dst_channel) {
static void _convert_sound_type_2_audio_info_audio_type(const sound_type_e& src_type, CAudioInfo::EAudioType& dst_type) {
switch (src_type) {
- case SOUND_TYPE_SYSTEM:
- dst_type = CAudioInfo::AUDIO_OUT_TYPE_SYSTEM;
- break;
- case SOUND_TYPE_NOTIFICATION:
- dst_type = CAudioInfo::AUDIO_OUT_TYPE_NOTIFICATION;
- break;
- case SOUND_TYPE_ALARM:
- dst_type = CAudioInfo::AUDIO_OUT_TYPE_ALARM;
- break;
- case SOUND_TYPE_RINGTONE:
- dst_type = CAudioInfo::AUDIO_OUT_TYPE_RINGTONE_VOIP;
- break;
- case SOUND_TYPE_MEDIA:
- dst_type = CAudioInfo::AUDIO_OUT_TYPE_MEDIA;
- break;
- case SOUND_TYPE_CALL:
- dst_type = CAudioInfo::AUDIO_OUT_TYPE_SYSTEM;
- break;
- case SOUND_TYPE_VOIP:
- dst_type = CAudioInfo::AUDIO_OUT_TYPE_VOIP;
- break;
- case SOUND_TYPE_VOICE:
- dst_type = CAudioInfo::AUDIO_OUT_TYPE_VOICE_INFORMATION;
- break;
- default:
- dst_type = CAudioInfo::AUDIO_OUT_TYPE_MEDIA;
- break;
- }
+ case SOUND_TYPE_SYSTEM:
+ dst_type = CAudioInfo::AUDIO_OUT_TYPE_SYSTEM;
+ break;
+ case SOUND_TYPE_NOTIFICATION:
+ dst_type = CAudioInfo::AUDIO_OUT_TYPE_NOTIFICATION;
+ break;
+ case SOUND_TYPE_ALARM:
+ dst_type = CAudioInfo::AUDIO_OUT_TYPE_ALARM;
+ break;
+ case SOUND_TYPE_RINGTONE:
+ dst_type = CAudioInfo::AUDIO_OUT_TYPE_RINGTONE_VOIP;
+ break;
+ case SOUND_TYPE_MEDIA:
+ dst_type = CAudioInfo::AUDIO_OUT_TYPE_MEDIA;
+ break;
+ case SOUND_TYPE_CALL:
+ dst_type = CAudioInfo::AUDIO_OUT_TYPE_SYSTEM;
+ break;
+ case SOUND_TYPE_VOIP:
+ dst_type = CAudioInfo::AUDIO_OUT_TYPE_VOIP;
+ break;
+ case SOUND_TYPE_VOICE:
+ dst_type = CAudioInfo::AUDIO_OUT_TYPE_VOICE_INFORMATION;
+ break;
+ default:
+ dst_type = CAudioInfo::AUDIO_OUT_TYPE_MEDIA;
+ break;
+ }
}
static void _convert_audio_info_audio_type_2_sound_type(const CAudioInfo::EAudioType& src_type, sound_type_e& dst_type) {
switch (src_type) {
- case CAudioInfo::AUDIO_OUT_TYPE_MEDIA:
- dst_type = SOUND_TYPE_MEDIA;
- break;
- case CAudioInfo::AUDIO_OUT_TYPE_SYSTEM:
- dst_type = SOUND_TYPE_SYSTEM;
- break;
- case CAudioInfo::AUDIO_OUT_TYPE_ALARM:
- dst_type = SOUND_TYPE_ALARM;
- break;
- case CAudioInfo::AUDIO_OUT_TYPE_NOTIFICATION:
- case CAudioInfo::AUDIO_OUT_TYPE_EMERGENCY:
- dst_type = SOUND_TYPE_NOTIFICATION;
- break;
- case CAudioInfo::AUDIO_OUT_TYPE_VOICE_INFORMATION:
- case CAudioInfo::AUDIO_OUT_TYPE_VOICE_RECOGNITION:
- dst_type = SOUND_TYPE_VOICE;
- break;
- case CAudioInfo::AUDIO_OUT_TYPE_RINGTONE_VOIP:
- dst_type = SOUND_TYPE_RINGTONE;
- break;
- case CAudioInfo::AUDIO_OUT_TYPE_VOIP:
- dst_type = SOUND_TYPE_VOIP;
- break;
- default:
- dst_type = SOUND_TYPE_MEDIA;
- break;
- }
+ case CAudioInfo::AUDIO_OUT_TYPE_MEDIA:
+ dst_type = SOUND_TYPE_MEDIA;
+ break;
+ case CAudioInfo::AUDIO_OUT_TYPE_SYSTEM:
+ dst_type = SOUND_TYPE_SYSTEM;
+ break;
+ case CAudioInfo::AUDIO_OUT_TYPE_ALARM:
+ dst_type = SOUND_TYPE_ALARM;
+ break;
+ case CAudioInfo::AUDIO_OUT_TYPE_NOTIFICATION:
+ case CAudioInfo::AUDIO_OUT_TYPE_EMERGENCY:
+ dst_type = SOUND_TYPE_NOTIFICATION;
+ break;
+ case CAudioInfo::AUDIO_OUT_TYPE_VOICE_INFORMATION:
+ dst_type = SOUND_TYPE_VOICE;
+ break;
+ case CAudioInfo::AUDIO_OUT_TYPE_RINGTONE_VOIP:
+ dst_type = SOUND_TYPE_RINGTONE;
+ break;
+ case CAudioInfo::AUDIO_OUT_TYPE_VOIP:
+ dst_type = SOUND_TYPE_VOIP;
+ break;
+ default:
+ dst_type = SOUND_TYPE_MEDIA;
+ break;
+ }
}
static audio_io_state_e _convert_state_type(const CAudioInfo::EAudioIOState src_state) {
THROW_ERROR_MSG_FORMAT(CAudioError::ERROR_INVALID_ARGUMENT, "Parameters are NULL input:%p", input);
}
+ _check_audio_param(sample_rate, channel, type);
+
handle = new audio_io_s;
if (handle == NULL) {
THROW_ERROR_MSG(CAudioError::ERROR_OUT_OF_MEMORY, "Failed allocation handle");
if ((errorCode = sound_manager_get_type_from_stream_information (stream_info, &type)) != SOUND_MANAGER_ERROR_NONE) {
THROW_ERROR_MSG_FORMAT(CAudioError::ERROR_INVALID_ARGUMENT, "Parameter stream_info->stream_type is invalid [ret:%d]", errorCode);
}
- handle->audioIoHandle->getAudioInfo().convertStreamType2AudioType(type, &AudioType);
+ handle->audioIoHandle->getAudioInfo().convertInputStreamType2AudioType(type, &AudioType);
handle->audioIoHandle->getAudioInfo().setAudioType(AudioType);
if ((errorCode = sound_manager_get_index_from_stream_information (stream_info, &index)) != SOUND_MANAGER_ERROR_NONE) {
int ret = 0;
try {
- if (handle == NULL) {
- THROW_ERROR_MSG_FORMAT(CAudioError::ERROR_INVALID_ARGUMENT, "Parameters are NULL input:%p", input);
+ if (handle == NULL || buffer == NULL) {
+ THROW_ERROR_MSG_FORMAT(CAudioError::ERROR_INVALID_ARGUMENT, "Parameters are NULL input:%p, buffer:%p", input, buffer);
}
assert(handle->audioIoHandle);
audio_io_s* handle = static_cast<audio_io_s*>(input);
try {
- if (handle == NULL) {
- THROW_ERROR_MSG_FORMAT(CAudioError::ERROR_INVALID_ARGUMENT, "Parameters are NULL input:%p", input);
+ if (handle == NULL || buffer == NULL) {
+ THROW_ERROR_MSG_FORMAT(CAudioError::ERROR_INVALID_ARGUMENT, "Parameters are NULL input:%p, buffer:%p", input, buffer);
}
CAudioInput* inputHandle = dynamic_cast<CAudioInput*>(handle->audioIoHandle);
audio_io_s* handle = static_cast<audio_io_s*>(input);
try {
- if (handle == NULL) {
- THROW_ERROR_MSG_FORMAT(CAudioError::ERROR_INVALID_ARGUMENT, "Parameters are NULL output:%p, callback:%p", input, callback);
+ if (handle == NULL || callback == NULL) {
+ THROW_ERROR_MSG_FORMAT(CAudioError::ERROR_INVALID_ARGUMENT, "Parameters are NULL input:%p, callback:%p", input, callback);
}
assert(handle->audioIoHandle);
int cpp_audio_out_create(int sample_rate, audio_channel_e channel, audio_sample_type_e type, sound_type_e sound_type, audio_out_h *output) {
audio_io_s* handle = NULL;
try {
+ if (output == NULL) {
+ THROW_ERROR_MSG_FORMAT(CAudioError::ERROR_INVALID_ARGUMENT, "Parameters are NULL output:%p", output);
+ }
+
+ _check_audio_param(sample_rate, channel, type, sound_type);
+
handle = new audio_io_s;
if (handle == NULL) {
THROW_ERROR_MSG(CAudioError::ERROR_OUT_OF_MEMORY, "Failed allocation handle");
}
- _check_audio_param(sample_rate, channel, type, sound_type);
-
CAudioInfo audioInfo = _generate_audio_output_info(sample_rate, channel, type, sound_type);
handle->audioIoHandle = new CAudioOutput(audioInfo);
VALID_POINTER_END
VALID_POINTER_START(output)
- *output = NULL;
+ *output = NULL;
VALID_POINTER_END
return _convert_CAudioError(e);
int cpp_audio_out_create_new(int sample_rate, audio_channel_e channel, audio_sample_type_e type, audio_out_h *output) {
audio_io_s* handle = NULL;
try {
+ if (output == NULL) {
+ THROW_ERROR_MSG_FORMAT(CAudioError::ERROR_INVALID_ARGUMENT, "Parameters are NULL output:%p", output);
+ }
+
+ _check_audio_param(sample_rate, channel, type, SOUND_TYPE_SYSTEM /*default check */);
+
handle = new audio_io_s;
if (handle == NULL) {
THROW_ERROR_MSG(CAudioError::ERROR_OUT_OF_MEMORY, "Failed allocation handle");
}
- CAudioInfo audioInfo = _generate_audio_output_info(sample_rate, channel, type, SOUND_TYPE_MEDIA /* default sound_tyoe */);
+ CAudioInfo audioInfo = _generate_audio_output_info(sample_rate, channel, type, SOUND_TYPE_MEDIA /* default sound_type */);
handle->audioIoHandle = new CAudioOutput(audioInfo);
if (handle == NULL) {
VALID_POINTER_END
VALID_POINTER_START(output)
- *output = NULL;
+ *output = NULL;
VALID_POINTER_END
return _convert_CAudioError(e);
if ((errorCode = sound_manager_get_type_from_stream_information (stream_info, &type)) != SOUND_MANAGER_ERROR_NONE) {
THROW_ERROR_MSG_FORMAT(CAudioError::ERROR_INVALID_ARGUMENT, "Parameter stream_info->stream_type is invalid [ret:%d]", errorCode);
}
- handle->audioIoHandle->getAudioInfo().convertStreamType2AudioType(type, &AudioType);
+ handle->audioIoHandle->getAudioInfo().convertOutputStreamType2AudioType(type, &AudioType);
handle->audioIoHandle->getAudioInfo().setAudioType(AudioType);
if ((errorCode = sound_manager_get_index_from_stream_information (stream_info, &index)) != SOUND_MANAGER_ERROR_NONE) {
int ret = 0;
try {
- if (handle == NULL) {
- THROW_ERROR_MSG_FORMAT(CAudioError::ERROR_INVALID_ARGUMENT, "Parameter is NULL output:%p", output);
+ if (handle == NULL || buffer == NULL) {
+ THROW_ERROR_MSG_FORMAT(CAudioError::ERROR_INVALID_ARGUMENT, "Parameter is NULL output:%p, buffer:%p", output, buffer);
}
assert(handle->audioIoHandle);
audio_io_s* handle = static_cast<audio_io_s*>(output);
try {
- if (handle == NULL) {
+ if (handle == NULL || callback == NULL) {
THROW_ERROR_MSG_FORMAT(CAudioError::ERROR_INVALID_ARGUMENT, "Parameters are NULL output:%p, callback:%p", output, callback);
}
audio_io_s* handle = static_cast<audio_io_s*>(output);
try {
- if (handle == NULL) {
+ if (handle == NULL || callback == NULL) {
THROW_ERROR_MSG_FORMAT(CAudioError::ERROR_INVALID_ARGUMENT, "Parameters are NULL output:%p, callback:%p", output, callback);
}