SamY wrote: 
> Is this thread still active? Philippe?

Trying to still have a life...

It's a bug in LMS where negative volume ended-up being reverted. As ou
can see below, there is no protection in the look-up table to negative
volume

Code:
--------------------
    
  sub volume {
        my $client = shift;
        my $newvolume = shift;
  
        my $volume = $client->SUPER::volume($newvolume, @_);
  
        if (defined($newvolume)) {
                # Old style volume:
                my $oldGain = $volume_map[int($volume)];
  
                my $newGain;
                # Negative volume = muting
                if ($volume <= 0) {
                        $newGain = 0;
                }
                else {
                        my $db = $client->getVolume($volume, 
$client->getVolumeParameters());
                        $newGain = $client->dBToFixed($db);
                }
  
                my $dvc = $prefs->client($client)->get('digitalVolumeControl');
                if ( !defined $dvc ) {
                        $dvc = 
$Slim::Player::Player::defaultPrefs->{digitalVolumeControl};
                }
  
                my $preamp = 255 - int( 2 * ( 
$prefs->client($client)->get('preampVolumeControl') || 0 ) );
  
                my $data;
                my $balance = $prefs->client($client)->get('balance') || 0;
                my $left = $balance > 0 ? (25 - $balance) / 25 : 1;
                my $right = $balance < 0 ? (25 + $balance) / 25 : 1;
  
                if (defined($client->controllerSequenceId())) {
                        $data = pack('NNCCNNNa6', $oldGain*$left, 
$oldGain*$right, $dvc, $preamp, $newGain*$left, $newGain*$right,
                                ($client->controllerSequenceNumber() || 0), 
$client->controllerSequenceId());
                }
                elsif (defined($client->sequenceNumber())) {
                        $data = pack('NNCCNNN', $oldGain*$left, 
$oldGain*$right, $dvc, $preamp, $newGain*$left, $newGain*$right, 
$client->sequenceNumber());
                }
                else {
                        $data = pack('NNCCNN', $oldGain*$left, $oldGain*$right, 
$dvc, $preamp, $newGain*$left, $newGain*$right);
                }
                $client->sendFrame('audg', \$data);
        }
        return $volume;
  }
  
--------------------



LMS 8.1.x on Odroid-C4 - *SqueezeAMP!*, 5xRadio, 5xBoom, 2xDuet,
1xTouch, 1xSB3. Sonos PLAY:3, PLAY:5, Marantz NR1603, Foobar2000,
ShairPortW, 2xChromecast Audio, Chromecast v1 and v2, Squeezelite on Pi,
Yamaha WX-010, AppleTV 4, Airport Express, GGMM E5, RivaArena 1 & 3
------------------------------------------------------------------------
philippe_44's Profile: http://forums.slimdevices.com/member.php?userid=17261
View this thread: http://forums.slimdevices.com/showthread.php?t=104614

_______________________________________________
plugins mailing list
plugins@lists.slimdevices.com
http://lists.slimdevices.com/mailman/listinfo/plugins

Reply via email to