Rockbox mail archiveSubject: Re: Volume control in the digital domain
Re: Volume control in the digital domain
From: john <ruttmannn_at_gmx.de>
Date: Fri, 10 Nov 2006 09:50:13 +0100
answering myself might seem strange, but as no one else does...
Seriously: It seems there is absolutely no code in the firmware that
allows changing the volume by manipulating the digital audio data. If
I am wrong, please tell me.
So I decided to give it a try myself. The feature should be fairly
easy to implement, as basically all is needed is multiplying every
sample by a float value, before stuffing it into the pcm buffer. Okay,
this first version would not be perfect, as changing volume would have
some delay with the data already in the pcm buffer. A more capable
version could throw away pcm data, that reaches too long into the
future and refill it, thus minimizing the delay.
But that first version would be VERY useful with active replaygain at
playback, as the volume is not manually controlled.
Fairly easy implementation is a quite relative term: Although I am
quite used to programming embedded systems (my current toy is a 400Mhz
Freescale 603 core), I am totally new to rockbox development. And
most, if not all, of the CPUs do not have a floating point unit.
At least three things are needed:
Reading the current volume.
Reading the current replaygain.
Multiplying every pcm sample by a factor based on volume and
replaygain, just before it is stuffed into the pcm buffer.
Would someone please direct me to the relavant code parts? Thanks.
Received on 2006-11-10