Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(329)

Side by Side Diff: chromeos/audio/audio_device.cc

Issue 2609863007: Add new mic types (Closed)
Patch Set: Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chromeos/audio/audio_device.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chromeos/audio/audio_device.h" 5 #include "chromeos/audio/audio_device.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include "base/format_macros.h" 9 #include "base/format_macros.h"
10 #include "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
(...skipping 16 matching lines...) Expand all
27 case AUDIO_TYPE_HEADPHONE: 27 case AUDIO_TYPE_HEADPHONE:
28 case AUDIO_TYPE_LINEOUT: 28 case AUDIO_TYPE_LINEOUT:
29 case AUDIO_TYPE_MIC: 29 case AUDIO_TYPE_MIC:
30 case AUDIO_TYPE_USB: 30 case AUDIO_TYPE_USB:
31 case AUDIO_TYPE_BLUETOOTH: 31 case AUDIO_TYPE_BLUETOOTH:
32 return 3; 32 return 3;
33 case AUDIO_TYPE_HDMI: 33 case AUDIO_TYPE_HDMI:
34 return 2; 34 return 2;
35 case AUDIO_TYPE_INTERNAL_SPEAKER: 35 case AUDIO_TYPE_INTERNAL_SPEAKER:
36 case AUDIO_TYPE_INTERNAL_MIC: 36 case AUDIO_TYPE_INTERNAL_MIC:
37 case AUDIO_TYPE_FRONT_MIC:
37 return 1; 38 return 1;
39 case AUDIO_TYPE_REAR_MIC:
hshi1 2017/01/06 18:41:23 why is the FRONT_MIC assigned priority "1" but REA
jennyz 2017/01/06 19:31:16 Yes, same question as hshi, please comment for the
hychao 2017/01/09 03:17:35 Added comment for this. The idea is the same as se
38 case AUDIO_TYPE_KEYBOARD_MIC: 40 case AUDIO_TYPE_KEYBOARD_MIC:
39 case AUDIO_TYPE_HOTWORD: 41 case AUDIO_TYPE_HOTWORD:
40 case AUDIO_TYPE_POST_MIX_LOOPBACK: 42 case AUDIO_TYPE_POST_MIX_LOOPBACK:
41 case AUDIO_TYPE_POST_DSP_LOOPBACK: 43 case AUDIO_TYPE_POST_DSP_LOOPBACK:
42 case AUDIO_TYPE_OTHER: 44 case AUDIO_TYPE_OTHER:
43 default: 45 default:
44 return 0; 46 return 0;
45 } 47 }
46 } 48 }
47 49
48 } // namespace 50 } // namespace
49 51
50 // static 52 // static
51 std::string AudioDevice::GetTypeString(AudioDeviceType type) { 53 std::string AudioDevice::GetTypeString(AudioDeviceType type) {
52 switch (type) { 54 switch (type) {
53 case AUDIO_TYPE_HEADPHONE: 55 case AUDIO_TYPE_HEADPHONE:
54 return "HEADPHONE"; 56 return "HEADPHONE";
55 case AUDIO_TYPE_MIC: 57 case AUDIO_TYPE_MIC:
56 return "MIC"; 58 return "MIC";
57 case AUDIO_TYPE_USB: 59 case AUDIO_TYPE_USB:
58 return "USB"; 60 return "USB";
59 case AUDIO_TYPE_BLUETOOTH: 61 case AUDIO_TYPE_BLUETOOTH:
60 return "BLUETOOTH"; 62 return "BLUETOOTH";
61 case AUDIO_TYPE_HDMI: 63 case AUDIO_TYPE_HDMI:
62 return "HDMI"; 64 return "HDMI";
63 case AUDIO_TYPE_INTERNAL_SPEAKER: 65 case AUDIO_TYPE_INTERNAL_SPEAKER:
64 return "INTERNAL_SPEAKER"; 66 return "INTERNAL_SPEAKER";
65 case AUDIO_TYPE_INTERNAL_MIC: 67 case AUDIO_TYPE_INTERNAL_MIC:
66 return "INTERNAL_MIC"; 68 return "INTERNAL_MIC";
69 case AUDIO_TYPE_FRONT_MIC:
70 return "FRONT_MIC";
71 case AUDIO_TYPE_REAR_MIC:
72 return "REAR_MIC";
67 case AUDIO_TYPE_KEYBOARD_MIC: 73 case AUDIO_TYPE_KEYBOARD_MIC:
68 return "KEYBOARD_MIC"; 74 return "KEYBOARD_MIC";
69 case AUDIO_TYPE_HOTWORD: 75 case AUDIO_TYPE_HOTWORD:
70 return "HOTWORD"; 76 return "HOTWORD";
71 case AUDIO_TYPE_LINEOUT: 77 case AUDIO_TYPE_LINEOUT:
72 return "LINEOUT"; 78 return "LINEOUT";
73 case AUDIO_TYPE_POST_MIX_LOOPBACK: 79 case AUDIO_TYPE_POST_MIX_LOOPBACK:
74 return "POST_MIX_LOOPBACK"; 80 return "POST_MIX_LOOPBACK";
75 case AUDIO_TYPE_POST_DSP_LOOPBACK: 81 case AUDIO_TYPE_POST_DSP_LOOPBACK:
76 return "POST_DSP_LOOPBACK"; 82 return "POST_DSP_LOOPBACK";
77 case AUDIO_TYPE_OTHER: 83 case AUDIO_TYPE_OTHER:
78 default: 84 default:
79 return "OTHER"; 85 return "OTHER";
80 } 86 }
81 } 87 }
82 88
83 // static 89 // static
84 AudioDeviceType AudioDevice::GetAudioType( 90 AudioDeviceType AudioDevice::GetAudioType(
85 const std::string& node_type) { 91 const std::string& node_type) {
86 if (node_type.find("HEADPHONE") != std::string::npos) 92 if (node_type.find("HEADPHONE") != std::string::npos)
87 return AUDIO_TYPE_HEADPHONE; 93 return AUDIO_TYPE_HEADPHONE;
88 else if (node_type.find("INTERNAL_MIC") != std::string::npos) 94 else if (node_type.find("INTERNAL_MIC") != std::string::npos)
89 return AUDIO_TYPE_INTERNAL_MIC; 95 return AUDIO_TYPE_INTERNAL_MIC;
96 else if (node_type.find("FRONT_MIC") != std::string::npos)
97 return AUDIO_TYPE_FRONT_MIC;
98 else if (node_type.find("REAR_MIC") != std::string::npos)
99 return AUDIO_TYPE_REAR_MIC;
90 else if (node_type.find("KEYBOARD_MIC") != std::string::npos) 100 else if (node_type.find("KEYBOARD_MIC") != std::string::npos)
91 return AUDIO_TYPE_KEYBOARD_MIC; 101 return AUDIO_TYPE_KEYBOARD_MIC;
92 else if (node_type.find("MIC") != std::string::npos) 102 else if (node_type.find("MIC") != std::string::npos)
93 return AUDIO_TYPE_MIC; 103 return AUDIO_TYPE_MIC;
94 else if (node_type.find("USB") != std::string::npos) 104 else if (node_type.find("USB") != std::string::npos)
95 return AUDIO_TYPE_USB; 105 return AUDIO_TYPE_USB;
96 else if (node_type.find("BLUETOOTH") != std::string::npos) 106 else if (node_type.find("BLUETOOTH") != std::string::npos)
97 return AUDIO_TYPE_BLUETOOTH; 107 return AUDIO_TYPE_BLUETOOTH;
98 else if (node_type.find("HDMI") != std::string::npos) 108 else if (node_type.find("HDMI") != std::string::npos)
99 return AUDIO_TYPE_HDMI; 109 return AUDIO_TYPE_HDMI;
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 active ? "true" : "false"); 178 active ? "true" : "false");
169 base::StringAppendF(&result, 179 base::StringAppendF(&result,
170 "plugged_time= %s ", 180 "plugged_time= %s ",
171 base::Uint64ToString(plugged_time).c_str()); 181 base::Uint64ToString(plugged_time).c_str());
172 base::StringAppendF(&result, "mic_positions = %s ", mic_positions.c_str()); 182 base::StringAppendF(&result, "mic_positions = %s ", mic_positions.c_str());
173 183
174 return result; 184 return result;
175 } 185 }
176 186
177 } // namespace chromeos 187 } // namespace chromeos
OLDNEW
« no previous file with comments | « chromeos/audio/audio_device.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698