Skip to content

Commit

Permalink
oboe: change VoicePerformance to VoiceRecognition on P
Browse files Browse the repository at this point in the history
Fixes #1009
  • Loading branch information
philburk committed Oct 23, 2020
1 parent 9d2aa64 commit 52aca57
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/aaudio/AudioStreamAAudio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -213,8 +213,13 @@ Result AudioStreamAAudio::open() {
}

if (mLibLoader->builder_setInputPreset != nullptr) {
aaudio_input_preset_t inputPreset = mInputPreset;
if (getSdkVersion() <= __ANDROID_API_P__ && inputPreset == InputPreset::VoicePerformance) {
LOGD("InputPreset::VoicePerformance not supported before Q. Using VoiceRecognition.");
inputPreset = InputPreset::VoiceRecognition; // most similar preset
}
mLibLoader->builder_setInputPreset(aaudioBuilder,
static_cast<aaudio_input_preset_t>(mInputPreset));
static_cast<aaudio_input_preset_t>(inputPreset));
}

if (mLibLoader->builder_setSessionId != nullptr) {
Expand Down
1 change: 1 addition & 0 deletions src/opensles/AudioInputStreamOpenSLES.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ static SLuint32 OpenSLES_convertInputPreset(InputPreset oboePreset) {
openslPreset = SL_ANDROID_RECORDING_PRESET_CAMCORDER;
break;
case InputPreset::VoiceRecognition:
case InputPreset::VoicePerformance:
openslPreset = SL_ANDROID_RECORDING_PRESET_VOICE_RECOGNITION;
break;
case InputPreset::VoiceCommunication:
Expand Down

0 comments on commit 52aca57

Please sign in to comment.