diff --git a/audio/7.0/types.hal b/audio/7.0/types.hal index 7c050c106a..6cac9c95fe 100644 --- a/audio/7.0/types.hal +++ b/audio/7.0/types.hal @@ -126,16 +126,18 @@ struct AudioMicrophoneCoordinate { * process (e.g. High Pass Filtering, dynamic compression) * Simple processing as constant gain adjustment must be DIRECT. */ +@export(name="audio_microphone_channel_mapping_t", value_prefix="AUDIO_MICROPHONE_CHANNEL_MAPPING_") enum AudioMicrophoneChannelMapping : uint32_t { UNUSED = 0, /* Channel not used */ DIRECT = 1, /* Channel used and signal not processed */ - PROCESSED = 2, /* Channel used and signal has some process */ + PROCESSED = 2, /* Channel used and signal has some processing */ }; /** * Enum to identify locations of microphones in regards to the body of the * android device. */ +@export(name="audio_microphone_location_t", value_prefix="AUDIO_MICROPHONE_LOCATION_") enum AudioMicrophoneLocation : uint32_t { UNKNOWN = 0, MAINBODY = 1, @@ -152,6 +154,7 @@ typedef int32_t AudioMicrophoneGroup; /** * Enum with standard polar patterns of microphones */ +@export(name="audio_microphone_directionality_t", value_prefix="AUDIO_MICROPHONE_DIRECTIONALITY_") enum AudioMicrophoneDirectionality : uint32_t { UNKNOWN = 0, OMNI = 1, diff --git a/audio/core/all-versions/default/Conversions.cpp b/audio/core/all-versions/default/Conversions.cpp index 0b6ad80a80..0db210a58a 100644 --- a/audio/core/all-versions/default/Conversions.cpp +++ b/audio/core/all-versions/default/Conversions.cpp @@ -93,52 +93,6 @@ status_t deviceAddressFromHal(audio_devices_t device, const char* halAddress, return OK; } -AudioMicrophoneChannelMapping halToChannelMapping(audio_microphone_channel_mapping_t mapping) { - switch (mapping) { - case AUDIO_MICROPHONE_CHANNEL_MAPPING_UNUSED: - return AudioMicrophoneChannelMapping::UNUSED; - case AUDIO_MICROPHONE_CHANNEL_MAPPING_DIRECT: - return AudioMicrophoneChannelMapping::DIRECT; - case AUDIO_MICROPHONE_CHANNEL_MAPPING_PROCESSED: - return AudioMicrophoneChannelMapping::PROCESSED; - default: - ALOGE("Invalid channel mapping type: %d", mapping); - return AudioMicrophoneChannelMapping::UNUSED; - } -} - -AudioMicrophoneLocation halToLocation(audio_microphone_location_t location) { - switch (location) { - default: - case AUDIO_MICROPHONE_LOCATION_UNKNOWN: - return AudioMicrophoneLocation::UNKNOWN; - case AUDIO_MICROPHONE_LOCATION_MAINBODY: - return AudioMicrophoneLocation::MAINBODY; - case AUDIO_MICROPHONE_LOCATION_MAINBODY_MOVABLE: - return AudioMicrophoneLocation::MAINBODY_MOVABLE; - case AUDIO_MICROPHONE_LOCATION_PERIPHERAL: - return AudioMicrophoneLocation::PERIPHERAL; - } -} - -AudioMicrophoneDirectionality halToDirectionality(audio_microphone_directionality_t dir) { - switch (dir) { - default: - case AUDIO_MICROPHONE_DIRECTIONALITY_UNKNOWN: - return AudioMicrophoneDirectionality::UNKNOWN; - case AUDIO_MICROPHONE_DIRECTIONALITY_OMNI: - return AudioMicrophoneDirectionality::OMNI; - case AUDIO_MICROPHONE_DIRECTIONALITY_BI_DIRECTIONAL: - return AudioMicrophoneDirectionality::BI_DIRECTIONAL; - case AUDIO_MICROPHONE_DIRECTIONALITY_CARDIOID: - return AudioMicrophoneDirectionality::CARDIOID; - case AUDIO_MICROPHONE_DIRECTIONALITY_HYPER_CARDIOID: - return AudioMicrophoneDirectionality::HYPER_CARDIOID; - case AUDIO_MICROPHONE_DIRECTIONALITY_SUPER_CARDIOID: - return AudioMicrophoneDirectionality::SUPER_CARDIOID; - } -} - bool halToMicrophoneCharacteristics(MicrophoneInfo* pDst, const struct audio_microphone_characteristic_t& src) { bool status = false; @@ -150,15 +104,15 @@ bool halToMicrophoneCharacteristics(MicrophoneInfo* pDst, } pDst->channelMapping.resize(AUDIO_CHANNEL_COUNT_MAX); for (size_t ch = 0; ch < pDst->channelMapping.size(); ch++) { - pDst->channelMapping[ch] = halToChannelMapping(src.channel_mapping[ch]); + pDst->channelMapping[ch] = AudioMicrophoneChannelMapping(src.channel_mapping[ch]); } - pDst->location = halToLocation(src.location); + pDst->location = AudioMicrophoneLocation(src.location); pDst->group = (AudioMicrophoneGroup)src.group; pDst->indexInTheGroup = (uint32_t)src.index_in_the_group; pDst->sensitivity = src.sensitivity; pDst->maxSpl = src.max_spl; pDst->minSpl = src.min_spl; - pDst->directionality = halToDirectionality(src.directionality); + pDst->directionality = AudioMicrophoneDirectionality(src.directionality); pDst->frequencyResponse.resize(src.num_frequency_responses); for (size_t k = 0; k < src.num_frequency_responses; k++) { pDst->frequencyResponse[k].frequency = src.frequency_responses[0][k];