summaryrefslogtreecommitdiff
path: root/lib/rbcodec/dsp/dsp_misc.c
diff options
context:
space:
mode:
authorMichael Sevakis <jethead71@rockbox.org>2013-04-05 04:36:05 -0400
committerMichael Sevakis <jethead71@rockbox.org>2013-04-11 22:55:16 +0200
commitf5a5b946867677de76c405ee72e2ea47e36e4c83 (patch)
tree8fb97a35059a16681b726973b4a5e13d41f96a35 /lib/rbcodec/dsp/dsp_misc.c
parenta9049a79d706dba61837ad02c7d7e3475cb6c193 (diff)
downloadrockbox-f5a5b946867677de76c405ee72e2ea47e36e4c83.tar.gz
rockbox-f5a5b946867677de76c405ee72e2ea47e36e4c83.zip
Implement universal in-PCM-driver software volume control.
Implements double-buffered volume, balance and prescaling control in the main PCM driver when HAVE_SW_VOLUME_CONTROL is defined ensuring that all PCM is volume controlled and level changes are low in latency. Supports -73 to +6 dB using a 15-bit factor so that no large-integer math is needed. Low-level hardware drivers do not have to implement it themselves but parameters can be changed (currently defined in pcm-internal.h) to work best with a particular SoC or to provide different volume ranges. Volume and prescale calls should be made in the codec driver. It should appear as a normal hardware interface. PCM volume calls expect .1 dB units. Change-Id: Idf6316a64ef4fb8abcede10707e1e6c6d01d57db Reviewed-on: http://gerrit.rockbox.org/423 Reviewed-by: Michael Sevakis <jethead71@rockbox.org> Tested-by: Michael Sevakis <jethead71@rockbox.org>
Diffstat (limited to 'lib/rbcodec/dsp/dsp_misc.c')
-rw-r--r--lib/rbcodec/dsp/dsp_misc.c18
1 files changed, 0 insertions, 18 deletions
diff --git a/lib/rbcodec/dsp/dsp_misc.c b/lib/rbcodec/dsp/dsp_misc.c
index 1083215c17..a8c9423cfb 100644
--- a/lib/rbcodec/dsp/dsp_misc.c
+++ b/lib/rbcodec/dsp/dsp_misc.c
@@ -35,11 +35,6 @@
35#endif 35#endif
36#include <string.h> 36#include <string.h>
37 37
38#if defined(HAVE_SW_TONE_CONTROLS) && defined(HAVE_SW_VOLUME_CONTROL)
39/* Still need this for volume control */
40#include "settings.h"
41#endif
42
43/** Firmware callback interface **/ 38/** Firmware callback interface **/
44 39
45/* Hook back from firmware/ part of audio, which can't/shouldn't call apps/ 40/* Hook back from firmware/ part of audio, which can't/shouldn't call apps/
@@ -58,19 +53,6 @@ int dsp_callback(int msg, intptr_t param)
58 case DSP_CALLBACK_SET_TREBLE: 53 case DSP_CALLBACK_SET_TREBLE:
59 tone_set_treble(param); 54 tone_set_treble(param);
60 break; 55 break;
61 /* FIXME: This must be done by bottom-level PCM driver so it works with
62 all PCM, not here and not in mixer. I won't fully support it
63 here with all streams. -- jethead71 */
64#ifdef HAVE_SW_VOLUME_CONTROL
65 case DSP_CALLBACK_SET_SW_VOLUME:
66 if (global_settings.volume < SW_VOLUME_MAX ||
67 global_settings.volume > SW_VOLUME_MIN)
68 {
69 int vol_gain = get_replaygain_int(global_settings.volume * 100);
70 pga_set_gain(PGA_VOLUME, vol_gain);
71 }
72 break;
73#endif /* HAVE_SW_VOLUME_CONTROL */
74#endif /* HAVE_SW_TONE_CONTROLS */ 56#endif /* HAVE_SW_TONE_CONTROLS */
75 case DSP_CALLBACK_SET_CHANNEL_CONFIG: 57 case DSP_CALLBACK_SET_CHANNEL_CONFIG:
76 channel_mode_set_config(param); 58 channel_mode_set_config(param);