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