Lines Matching refs:gain
138 static pa_volume_t hsp_gain_to_volume(uint16_t gain) {
140 gain * PA_VOLUME_NORM
152 uint16_t gain = volume * HSP_MAX_GAIN / PA_VOLUME_NORM;
154 if (gain > HSP_MAX_GAIN)
155 gain = HSP_MAX_GAIN;
157 return gain;
760 int gain, dummy;
774 * AT+VGS=value: value between 0 and 15, sent by the HS to AG to set the speaker gain.
775 * +VGS=value is sent by AG to HS as a response to an AT+VGS command or when the gain
777 * AT+VGM=value: value between 0 and 15, sent by the HS to AG to set the microphone gain.
778 * +VGM=value is sent by AG to HS as a response to an AT+VGM command or when the gain
783 if (sscanf(buf, "AT+VGS=%d", &gain) == 1 || sscanf(buf, "\r\n+VGM%*[=:]%d\r\n", &gain) == 1) {
785 pa_log_debug("HS/HF peer supports speaker gain control");
789 t->sink_volume = hsp_gain_to_volume(gain);
793 } else if (sscanf(buf, "AT+VGM=%d", &gain) == 1 || sscanf(buf, "\r\n+VGS%*[=:]%d\r\n", &gain) == 1) {
795 pa_log_debug("HS/HF peer supports microphone gain control");
799 t->source_volume = hsp_gain_to_volume(gain);
885 uint16_t gain = volume_to_hsp_gain(volume);
888 volume = hsp_gain_to_volume(gain);
896 * to change the speaker gain. In the HS role, source and sink are swapped,
897 * so in this case we notify the AG that the microphone gain has changed
900 rfcomm_write_response(trd->rfcomm_fd, "+VGS=%d", gain);
902 rfcomm_write_command(trd->rfcomm_fd, "AT+VGM=%d", gain);
910 uint16_t gain = volume_to_hsp_gain(volume);
913 volume = hsp_gain_to_volume(gain);
921 * to change the microphone gain. In the HS role, source and sink are swapped,
922 * so in this case we notify the AG that the speaker gain has changed
925 rfcomm_write_response(trd->rfcomm_fd, "+VGM=%d", gain);
927 rfcomm_write_command(trd->rfcomm_fd, "AT+VGS=%d", gain);
1006 * speaker and microphone gain.
1007 * On HFP speaker/microphone gain support is reported by bit 4 in the
1009 * applies to speaker or microphone gain but the peer is required to send