return mInterruptCallback;
}
-
void CAudioIO::ignoreSession() throw(CAudioError) {
if (__mIsInit == false)
THROW_ERROR_MSG(CAudioError::EError::ERROR_NOT_INITIALIZED, "Doesn't initialize CAudioIO");
throw e;
}
}
+
+void CAudioIO::setStreamInfo(sound_stream_info_h stream_info) throw(CAudioError) {
+ if (stream_info == NULL)
+ THROW_ERROR_MSG(CAudioError::EError::ERROR_INVALID_ARGUMENT, "stream_info is NULL");
+
+ if (__mIsInit == false)
+ THROW_ERROR_MSG(CAudioError::EError::ERROR_NOT_INITIALIZED, "Doesn't initialize CAudioIO");
+
+ try {
+ if (mState != CAudioInfo::EAudioIOState::AUDIO_IO_STATE_IDLE)
+ THROW_ERROR_MSG(CAudioError::EError::ERROR_INVALID_STATE, "it is not permitted while started");
+
+ int errorCode = SOUND_MANAGER_ERROR_NONE;
+ CAudioInfo::EAudioType audioType = CAudioInfo::EAudioType::AUDIO_IN_TYPE_MEDIA;
+ char *type = NULL;
+ int index = -1;
+ bool avail = false;
+
+ if ((errorCode = sound_manager_is_available_stream_information(stream_info, NATIVE_API_AUDIO_IO, &avail)) != SOUND_MANAGER_ERROR_NONE)
+ THROW_ERROR_MSG_FORMAT(CAudioError::EError::ERROR_INVALID_ARGUMENT, "Parameter stream_info is invalid [ret:%d]", errorCode);
+
+ if (!avail)
+ THROW_ERROR_MSG_FORMAT(CAudioError::EError::ERROR_NOT_SUPPORTED_TYPE, "Input stream is not supported");
+
+ if ((errorCode = sound_manager_get_type_from_stream_information(stream_info, &type)) != SOUND_MANAGER_ERROR_NONE)
+ THROW_ERROR_MSG_FORMAT(CAudioError::EError::ERROR_INVALID_ARGUMENT, "Parameter stream_info->stream_type is invalid [ret:%d]", errorCode);
+
+ if (mDirection == CAudioInfo::EAudioDirection::AUDIO_DIRECTION_IN)
+ getAudioInfo().convertInputStreamType2AudioType(type, &audioType);
+ else
+ getAudioInfo().convertOutputStreamType2AudioType(type, &audioType);
+ getAudioInfo().setAudioType(audioType);
+
+ if ((errorCode = sound_manager_get_index_from_stream_information(stream_info, &index)) != SOUND_MANAGER_ERROR_NONE)
+ THROW_ERROR_MSG_FORMAT(CAudioError::EError::ERROR_INVALID_ARGUMENT, "Parameter stream_info->index is invalid [ret:%d]", errorCode);
+
+ getAudioInfo().setAudioIndex(index);
+
+ AUDIO_IO_LOGD("stream info(%p) is set", stream_info);
+ } catch (CAudioError e) {
+ throw e;
+ }
+}
+
+void CAudioIO::setInternalStreamInfo() throw(CAudioError) {
+ if (__mIsInit == false)
+ THROW_ERROR_MSG(CAudioError::EError::ERROR_NOT_INITIALIZED, "Doesn't initialize CAudioIO");
+
+ try {
+ if (mState != CAudioInfo::EAudioIOState::AUDIO_IO_STATE_IDLE)
+ THROW_ERROR_MSG(CAudioError::EError::ERROR_INVALID_STATE, "it is not permitted while started");
+
+ if (mpAudioSessionHandler &&
+ mpAudioSessionHandler->getMultimediaSession() == MM_SESSION_TYPE_VOIP) {
+ sound_stream_info_h stream_info = NULL;
+ mpAudioSessionHandler->getInternalVoipStreamInfo(&stream_info);
+ AUDIO_IO_LOGD("get internal VOIP stream info(%p)", stream_info);
+ setStreamInfo(stream_info);
+ }
+ } catch (CAudioError e) {
+ throw e;
+ }
+}
THROW_ERROR_MSG_FORMAT(CAudioError::EError::ERROR_INVALID_ARGUMENT,
"Parameters are NULL input:%p", input);
}
-
assert(handle->audioIoHandle);
/* Internal unprepare for backward compatibility */
THROW_ERROR_MSG_FORMAT(CAudioError::EError::ERROR_INVALID_ARGUMENT,
"Parameters are NULL input:%p, stream_info:%p", input, stream_info);
}
-
assert(handle->audioIoHandle);
- int errorCode = SOUND_MANAGER_ERROR_NONE;
- CAudioInfo::EAudioType audioType = CAudioInfo::EAudioType::AUDIO_IN_TYPE_MEDIA;
- char *type = NULL;
- int index = -1;
- bool avail = false;
-
- if ((errorCode = sound_manager_is_available_stream_information(stream_info, NATIVE_API_AUDIO_IO, &avail)) != SOUND_MANAGER_ERROR_NONE) {
- THROW_ERROR_MSG_FORMAT(CAudioError::EError::ERROR_INVALID_ARGUMENT, "Parameter stream_info is invalid [ret:%d]", errorCode);
- }
-
- if (avail) {
- if ((errorCode = sound_manager_get_type_from_stream_information(stream_info, &type)) != SOUND_MANAGER_ERROR_NONE) {
- THROW_ERROR_MSG_FORMAT(CAudioError::EError::ERROR_INVALID_ARGUMENT, "Parameter stream_info->stream_type is invalid [ret:%d]", errorCode);
- }
- 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) {
- THROW_ERROR_MSG_FORMAT(CAudioError::EError::ERROR_INVALID_ARGUMENT, "Parameter stream_info->index is invalid [ret:%d]", errorCode);
- }
- handle->audioIoHandle->getAudioInfo().setAudioIndex(index);
- } else {
- THROW_ERROR_MSG_FORMAT(CAudioError::EError::ERROR_NOT_SUPPORTED_TYPE, "Input stream is not supported");
- }
+ handle->audioIoHandle->setStreamInfo(stream_info);
} catch (CAudioError e) {
AUDIO_IO_LOGE("%s", e.getErrorMsg());
return __convert_CAudioError(e);
THROW_ERROR_MSG_FORMAT(CAudioError::EError::ERROR_INVALID_ARGUMENT,
"Parameters are NULL input:%p", input);
}
-
assert(handle->audioIoHandle);
handle->audioIoHandle->prepare();
THROW_ERROR_MSG_FORMAT(CAudioError::EError::ERROR_INVALID_ARGUMENT,
"Parameters are NULL input:%p", input);
}
-
assert(handle->audioIoHandle);
handle->audioIoHandle->flush();
THROW_ERROR_MSG_FORMAT(CAudioError::EError::ERROR_INVALID_ARGUMENT,
"Parameters are NULL input:%p, size:%p", input, size);
}
-
assert(handle->audioIoHandle);
CAudioIO* inputHandle = dynamic_cast<CAudioInput*>(handle->audioIoHandle);
THROW_ERROR_MSG_FORMAT(CAudioError::EError::ERROR_INVALID_ARGUMENT,
"Parameters are NULL input:%p, sample_rate:%p", input, sample_rate);
}
-
assert(handle->audioIoHandle);
+
*sample_rate = handle->audioIoHandle->getAudioInfo().getSampleRate();
} catch (CAudioError e) {
AUDIO_IO_LOGE("%s", e.getErrorMsg());
THROW_ERROR_MSG_FORMAT(CAudioError::EError::ERROR_INVALID_ARGUMENT,
"Parameters are NULL input:%p, channel:%p", input, channel);
}
-
assert(handle->audioIoHandle);
const CAudioInfo::EChannel srcChannel = handle->audioIoHandle->getAudioInfo().getChannel();
THROW_ERROR_MSG_FORMAT(CAudioError::EError::ERROR_INVALID_ARGUMENT,
"Parameters are NULL input:%p, callback:%p", input, callback);
}
-
assert(handle->audioIoHandle);
handle->interrupt_callback.onInterrupt = callback;
THROW_ERROR_MSG_FORMAT(CAudioError::EError::ERROR_INVALID_ARGUMENT,
"Parameters are NULL input:%p", input);
}
-
assert(handle->audioIoHandle);
handle->interrupt_callback.onInterrupt = NULL;
THROW_ERROR_MSG(CAudioError::EError::ERROR_INVALID_OPERATION,
"Not support ignore session in async mode");
}
-
assert(handle->audioIoHandle);
handle->audioIoHandle->ignoreSession();
THROW_ERROR_MSG_FORMAT(CAudioError::EError::ERROR_INVALID_ARGUMENT,
"Parameters are NULL input:%p, callback:%p", input, callback);
}
-
assert(handle->audioIoHandle);
handle->stream_callback.onStream = callback;
THROW_ERROR_MSG_FORMAT(CAudioError::EError::ERROR_INVALID_ARGUMENT,
"Parameters are NULL input:%p", input);
}
-
assert(handle->audioIoHandle);
handle->stream_callback.onStream = NULL;
THROW_ERROR_MSG_FORMAT(CAudioError::EError::ERROR_INVALID_ARGUMENT,
"Parameters are NULL input:%p, callback:%p", input, callback);
}
-
assert(handle->audioIoHandle);
handle->state_changed_callback.onStateChanged = callback;
THROW_ERROR_MSG_FORMAT(CAudioError::EError::ERROR_INVALID_ARGUMENT,
"Parameters are NULL output:%p", input);
}
-
assert(handle->audioIoHandle);
handle->state_changed_callback.onStateChanged = NULL;
THROW_ERROR_MSG_FORMAT(CAudioError::EError::ERROR_INVALID_ARGUMENT,
"Parameter is NULL output:%p", output);
}
-
assert(handle->audioIoHandle);
/* Internal unprepare for backward compatibility */
THROW_ERROR_MSG_FORMAT(CAudioError::EError::ERROR_INVALID_ARGUMENT,
"Parameters are NULL output:%p, stream_info:%p", output, stream_info);
}
-
assert(handle->audioIoHandle);
- int errorCode = SOUND_MANAGER_ERROR_NONE;
- CAudioInfo::EAudioType audioType = CAudioInfo::EAudioType::AUDIO_OUT_TYPE_MEDIA;
- char *type = NULL;
- int index = -1;
- bool avail = false;
-
- if ((errorCode = sound_manager_is_available_stream_information(stream_info, NATIVE_API_AUDIO_IO, &avail)) != SOUND_MANAGER_ERROR_NONE) {
- THROW_ERROR_MSG_FORMAT(CAudioError::EError::ERROR_INVALID_ARGUMENT, "Parameter stream_info is invalid [ret:%d]", errorCode);
- }
-
- if (avail) {
- if ((errorCode = sound_manager_get_type_from_stream_information(stream_info, &type)) != SOUND_MANAGER_ERROR_NONE) {
- THROW_ERROR_MSG_FORMAT(CAudioError::EError::ERROR_INVALID_ARGUMENT, "Parameter stream_info->stream_type is invalid [ret:%d]", errorCode);
- }
- 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) {
- THROW_ERROR_MSG_FORMAT(CAudioError::EError::ERROR_INVALID_ARGUMENT, "Parameter stream_info->index is invalid [ret:%d]", errorCode);
- }
- handle->audioIoHandle->getAudioInfo().setAudioIndex(index);
- } else {
- THROW_ERROR_MSG_FORMAT(CAudioError::EError::ERROR_NOT_SUPPORTED_TYPE,
- "Output stream is not supported");
- }
+ handle->audioIoHandle->setStreamInfo(stream_info);
} catch (CAudioError e) {
AUDIO_IO_LOGE("%s", e.getErrorMsg());
return __convert_CAudioError(e);
THROW_ERROR_MSG_FORMAT(CAudioError::EError::ERROR_INVALID_ARGUMENT,
"Parameter is NULL output:%p", output);
}
-
assert(handle->audioIoHandle);
handle->audioIoHandle->prepare();
THROW_ERROR_MSG_FORMAT(CAudioError::EError::ERROR_INVALID_ARGUMENT,
"Parameter is NULL output:%p", output);
}
-
assert(handle->audioIoHandle);
handle->audioIoHandle->unprepare();
THROW_ERROR_MSG_FORMAT(CAudioError::EError::ERROR_INVALID_ARGUMENT,
"Parameter is NULL output:%p", output);
}
-
assert(handle->audioIoHandle);
handle->audioIoHandle->pause();
THROW_ERROR_MSG_FORMAT(CAudioError::EError::ERROR_INVALID_ARGUMENT,
"Parameter is NULL output:%p", output);
}
-
assert(handle->audioIoHandle);
handle->audioIoHandle->resume();
THROW_ERROR_MSG_FORMAT(CAudioError::EError::ERROR_INVALID_ARGUMENT,
"Parameter is NULL output:%p", output);
}
-
assert(handle->audioIoHandle);
handle->audioIoHandle->drain();
THROW_ERROR_MSG_FORMAT(CAudioError::EError::ERROR_INVALID_ARGUMENT,
"Parameter is NULL output:%p", output);
}
-
assert(handle->audioIoHandle);
handle->audioIoHandle->flush();
THROW_ERROR_MSG_FORMAT(CAudioError::EError::ERROR_INVALID_ARGUMENT,
"Parameter is NULL output:%p, buffer:%p", output, buffer);
}
-
assert(handle->audioIoHandle);
CAudioOutput* outputHandle = dynamic_cast<CAudioOutput*>(handle->audioIoHandle);
THROW_ERROR_MSG_FORMAT(CAudioError::EError::ERROR_INVALID_ARGUMENT,
"Parameters are NULL output:%p, size:%p", output, size);
}
-
assert(handle->audioIoHandle);
CAudioOutput* outputHandle = dynamic_cast<CAudioOutput*>(handle->audioIoHandle);
THROW_ERROR_MSG_FORMAT(CAudioError::EError::ERROR_INVALID_ARGUMENT,
"Parameters are NULL output:%p, sample_rate:%p", output, sample_rate);
}
-
assert(handle->audioIoHandle);
+
*sample_rate = handle->audioIoHandle->getAudioInfo().getSampleRate();
} catch (CAudioError e) {
AUDIO_IO_LOGE("%s", e.getErrorMsg());
THROW_ERROR_MSG_FORMAT(CAudioError::EError::ERROR_INVALID_ARGUMENT,
"Parameters are NULL output:%p, channel:%p", output, channel);
}
-
assert(handle->audioIoHandle);
const CAudioInfo::EChannel srcChannel = handle->audioIoHandle->getAudioInfo().getChannel();
THROW_ERROR_MSG_FORMAT(CAudioError::EError::ERROR_INVALID_ARGUMENT,
"Parameters are NULL output:%p, type:%p", output, type);
}
-
assert(handle->audioIoHandle);
const CAudioInfo::ESampleType srcSampleType = handle->audioIoHandle->getAudioInfo().getSampleType();
THROW_ERROR_MSG_FORMAT(CAudioError::EError::ERROR_INVALID_ARGUMENT,
"Parameters are NULL output:%p, type:%p", output, type);
}
-
assert(handle->audioIoHandle);
const CAudioInfo::EAudioType srcAudioType = handle->audioIoHandle->getAudioInfo().getAudioType();
THROW_ERROR_MSG_FORMAT(CAudioError::EError::ERROR_INVALID_ARGUMENT,
"Parameters are NULL output:%p, callback:%p", output, callback);
}
-
assert(handle->audioIoHandle);
handle->interrupt_callback.onInterrupt = callback;
THROW_ERROR_MSG_FORMAT(CAudioError::EError::ERROR_INVALID_ARGUMENT,
"Parameters are NULL output:%p", output);
}
-
assert(handle->audioIoHandle);
handle->interrupt_callback.onInterrupt = NULL;
THROW_ERROR_MSG(CAudioError::EError::ERROR_INVALID_OPERATION,
"Not support ignore session in async mode");
}
-
assert(handle->audioIoHandle);
handle->audioIoHandle->ignoreSession();
THROW_ERROR_MSG_FORMAT(CAudioError::EError::ERROR_INVALID_ARGUMENT,
"Parameters are NULL output:%p, callback:%p", output, callback);
}
-
assert(handle->audioIoHandle);
handle->stream_callback.onStream = callback;
THROW_ERROR_MSG_FORMAT(CAudioError::EError::ERROR_INVALID_ARGUMENT,
"Parameters are NULL output:%p", output);
}
-
assert(handle->audioIoHandle);
handle->stream_callback.onStream = NULL;
THROW_ERROR_MSG_FORMAT(CAudioError::EError::ERROR_INVALID_ARGUMENT,
"Parameters are NULL output:%p, callback:%p", output, callback);
}
-
assert(handle->audioIoHandle);
handle->state_changed_callback.onStateChanged = callback;
THROW_ERROR_MSG_FORMAT(CAudioError::EError::ERROR_INVALID_ARGUMENT,
"Parameters are NULL output:%p", output);
}
-
assert(handle->audioIoHandle);
handle->state_changed_callback.onStateChanged = NULL;