JamesMcBride wrote: 
> Hi,
> zones 2 and 3 don't support the .5 increments in volume, so the likes
> of 
> 
> > 
Code:
--------------------
  >   > 
  > [13-06-25 12:56:52.7217] 
Plugins::DenonSerial::Plugin::processCommandFromQueue (481) for 
00:04:20:e1:18:3f , send command Z2385, queue length 1
  > 
--------------------
> > 
> 
> are ignored (noted, I guess, by the lack of response).

Cool, thanks for the info, and I'm sorry I missed that in Denon's
documentation. I haven't tested this yet (my server is running code not
even pushed to my dev repo), but I think a better change would probably
be passing in the zone number and only rounding if it's not zone 1:


Code:
--------------------
    
  --- ./Plugin.pm       2013/07/24 12:50:16     1.3
  +++ ./Plugin.pm       2013/07/28 16:46:09
  @@ -299,7 +299,8 @@
                return &$originalMISdBFunction(@args);
        }
        my $ampMax = $prefs->client($client)->get('ampMaxVolume');
  -     my $dVolume = &volumeSBToDenon($volume,$ampMax);
  +     my $zone = $prefs->client($client)->get('ampZone'); 
  +     my $dVolume = &volumeSBToDenon($volume,$ampMax,$zone);
        # 99 means nothing; MIS needs to see this as a number < -99
        if ( $dVolume == 99 ) { return -100; }
        # else, subtract 80 (98 = +18 db, 80 = 0 dB, 70 = -10 dB)
  @@ -307,10 +308,11 @@
        return ($dVolume - 80);
  }
  
  -sub volumeSBToDenon($$) {
  -     my ($sbVol,$ampMax) = @_;
  +sub volumeSBToDenon($$$) {
  +     my ($sbVol,$ampMax,$zone) = @_;
        # amp volume should be in increments of 0.5 between 0 and 98;
        my $ampTo =  int(2 * (($sbVol / 100 * ($ampMax + 81)) - 1)) / 2;
  +     if ( $zone > 1 ) { $ampTo = int($ampTo); } # zones 2+ cannot handle 
half-decibel changes
        if ( $ampTo > 98 ) { $ampTo = 98; }     # max 98
        if ( $ampTo < 0 ) { $ampTo = 99; }      # minimum = 99 (weird, I know)
        my $sbEquiv = &volumeDenonToSB($ampTo,$ampMax);
  @@ -351,9 +353,10 @@
        my ($client,$newvalue) = @_;
        my $id = $client->id();
        my $ampMax = $prefs->client($client)->get('ampMaxVolume');
  +     my $zone = $prefs->client($client)->get('ampZone'); 
        # amp volume: 0 - 99, 80 = 0 dB, 99 = min
        # i.e. amp 0 = -80 dB, amp 80 = 0Db, amp 18 = +18 dB ??
  -     my $ampTo =  &volumeSBToDenon($newvalue,$ampMax);
  +     my $ampTo =  &volumeSBToDenon($newvalue,$ampMax,$zone);
        $log->debug("for ".$client->name()." should set amp volume to $ampTo of 
".(80 + $ampMax)." (SB volume $newvalue)");
        $playerInfo{$id}->{ampVolumeTarget} = $ampTo;
        # actually set the amp volume
  
--------------------



http://www.tux.org/~peterw/ 
Note: The best way to reach me is email or PM, as I don't spend time on
the forums.
*Free plugins:*  AllQuiet Auto Dim/AutoDisplay BlankSaver ContextMenu
DenonSerial
FuzzyTime KidsPlay KitchenTimer PlayLog PowerCenter/BottleRocket
SaverSwitcher
SettingsManager SleepFade StatusFirst SyncOptions VolumeLock
------------------------------------------------------------------------
peterw's Profile: http://forums.slimdevices.com/member.php?userid=2107
View this thread: http://forums.slimdevices.com/showthread.php?t=67182

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

Reply via email to