* au88x0 PCM Volume control
[not found] <4315C4BC.7040206@netvigator.com>
@ 2005-09-06 8:00 ` Raymond
0 siblings, 0 replies; only message in thread
From: Raymond @ 2005-09-06 8:00 UTC (permalink / raw)
To: alsa-devel; +Cc: Manuel Jander, openvortex-dev
The proposed PCM Volume controls of the playback device 0 of au88x0
driver allow any ALSA application using the PCM Volume control
(.iface=SNDRV_CTL_ELEM_IFACE_PCM) associated to the sudevice to change
the volume (-48dB to 6dB) when the audio passing through the hardware
mixer of au88x0.
Mono
0dB
DMA -> FIFO -> SRC -> MIXIN ---> MIXOUT -> Equalizer -> Front Left
| 0dB
+------> MIXOUT -> Equalizer -> Front Right
| 6dB
+------> MIXOUT --------------> Rear Left
| 6dB
+------> MIXOUT --------------> Rear Right
Stereo
0dB
DMA -> FIFO -> SRC -> MIXIN ---> MIXOUT -> Equalizer -> Front Left
| | 6dB
| +------> MIXOUT --------------> Rear Left
| 0dB
+> SRC -> MIXIN ---> MIXOUT -> Equalizer -> Front Right
| 6dB
+------> MIXOUT --------------> Rear Right
Surround40
0dB
DMA -> FIFO -> SRC -> MIXIN ---> MIXOUT -> Equalizer -> Front Left
| 0dB
+> SRC -> MIXIN ---> MIXOUT -> Equalizer -> Front Right
| 6dB
+> SRC -> MIXIN ---> MIXOUT --------------> Rear Left
| 6dB
+> SRC -> MIXIN ---> MIXOUT --------------> Rear Right
>
> Description of the patch (beta)
> - add PCM Volume control by using the hardware mixer of au88x0
>
>
> TEST AT YOUR OWN RISK !!!
>
> The audio will be distorted when total gain exceed the limit of 18-bits
> DAC in AC97 codec.
>
>
> Any comment/suggestion or programs to test the feature are welcome.
>
>
>> Hi,
>
>
>> On Mon, 2005-08-29 at 10:28 +0800, Raymond wrote:
>> > Distortion occur when the combined gain of audio data, hardware
>> > mixer , equalizer and 3D effect > 6dB ( limit by the 18-bits DAC i
>> > n AC97 codec)
>
>
>> The maximum gain possible for a entire audio pipe should obvisouly not
>> exceeded.
>
Why the hardware mixer in the current ALSA driver is set to zero gain in
vortex_adb_allocroute() when capturing audio from 18-bits ADC to 16-bits
audio ? ( In theory, it should be -6dB )
AC97
16bits Audio 0dB 18bits Analog
DMA <- FIFO <- SRC <- MIXOUT <- MIXIN <- ADC <- MIXER <---- MIC
| |
DMA <- FIFO <- SRC <- MIXOUT <- MIXIN <+ +---------LINE IN
|
+---------VIDEO
|
+---------CD
|
+---------AUX
|
+---------PHONE
|
+---------MIX
>
>> > In the ALSA au88x0 driver, the hardware mixer provide default gain
>> > of 6dB ( 16-bits auido data to 18-bits DAC in AC97 codec ) for the
>> > left/right channels of au8820 and the rear channels of au8810/au8830
>> > (to SDAC of quad codec),
>> >
>> > For the front channels of au8810/au8830, zero gain in hardware mixer
>> > and this 6dB gain is most likely controlled by the equalizer or 3D
>> > effect.
>> >
>
>> I would suggest using the correct signed or unsigned type instead of
>> doing explicit type conversions.
>
static void
vortex_mix_setinputvolumebyte(vortex_t * vortex, unsigned char mix,
int mixin, unsigned char vol)
{
int temp;
hwwrite(vortex->mmio,
VORTEX_MIX_INVOL_A + (((mix << 5) + mixin) << 2), vol);
if (1) { /* this_10, initialized to 1. */
temp =
hwread(vortex->mmio,
VORTEX_MIX_INVOL_B + (((mix << 5) + mixin) << 2));
if ((temp != 0x80) || (vol == 0x80))
return;
}
hwwrite(vortex->mmio,
VORTEX_MIX_INVOL_B + (((mix << 5) + mixin) << 2), vol);
}
static int snd_vortex_adb_pcm_change_vol(vortex_t *vortex,int mixin,int
mix,int volume)
{
if ( volume >= 128 )
vortex_mix_setinputvolumebyte(vortex, mix, mixin, volume-128);
// GAIN
else
if ( volume < 64 )
vortex_mix_setinputvolumebyte(vortex, mix, mixin, 0x80); // MUTE
else
vortex_mix_setinputvolumebyte(vortex, mix, mixin, volume+128); // ATTEN
return 0;
}
-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
^ permalink raw reply [flat|nested] only message in thread