1CRAS dbus methods and signals. 2============================== 3 4Service org.chromium.cras 5Interface org.chromium.cras.Control 6Object Path /org/chromium/cras 7 8Methods void SetOutputVolume(int32 volume) 9 10 Sets the volume of the system. Volume ranges from 11 0 to 100, and will be translated to dB based on the 12 output-specific volume curve. 13 14 void SetOutputNodeVolume(uint64 node_id, int32 volume) 15 16 Sets the volume of the given node. Volume ranges from 17 0 to 100, and will be translated to dB based on the 18 output-specific volume curve. 19 20 void SwapLeftRight(uint64 node_id, boolean swap) 21 22 Swap the left and right channel of the given node. 23 Message will be dropped if this feature is not supported. 24 25 void SetOutputMute(boolean mute_on) 26 27 Sets the system output mute. 28 29 void SetOutputUserMute(boolean mute_on) 30 31 Sets the system output mute from user action. 32 33 void SetInputNodeGain(uint64 node_id, int32 gain) 34 35 Sets the capture gain of the node. gain is a 0-100 36 integer which linearly maps [0, 50] to range [-40dB, 0dB] 37 and [50, 100] to [0dB, 20dB], 38 Default gain value is 50, which is 0dB. 39 40 void SetInputMute(boolean mute_on) 41 42 Sets the capture mute state of the system. Recordings 43 will be muted when this is set. 44 45 void GetVolumeState() 46 47 Returns the volume and capture gain as follows: 48 int32 output_volume (0-100) 49 boolean output_mute 50 int32 input_gain (in dBFS * 100) 51 boolean input_mute 52 boolean output_user_mute 53 54 void GetDefaultOutputBufferSize() 55 56 Returns the default output buffer size in frames. 57 58 {dict},{dict},... GetNodes() 59 60 Returns information about nodes. A node can be either 61 output or input but not both. An output node is 62 something like a speaker or a headphone, and an input 63 node is like a microphone. The return value is a 64 sequence of dicts mapping from strings to variants 65 (e.g. signature "a{sv}a{sv}" for two nodes). Each dict 66 contains information about a node. 67 68 Each dict contains the following properties: 69 boolean IsInput 70 false for output nodes, true for input 71 nodes. 72 uint64 Id 73 The id of this node. It is unique among 74 all nodes including both output and 75 input nodes. 76 string Type 77 The type of this node. It can be one of 78 following values: 79 /* for output nodes. */ 80 "INTERNAL_SPEAKER","HEADPHONE", "HDMI", 81 /* for input nodes. */ 82 "INTERNAL_MIC", "MIC", 83 /* for both output and input nodes. */ 84 "USB", "BLUETOOTH", "UNKNOWN", 85 string Name 86 The name of this node. For example, 87 "Speaker" or "Internal Mic". 88 string DeviceName 89 The name of the device that this node 90 belongs to. For example, 91 "HDA Intel PCH: CA0132 Analog:0,0" or 92 "Creative SB Arena Headset". 93 uint64 StableDeviceId 94 The stable ID does not change due to 95 device plug/unplug or reboot. 96 uint64 StableDeviceIdNew 97 The new stable ID. Keeping both stable 98 ID and stable ID new is for backward 99 compatibility. 100 boolean Active 101 Whether this node is currently used 102 for output/input. There is one active 103 node for output and one active node for 104 input. 105 uint64 PluggedTime 106 The time that this device was plugged 107 in. This value is in microseconds. 108 unit64 NodeVolume 109 The node volume indexed from 0 to 100. 110 unit64 NodeCaptureGain 111 The capture gain of node in dBFS * 100. 112 string HotwordModels 113 A string of comma-separated hotword 114 language model locales supported by this 115 node. e.g. "en_au,en_gb,en_us" 116 The string is empty if the node type is 117 not HOTWORD. 118 119 void GetSystemAecSupported(); 120 121 Returns 1 if system echo cancellation is supported, 122 otherwise return 0. 123 124 void SetActiveOutputNode(uint64 node_id); 125 126 Requests the specified node to be used for 127 output. If node_id is 0 (which is not a valid 128 node id), cras will choose the active node 129 automatically. 130 131 void SetActiveInputNode(uint64 node_id); 132 133 Requests the specified node to be used for 134 input. If node_id is 0 (which is not a valid 135 node id), cras will choose the active node 136 automatically. 137 138 int32 GetNumberOfActiveStreams() 139 140 Returns the number of streams currently being 141 played or recorded. 142 143 int32 GetNumberOfActiveInputStreams() 144 145 Returns the number of streams currently using input hardware. 146 147 int32 GetNumberOfActiveOutputStreams() 148 149 Returns the number of streams currently using output hardware. 150 151 int32 IsAudioOutputActive() 152 153 Returns 1 if there are currently any active output streams, 154 excluding 'fake' streams that are not actually outputting any 155 audio. Returns 0 if there are no active streams, or all active 156 streams are 'fake' streams. 157 158 void SetGlobalOutputChannelRemix(int32 num_channels, 159 array:double coefficient) 160 161 Sets the conversion matrix for global output channel 162 remixing. The coefficient array represents an N * N 163 conversion matrix M, where N is num_channels, with 164 M[i][j] = coefficient[i * N + j]. 165 The remix is done by multiplying the conversion matrix 166 to each N-channel PCM data, i.e M * [L, R] = [L', R'] 167 For example, coefficient [0.1, 0.9, 0.4, 0.6] will 168 result in: 169 L' = 0.1 * L + 0.9 * R 170 R' = 0.4 * L + 0.6 * R 171 172 int32 SetHotwordModel(uint64_t node_id, string model_name) 173 174 Set the hotword language model on the specified node. 175 The node must have type HOTWORD and the model_name must 176 be one of the supported locales returned by 177 GetNodes() HotwordModels string. 178 Returns 0 on success, or a negative errno on failure. 179 180Signals OutputVolumeChanged(int32 volume) 181 182 Indicates that the output volume level has changed. 183 184 OutputMuteChanged(boolean muted, boolean user_muted) 185 186 Indicates that the output mute state has changed. muted 187 is true if the system is muted by a system process, such 188 as suspend or device switch. user_muted is set if the 189 system has been muted by user action such as the mute 190 key. 191 192 InputGainChanged(int32 gain) 193 194 Indicates what the system capture gain is now. gain 195 expressed in dBFS*100. 196 197 InputMuteChanged(boolean muted) 198 199 Indicates that the input mute state has changed. 200 201 NodesChanged() 202 203 Indicates that nodes are added/removed. 204 205 ActiveOutputNodeChanged(uint64 node_id) 206 207 Indicates that the active output node has changed. 208 209 ActiveInputNodeChanged(uint64 node_id) 210 211 Indicates that the active input node has changed. 212 213 OutputNodeVolumeChanged(uint64 node_id, int32 volume) 214 215 Indicates the volume of the given node. 216 217 NodeLeftRightSwappedChanged(uint64 node_id, boolean swapped) 218 219 Indicates the left and right channel swapping state of the 220 given node. 221 222 InputNodeGainChanged(uint64 node_id, int32 gain) 223 224 Indicates that the capture gain for the node is now gain 225 expressed in dBFS*100. 226 227 NumberOfActiveStreamsChanged(int32 num_active_streams) 228 229 Indicates the number of active streams has changed. 230 231 AudioOutputActiveStateChanged(boolean active) 232 233 Indicates active output state has changed. 234 See IsAudioOutputActive for details. 235 236 HotwordTriggered(int64 tv_sec, int64 tv_nsec) 237 238 Indicates that hotword was triggered at the given timestamp. 239