diff options
author | Dana Conrad <dconrad@fastmail.com> | 2021-04-13 20:59:45 -0500 |
---|---|---|
committer | Solomon Peachy <pizza@shaftnet.org> | 2021-04-17 12:09:19 +0000 |
commit | 4dc602dd7f763a2ceea7c3e01501cdc3e9de375c (patch) | |
tree | 73dddc9beed4b103940f50415d6575496332f8e6 /firmware/drivers/audio/erosqlinux_codec.c | |
parent | a9d3e9a13d17c9036e88b4e4a0df40f210cf06d6 (diff) | |
download | rockbox-4dc602dd7f763a2ceea7c3e01501cdc3e9de375c.tar.gz rockbox-4dc602dd7f763a2ceea7c3e01501cdc3e9de375c.zip |
erosq: Tweak volume scale to be approximately correct
Tested on eros q, everything measured from line out,
open circuit.
- volume steps were approximately double the dB they
were labelled as, so "-2 dB" would result in a change
of about -4 dB from maximum (0, +6.2dBV)
- maximum volume defining the line out volume only
changed every 10 values, and then was not close
to correct- "-10 dB" resulted in -2.5 dB from maximum
This gets the volume dB approximately correct, and
maximum volume correctly sets the line out volume.
I was unable to get odd values in the max volume
to work, so set the step size to 2 instead of one.
For "consumer level" (-10dBV), set to -16.
For "Pro level" (+4dBu -> ~1.8dBV), set to -4.
Change-Id: I898b85d768153579a893b23551019af88f865d21
Diffstat (limited to 'firmware/drivers/audio/erosqlinux_codec.c')
-rw-r--r-- | firmware/drivers/audio/erosqlinux_codec.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/firmware/drivers/audio/erosqlinux_codec.c b/firmware/drivers/audio/erosqlinux_codec.c index 2b7d819e82..02c35e3c00 100644 --- a/firmware/drivers/audio/erosqlinux_codec.c +++ b/firmware/drivers/audio/erosqlinux_codec.c | |||
@@ -151,7 +151,7 @@ void audiohw_set_frequency(int fsel) | |||
151 | } | 151 | } |
152 | 152 | ||
153 | /* min/max for pcm volume */ | 153 | /* min/max for pcm volume */ |
154 | const int min_pcm = -430; | 154 | const int min_pcm = -740; |
155 | const int max_pcm = 0; | 155 | const int max_pcm = 0; |
156 | 156 | ||
157 | void audiohw_set_volume(int vol_l, int vol_r) | 157 | void audiohw_set_volume(int vol_l, int vol_r) |
@@ -169,7 +169,7 @@ void audiohw_set_volume(int vol_l, int vol_r) | |||
169 | output gain, we have to back off on the PCM signal | 169 | output gain, we have to back off on the PCM signal |
170 | to avoid blowing out the signal. | 170 | to avoid blowing out the signal. |
171 | */ | 171 | */ |
172 | l = r = global_settings.volume_limit; | 172 | l = r = global_settings.volume_limit * 10; |
173 | } else { | 173 | } else { |
174 | l = vol_l_hw; | 174 | l = vol_l_hw; |
175 | r = vol_r_hw; | 175 | r = vol_r_hw; |
@@ -177,7 +177,7 @@ void audiohw_set_volume(int vol_l, int vol_r) | |||
177 | 177 | ||
178 | int sw_volume_l = l <= min_pcm ? min_pcm : MIN(l, max_pcm); | 178 | int sw_volume_l = l <= min_pcm ? min_pcm : MIN(l, max_pcm); |
179 | int sw_volume_r = r <= min_pcm ? min_pcm : MIN(r, max_pcm); | 179 | int sw_volume_r = r <= min_pcm ? min_pcm : MIN(r, max_pcm); |
180 | pcm_set_mixer_volume(sw_volume_l / 10, sw_volume_r / 10); | 180 | pcm_set_mixer_volume(sw_volume_l / 20, sw_volume_r / 20); |
181 | } | 181 | } |
182 | 182 | ||
183 | void audiohw_set_lineout_volume(int vol_l, int vol_r) | 183 | void audiohw_set_lineout_volume(int vol_l, int vol_r) |
@@ -190,7 +190,7 @@ void audiohw_set_lineout_volume(int vol_l, int vol_r) | |||
190 | (void)vol_r; | 190 | (void)vol_r; |
191 | 191 | ||
192 | if (lineout_inserted()) { | 192 | if (lineout_inserted()) { |
193 | l = r = global_settings.volume_limit; | 193 | l = r = global_settings.volume_limit * 10; |
194 | } else { | 194 | } else { |
195 | l = vol_l_hw; | 195 | l = vol_l_hw; |
196 | r = vol_r_hw; | 196 | r = vol_r_hw; |
@@ -198,5 +198,5 @@ void audiohw_set_lineout_volume(int vol_l, int vol_r) | |||
198 | 198 | ||
199 | int sw_volume_l = l <= min_pcm ? min_pcm : MIN(l, max_pcm); | 199 | int sw_volume_l = l <= min_pcm ? min_pcm : MIN(l, max_pcm); |
200 | int sw_volume_r = r <= min_pcm ? min_pcm : MIN(r, max_pcm); | 200 | int sw_volume_r = r <= min_pcm ? min_pcm : MIN(r, max_pcm); |
201 | pcm_set_mixer_volume(sw_volume_l / 10, sw_volume_r / 10); | 201 | pcm_set_mixer_volume(sw_volume_l / 20, sw_volume_r / 20); |
202 | } | 202 | } |