Bryan Mayland wrote:
Bryan Mayland wrote:
This is true of a PVR-250 / 150 combo here too. My 250 is louder
than my 150 on the same source. I actually fired up this machine to
start playing around with it. I wrote the volume controls for the
150/500 under the assumption that the volume should scale from -96dB
to +0dB. That would mean that a default myth install (which wants to
do 90% volume) would fall at -9.6dB. I'm going to try to run some of
the same source audio through the analyzer and see if I can come up
with the same range as the msp3400 on the pvr-250/350.
If anyone has a datasheet for a msp3400, that would help too.
Nevermind, I found a datasheet that lists it as going from +12dB to
-114dB in 1/8th dB steps soooo at 90% a PVR-250/350 is just about at
+0dB, which does support our claims. I'm going to make a patch up to
tweak the cx25840 to be more like the msp3400.
Well... dammit. After implementing the change, now my PVR150 is
louder than the 250. Checking both their settings at the register
level, they're both set to +0. Playing around, it seems that the 150 is
4dB louder all the time. I "hacked" one of the constants to account for
this and now they both have the same apparent volume, 250 is set at +0,
150 is set at -4, both show as 58880 in the volume control.
I'm curious everyone else has the same 4dB shift I do, or if we're
going to have to do something to have another gain control in the
driver. This would be a big pain since it should be set per card, and
then the problem becomes where to store it (it would probably be a
module param, but after it is set, I think it should go into the
decoder_state struct attatched to the i2c_client). Hopefully we won't
have to go there. Can you folks try this patch out and see if your
volume sounds equal now?
Index: driver/cx25840-audio.c
===================================================================
--- driver/cx25840-audio.c (revision 339)
+++ driver/cx25840-audio.c (working copy)
@@ -273,12 +273,12 @@
* we stop the microcontroller and mute all inputs */
va->flags = VIDEO_AUDIO_TREBLE | VIDEO_AUDIO_BASS;
- /* Volume runs +18dB to -96dB, change to -96dB to +0dB */
- va->step = 193;
- va->volume = cx25840_read_setting(client, PATH1_VOLUME);
- //va->volume = (0xff - va->volume) << 8;
- va->volume = (va->volume <= 36) ? 0xffff :
- 0xffff - ((va->volume - 36) * 0xffff / va->step);
+ /* Volume runs +18dB to -96dB in 1/2dB steps
+ * change to fit the msp3400 -114dB to +12dB range */
+ va->step = 228;
+ va->volume = 228 - cx25840_read_setting(client, PATH1_VOLUME);
+ va->volume = (va->volume / 2) + 23;
+ va->volume = va->volume << 9;
/* bass is 49 steps +12dB to -12dB */
va->bass = cx25840_read_setting(client, PATH1_EQ_BASS_VOL);
va->bass = (((48 - va->bass) * 0xffff) + 47) / 48;
@@ -296,8 +296,16 @@
void cx25840_set_v4l_audio(struct i2c_client *client, struct video_audio *va)
{
- //int volume = 0xff - (va->volume >> 8);
- int volume = 229 - (va->volume * 193 / 0xffff);
+ // First convert the volume to msp3400 values (0-127)
+ int volume = va->volume >> 9;
+ // now scale it up to cx25840 values
+ // -114dB to -96dB maps to 0
+ // this should be 19, but in my testing that was 4dB too loud
+ if (volume <= 23)
+ volume = 0;
+ else
+ volume -= 23;
+ volume = 228 - (volume * 2);
int bass = 48 - (va->bass * 48 / 0xffff);
int treble = 48 - (va->treble * 48 / 0xffff);
int balance = va->balance >> 8;