Home | History | Annotate | only in /external/adhd/cras
Up to higher level directory
NameDateSize
configure.ac21-Aug-20185.1K
cras.mk21-Aug-2018938
examples/21-Aug-2018
git_prepare.sh21-Aug-2018239
libcras.pc.in21-Aug-2018248
Makefile.am21-Aug-2018273
README21-Aug-20184.9K
README.dbus-api21-Aug-20186.6K
src/21-Aug-2018
tools/21-Aug-2018

README

      1 CRAS = ChromeOS Audio Server
      2 
      3 Directories
      4 src/server - the source for the sound server
      5 src/libcras - client library for interacting with cras
      6 src/common - files common to both the server and library
      7 src/tests - tests for cras and libcras
      8 
      9 Building from source:
     10 ./git_prepare.sh
     11 ./configure
     12 make
     13 sudo make install
     14 
     15 ---------------------
     16 Configuration:
     17 ---------------------
     18 
     19 Device Blacklisting:
     20 --------------------
     21 Blacklist of certain USB output device(s) is possible by modifying the config
     22 file /etc/cras/device_blacklist.
     23 
     24 The format of this file is as follows:
     25 
     26 [USB_Outputs]
     27   <vendor_id>_<product_id>_<checksum>_<device_index> = 1
     28 
     29 Where vendor_id and product id are the USB identifiers for the card to
     30 blacklist. The checksum is the output of "cksum" command applied to the
     31 sysfs "descriptors" file of the device. The device index specifies the
     32 index of the output device in the card to blacklist.  This is a bool
     33 parameter, so '= 1' enables the option.
     34 
     35 Example, blacklisting the non-functional output device reported by the C-Media
     36 based CAD-u1 mic:
     37 
     38 [USB_Outputs]
     39   0d8c_0008_00000000_0 = 1
     40 
     41 Card Configuration:
     42 -------------------
     43 There can be a config file for each sound alsa card on the system.  This file
     44 lives in /etc/cras/.  The file should be named with the card name returned by
     45 ALSA, the string in the second set of '[]' in the aplay -l output.  The ini file
     46 has the following format.
     47 
     48 [<output-node-name>] ; Name of the mixer control for this output.
     49   <config-option> = <config-value>
     50 
     51 output-node-name can be speficied in a few ways to link with the real node:
     52   UCM device name - The name string following the SectionDevice label in UCM
     53     config, i.e. HiFi.conf
     54   Jack name - Name of the mixer control for mixer jack, or the gpio jack name
     55     listed by 'evtest' command.
     56   Mixer control name - e.g. "Headphone" or "Speaker", listed by
     57     'amixer scontrols' command.
     58 
     59 Note that an output node matches to the output-node-name label in card config by
     60 priorty ordered above. For example if a node has UCM device, it will first
     61 search the config file for the UCM device name. When not found, jack name will
     62 be used for searching, and lastly the mixer output control name.
     63 
     64 config-option can be the following:
     65   volume_curve - The type of volume curve, "simple_step" or "explicit".
     66   Options valid and mandatory when volume_curve = simple_step:
     67     max_volume - The maximum volume for this output specified in dBFS * 100.
     68     volume_step - Number of dB per volume 'tick' specified in  dBFS * 100.
     69   Options valid and mandatory when volume_curve = explicit:
     70     dB_at_N - The value in dB*100 that should be used for the volume at step
     71       "N".  There must be one of these for each setting from N=0 to 100
     72       inclusive.
     73 
     74 
     75 Example:
     76 This example configures the Headphones to have a max volume of -3dBFS with a
     77 step size of 0.75dBFS and the Speaker to have the curve specified by the steps
     78 given, which is a 1dBFS per step curve from max = +0.5dBFS to min = -99.5dBFS
     79 (volume step 10 is -89.5dBFS).
     80 
     81 [Headphone]
     82   volume_curve = simple_step
     83   volume_step = 75
     84   max_volume = -300
     85 [Speaker]
     86   volume_curve = explicit
     87   dB_at_0 = -9950
     88   dB_at_1 = -9850
     89   dB_at_2 = -9750
     90   dB_at_3 = -9650
     91   dB_at_4 = -9550
     92   dB_at_5 = -9450
     93   dB_at_6 = -9350
     94   dB_at_7 = -9250
     95   dB_at_8 = -9150
     96   dB_at_9 = -9050
     97   dB_at_10 = -8950
     98   dB_at_11 = -8850
     99   dB_at_12 = -8750
    100   dB_at_13 = -8650
    101   dB_at_14 = -8550
    102   dB_at_15 = -8450
    103   dB_at_16 = -8350
    104   dB_at_17 = -8250
    105   dB_at_18 = -8150
    106   dB_at_19 = -8050
    107   dB_at_20 = -7950
    108   dB_at_21 = -7850
    109   dB_at_22 = -7750
    110   dB_at_23 = -7650
    111   dB_at_24 = -7550
    112   dB_at_25 = -7450
    113   dB_at_26 = -7350
    114   dB_at_27 = -7250
    115   dB_at_28 = -7150
    116   dB_at_29 = -7050
    117   dB_at_30 = -6950
    118   dB_at_31 = -6850
    119   dB_at_32 = -6750
    120   dB_at_33 = -6650
    121   dB_at_34 = -6550
    122   dB_at_35 = -6450
    123   dB_at_36 = -6350
    124   dB_at_37 = -6250
    125   dB_at_38 = -6150
    126   dB_at_39 = -6050
    127   dB_at_40 = -5950
    128   dB_at_41 = -5850
    129   dB_at_42 = -5750
    130   dB_at_43 = -5650
    131   dB_at_44 = -5550
    132   dB_at_45 = -5450
    133   dB_at_46 = -5350
    134   dB_at_47 = -5250
    135   dB_at_48 = -5150
    136   dB_at_49 = -5050
    137   dB_at_50 = -4950
    138   dB_at_51 = -4850
    139   dB_at_52 = -4750
    140   dB_at_53 = -4650
    141   dB_at_54 = -4550
    142   dB_at_55 = -4450
    143   dB_at_56 = -4350
    144   dB_at_57 = -4250
    145   dB_at_58 = -4150
    146   dB_at_59 = -4050
    147   dB_at_60 = -3950
    148   dB_at_61 = -3850
    149   dB_at_62 = -3750
    150   dB_at_63 = -3650
    151   dB_at_64 = -3550
    152   dB_at_65 = -3450
    153   dB_at_66 = -3350
    154   dB_at_67 = -3250
    155   dB_at_68 = -3150
    156   dB_at_69 = -3050
    157   dB_at_70 = -2950
    158   dB_at_71 = -2850
    159   dB_at_72 = -2750
    160   dB_at_73 = -2650
    161   dB_at_74 = -2550
    162   dB_at_75 = -2450
    163   dB_at_76 = -2350
    164   dB_at_77 = -2250
    165   dB_at_78 = -2150
    166   dB_at_79 = -2050
    167   dB_at_80 = -1950
    168   dB_at_81 = -1850
    169   dB_at_82 = -1750
    170   dB_at_83 = -1650
    171   dB_at_84 = -1550
    172   dB_at_85 = -1450
    173   dB_at_86 = -1350
    174   dB_at_87 = -1250
    175   dB_at_88 = -1150
    176   dB_at_89 = -1050
    177   dB_at_90 = -950
    178   dB_at_91 = -850
    179   dB_at_92 = -750
    180   dB_at_93 = -650
    181   dB_at_94 = -550
    182   dB_at_95 = -450
    183   dB_at_96 = -350
    184   dB_at_97 = -250
    185   dB_at_98 = -150
    186   dB_at_99 = -50
    187   dB_at_100 = 50
    188 

README.dbus-api

      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