Commit 1b273edc authored by hychao's avatar hychao Committed by Commit bot

Add new mic types

Chrome OS audio server is going to report more types of microphones,
implement the UI side corresponding code to parse these types from
node info.

BUG=672537

Review-Url: https://codereview.chromium.org/2609863007
Cr-Commit-Position: refs/heads/master@{#443271}
parent 4ef9895a
......@@ -34,7 +34,11 @@ uint8_t GetDevicePriority(AudioDeviceType type, bool is_input) {
return 2;
case AUDIO_TYPE_INTERNAL_SPEAKER:
case AUDIO_TYPE_INTERNAL_MIC:
case AUDIO_TYPE_FRONT_MIC:
return 1;
// Rear mic should have priority lower than front mic to prevent poor
// quality input caused by accidental selecting to rear side mic.
case AUDIO_TYPE_REAR_MIC:
case AUDIO_TYPE_KEYBOARD_MIC:
case AUDIO_TYPE_HOTWORD:
case AUDIO_TYPE_POST_MIX_LOOPBACK:
......@@ -64,6 +68,10 @@ std::string AudioDevice::GetTypeString(AudioDeviceType type) {
return "INTERNAL_SPEAKER";
case AUDIO_TYPE_INTERNAL_MIC:
return "INTERNAL_MIC";
case AUDIO_TYPE_FRONT_MIC:
return "FRONT_MIC";
case AUDIO_TYPE_REAR_MIC:
return "REAR_MIC";
case AUDIO_TYPE_KEYBOARD_MIC:
return "KEYBOARD_MIC";
case AUDIO_TYPE_HOTWORD:
......@@ -87,6 +95,10 @@ AudioDeviceType AudioDevice::GetAudioType(
return AUDIO_TYPE_HEADPHONE;
else if (node_type.find("INTERNAL_MIC") != std::string::npos)
return AUDIO_TYPE_INTERNAL_MIC;
else if (node_type.find("FRONT_MIC") != std::string::npos)
return AUDIO_TYPE_FRONT_MIC;
else if (node_type.find("REAR_MIC") != std::string::npos)
return AUDIO_TYPE_REAR_MIC;
else if (node_type.find("KEYBOARD_MIC") != std::string::npos)
return AUDIO_TYPE_KEYBOARD_MIC;
else if (node_type.find("MIC") != std::string::npos)
......
......@@ -25,6 +25,8 @@ enum AudioDeviceType {
AUDIO_TYPE_HDMI,
AUDIO_TYPE_INTERNAL_SPEAKER,
AUDIO_TYPE_INTERNAL_MIC,
AUDIO_TYPE_FRONT_MIC,
AUDIO_TYPE_REAR_MIC,
AUDIO_TYPE_KEYBOARD_MIC,
AUDIO_TYPE_HOTWORD,
AUDIO_TYPE_LINEOUT,
......@@ -51,6 +53,8 @@ struct CHROMEOS_EXPORT AudioDevice {
bool is_for_simple_usage() const {
return (type == AUDIO_TYPE_HEADPHONE ||
type == AUDIO_TYPE_INTERNAL_MIC ||
type == AUDIO_TYPE_FRONT_MIC ||
type == AUDIO_TYPE_REAR_MIC ||
type == AUDIO_TYPE_MIC ||
type == AUDIO_TYPE_USB ||
type == AUDIO_TYPE_BLUETOOTH ||
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment