PDA

View Full Version : How to patch SS code for volume control bug?



vdorta
2005-11-20, 08:02
I have followed the volume control bug (http://forums.slimdevices.com/showthread.php?t=17269) plus revert-to-firmware-15 discussion and hope this will be solved soon.

A recent post has the following:

"Please note that there is a bug relating to latest versions of firmware that affects the SB volume control. You should patch the SS code with the suggested patch to avoid any volume control rounding problems."

I believe the patch is this one:

- return int(($floatmult * (1 << 16)) + 0.5);
+ if ($db >= -35 && $db <= 0) {
+ return int($floatmult * (1 << 8) + 0.5) * (1 << 8);
+ }
+ else {
+ return int(($floatmult * (1 << 16)) + 0.5);
+ }

I also understand that if one uses this patch, firmware 15 is not needed any more, and anyway it makes sense to have the latest code and firmware.

Would somebody post simple instructions on how to install the patch for Windows, Linux and Mac?

Patrick Dixon
2005-11-20, 09:18
Edit the file Squeezebox2.pm in the sub-directory Slim/Player/ to change the section:

sub dBToFixed {
my $db = shift;

# Map a floating point dB value to a 16.16 fixed point value to
# send as a new style volume to SB2 (FW 22+).
my $floatmult = 10 ** ($db/20);
return int(($floatmult * (1 << 16)) + 0.5);
}


to:

sub dBToFixed {
my $db = shift;

# Map a floating point dB value to a 16.16 fixed point value to
# send as a new style volume to SB2 (FW 22+).
my $floatmult = 10 ** ($db/20);
if ($db >= -30 && $db <= 0) {
return int($floatmult * (1 << 8) + 0.5) * (1 << 8);
}
else {
return int(($floatmult * (1 << 16)) + 0.5);
}
}


Then restart Slimserver.

sbjaerum
2005-11-20, 10:15
Edit the file Squeezebox2.pm in the sub-directory Slim/Player/ to change the section:

sub dBToFixed {
my $db = shift;

# Map a floating point dB value to a 16.16 fixed point value to
# send as a new style volume to SB2 (FW 22+).
my $floatmult = 10 ** ($db/20);
return int(($floatmult * (1 << 16)) + 0.5);
}


to:

sub dBToFixed {
my $db = shift;

# Map a floating point dB value to a 16.16 fixed point value to
# send as a new style volume to SB2 (FW 22+).
my $floatmult = 10 ** ($db/20);
if ($db >= -30 && $db <= 0) {
return int($floatmult * (1 << 8) + 0.5) * (1 << 8);
}
else {
return int(($floatmult * (1 << 16)) + 0.5);
}
}


Then restart Slimserver.

This will of course only work if you are running the perl version of slimserver, and not the compiled Windows binary.

Steinar

Patrick Dixon
2005-11-20, 10:37
I was under the impression that the windows version used the same Perl code as Linux, but shipped with the CPAN Perl modules required to run it, so that you didn't need to install/run ActivePerl. If so, wouldn't the patch work the same?

Or am I wrong?

pfarrell
2005-11-20, 10:45
On Sun, 2005-11-20 at 09:15 -0800, sbjaerum wrote:
> This will of course only work if you are running the perl version of
> slimserver, and not the compiled Windows binary.

I'm not sure that this is true. I thought that the "windows binary" was
just perl and the perl source needed to run. Perl really isn't
a compiled language.


--
Pat
http://www.pfarrell.com/music/slimserver/slimsoftware.html

sbjaerum
2005-11-20, 12:20
On Sun, 2005-11-20 at 09:15 -0800, sbjaerum wrote:
> This will of course only work if you are running the perl version of
> slimserver, and not the compiled Windows binary.

I'm not sure that this is true. I thought that the "windows binary" was
just perl and the perl source needed to run. Perl really isn't
a compiled language.


--
Pat
http://www.pfarrell.com/music/slimserver/slimsoftware.html

My understanding is that the windows .exe version is built using the Activestate Perl Dev Kit. That means that you do not have to have the Perl interpreter installed to run slimserver on Windows. To apply patches you will have to rebuild.

Running the perl version of slimserver means that patches in perl source code does not need a rebuild.

Someone with more knowledge in perl than me, should probably explain how the .exe is built using the Perl Dev Kit.

Steinar

MrKegFlex
2005-11-20, 13:18
I have followed the volume control bug (http://forums.slimdevices.com/showthread.php?t=17269) plus revert-to-firmware-15 discussion and hope this will be solved soon.


I don't think I followed the steps properly to revert back to firmware 15. I have 6.2.0 and 6.1.1. I copied the files from server/Firmware in 6.1.1 to the same directory in 6.2.0. Restared my SB2 and it said it was updating the firmware. However, when I look at the settings in the SB2 after the update, it says it is firmware 26. I'm confused.

MrKegFlex
2005-11-21, 08:01
I don't think I followed the steps properly to revert back to firmware 15. I have 6.2.0 and 6.1.1. I copied the files from server/Firmware in 6.1.1 to the same directory in 6.2.0. Restared my SB2 and it said it was updating the firmware. However, when I look at the settings in the SB2 after the update, it says it is firmware 26. I'm confused.

For some reason, I couldn't get firmware 15 to install on the SB2 using 6.2.0. I removed 6.2.0 and reinstalled 6.1.1 and had no trouble getting the firmware back 15. I swapped back and forth between the different firmware revisions and slimserver software and feel 6.1.1 with revision 15 sounds the best. Maybe, I'm just hearing things but, to me, it was pretty obvious that 6.2.0 with firmware 26 was a noticeable step backwards.

tass
2005-11-21, 16:10
If you've left old (newer!) files in the firmware directory, it's probably still putting you onto the latest version. To do what you are after, you should clean the firmware folder out first. On saying this, though, do old firmware releases work with 6.2?

Also, you'd be best performing a blind test as things can sound better when you think they're going to. Get someone else to swap server randomly without you knowing which one and see if you can hear the difference.