OLD | NEW |
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 #ifndef CHROMEOS_AUDIO_AUDIO_DEVICE_H_ | 5 #ifndef CHROMEOS_AUDIO_AUDIO_DEVICE_H_ |
6 #define CHROMEOS_AUDIO_AUDIO_DEVICE_H_ | 6 #define CHROMEOS_AUDIO_AUDIO_DEVICE_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 23 matching lines...) Expand all Loading... |
34 struct CHROMEOS_EXPORT AudioDevice { | 34 struct CHROMEOS_EXPORT AudioDevice { |
35 AudioDevice(); | 35 AudioDevice(); |
36 explicit AudioDevice(const AudioNode& node); | 36 explicit AudioDevice(const AudioNode& node); |
37 std::string ToString() const; | 37 std::string ToString() const; |
38 | 38 |
39 // Converts between the string type sent via D-Bus and AudioDeviceType. | 39 // Converts between the string type sent via D-Bus and AudioDeviceType. |
40 // Static so they can be used by tests. | 40 // Static so they can be used by tests. |
41 static std::string GetTypeString(chromeos::AudioDeviceType type); | 41 static std::string GetTypeString(chromeos::AudioDeviceType type); |
42 static chromeos::AudioDeviceType GetAudioType(const std::string& node_type); | 42 static chromeos::AudioDeviceType GetAudioType(const std::string& node_type); |
43 | 43 |
44 // Indicates that an input or output audio device is for simple usage like | |
45 // playback or recording for user. In contrast, audio device such as | |
46 // loopback, always on keyword recognition (AOKR), and keyboard mic are | |
47 // not for simple usage. | |
48 bool is_for_simple_usage() { | |
49 return (type == AUDIO_TYPE_HEADPHONE || | |
50 type == AUDIO_TYPE_INTERNAL_MIC || | |
51 type == AUDIO_TYPE_MIC || | |
52 type == AUDIO_TYPE_USB || | |
53 type == AUDIO_TYPE_BLUETOOTH || | |
54 type == AUDIO_TYPE_HDMI || | |
55 type == AUDIO_TYPE_INTERNAL_SPEAKER); | |
56 } | |
57 | |
58 bool is_input; | 44 bool is_input; |
59 uint64 id; | 45 uint64 id; |
60 std::string display_name; | 46 std::string display_name; |
61 std::string device_name; | 47 std::string device_name; |
62 AudioDeviceType type; | 48 AudioDeviceType type; |
63 uint8 priority; | 49 uint8 priority; |
64 bool active; | 50 bool active; |
65 uint64 plugged_time; | 51 uint64 plugged_time; |
66 }; | 52 }; |
67 | 53 |
(...skipping 17 matching lines...) Expand all Loading... |
85 return true; | 71 return true; |
86 } else { | 72 } else { |
87 return false; | 73 return false; |
88 } | 74 } |
89 } | 75 } |
90 }; | 76 }; |
91 | 77 |
92 } // namespace chromeos | 78 } // namespace chromeos |
93 | 79 |
94 #endif // CHROMEOS_AUDIO_AUDIO_DEVICE_H_ | 80 #endif // CHROMEOS_AUDIO_AUDIO_DEVICE_H_ |
OLD | NEW |