Skip to content

Commit 52aca57

Browse files
committed
oboe: change VoicePerformance to VoiceRecognition on P
Fixes #1009
1 parent 9d2aa64 commit 52aca57

2 files changed

Lines changed: 7 additions & 1 deletion

File tree

src/aaudio/AudioStreamAAudio.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,8 +213,13 @@ Result AudioStreamAAudio::open() {
213213
}
214214

215215
if (mLibLoader->builder_setInputPreset != nullptr) {
216+
aaudio_input_preset_t inputPreset = mInputPreset;
217+
if (getSdkVersion() <= __ANDROID_API_P__ && inputPreset == InputPreset::VoicePerformance) {
218+
LOGD("InputPreset::VoicePerformance not supported before Q. Using VoiceRecognition.");
219+
inputPreset = InputPreset::VoiceRecognition; // most similar preset
220+
}
216221
mLibLoader->builder_setInputPreset(aaudioBuilder,
217-
static_cast<aaudio_input_preset_t>(mInputPreset));
222+
static_cast<aaudio_input_preset_t>(inputPreset));
218223
}
219224

220225
if (mLibLoader->builder_setSessionId != nullptr) {

src/opensles/AudioInputStreamOpenSLES.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ static SLuint32 OpenSLES_convertInputPreset(InputPreset oboePreset) {
3636
openslPreset = SL_ANDROID_RECORDING_PRESET_CAMCORDER;
3737
break;
3838
case InputPreset::VoiceRecognition:
39+
case InputPreset::VoicePerformance:
3940
openslPreset = SL_ANDROID_RECORDING_PRESET_VOICE_RECOGNITION;
4041
break;
4142
case InputPreset::VoiceCommunication:

0 commit comments

Comments
 (0)