Commit Graph

10 Commits

Author SHA1 Message Date
Solomon Peachy 39fff5cb53 move PCM_NATIVE_BITDEPTH definiton into global config code
Change-Id: I391bcffca670916c2c88426e2ba2603351326cee
2021-08-07 11:18:19 -04:00
Dana Conrad 56b0dde545 Higher bitdepth software volume scaling
Operates between 0 and -74 dB (mute) without issue

Change-Id: I497e002bd8db43833a09ebbc29212fbb6cc8ebfd
2021-08-07 14:21:47 +00:00
Dana Conrad 16b0098256 ErosQ Native: Add DC Offset to PCM data
A small negative offset seems to silence all
play/pause clicking on the PCM5102A.

Also adding PCM soft muting, and muting the headphone amp
when the headphones are detected as removed. This has been
tested to not cause any unintended side effects on the
line out.

Also confirmed the numerical dB values are (approx.) correct.

Change-Id: I689d68887c86add9cc5e0ccb0c7de01aaa69b4d9
2021-08-07 14:21:47 +00:00
Dana Conrad a2fd00cf38 Software Volume: Remove sample rounding
Change-Id: I630139333d64b4c8cae86939ecfc52c44a34ffea
2021-08-01 02:20:00 +00:00
Aidan MacDonald e532714d1f pcm: Remove unused function pcm_play_dma_get_peak_buffer()
Change-Id: Ifd20fb14a22489cdb99154c01f69809a1e70d0c5
2021-07-25 14:07:41 +00:00
Solomon Peachy fe2d52cc7d pcm: Get rid of pcm_play_pause() and associated APIs
Nothing in the core has used it for some time.  It's exported to the
plugin API but the last plugins to use it were switched to the mixer API
back in 2011.

This allows us to get rid of pcm_play_dma_pause() from all audio drivers

Change-Id: Ic3fa02592316f84963e41d792d1cabb436d1ff6b
2020-10-31 01:18:27 +00:00
Michael Sevakis 61d0583384 Greatly reduce volume-change zipper artifacts with SW volume.
Uses a cosine factor to smoothly shift the PCM level from the old level
to the new one over the length of a frame.

Implements indirect calls to PCM scaling function instead of testing
conditions on every callback, cleanly assigning a different call to
do the volume transition. The volume change call then assigns the final
scaling function.

Change-Id: If1004b92a91c5ca766dd0e4014ec274636e8ed26
Reviewed-on: http://gerrit.rockbox.org/763
Reviewed-by: Michael Sevakis <jethead71@rockbox.org>
Tested: Michael Sevakis <jethead71@rockbox.org>
2014-03-08 08:04:41 +01:00
Michael Sevakis 08199cd6cb Provide high resolution volume and prescaler to hosted targets.
HAVE_SW_VOLUME_CONTROL is required and at this time only affects the
SDL targets using pcm-sdl.c.

Enables balance control in SDL targets, unless mono volume is in use.

Compiles software volume control as unbuffered when
PCM_SW_VOLUME_UNBUFFERED is defined. This avoids the overhead and
extra latency introduced by the double buffer when it is not needed.
Use this config when the target's PCM driver is buffered and sufficient
latency exists to perform safely the volume scaling.

Simulated targets that are double-buffered when made as native targets
remain so in the sim in order to run the same code.

Change-Id: Ifa77d2d3ae7376c65afecdfc785a084478cb5ffb
Reviewed-on: http://gerrit.rockbox.org/457
Reviewed-by: Michael Sevakis <jethead71@rockbox.org>
Tested-by: Michael Sevakis <jethead71@rockbox.org>
2013-04-27 06:59:27 +02:00
Michael Sevakis 21b62bd893 Make pcm_sw_volume.c a bit less verbose by merging volume code.
pcm_set_master_volume had two implementations, one for a prescaler
and one without one but the differences can be made minimal enough
to combine them.

Change-Id: I889e60b50b9f046c093853cb1685058796fe9067
2013-04-23 21:33:55 -04:00
Michael Sevakis f5a5b94686 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>
2013-04-11 22:55:16 +02:00