Author: bklaas
Date: Mon Feb  7 15:25:53 2011
New Revision: 9303

URL: http://svn.slimdevices.com/jive?rev=9303&view=rev
Log:
Bug: 14807
Description: in _audg, set audioGain to 65536 on both channels when 100% fixed 
volume is set for the player
Simplify setting the slider on NP screen with a _setVolumeSliderStyle() method
Fix UI bug on NP screen when switching control between different players with 
different volume settings

Modified:
    
7.6/trunk/squeezeplay/src/squeezeplay/share/applets/NowPlaying/NowPlayingApplet.lua
    7.6/trunk/squeezeplay/src/squeezeplay/share/jive/audio/Playback.lua

Modified: 
7.6/trunk/squeezeplay/src/squeezeplay/share/applets/NowPlaying/NowPlayingApplet.lua
URL: 
http://svn.slimdevices.com/jive/7.6/trunk/squeezeplay/src/squeezeplay/share/applets/NowPlaying/NowPlayingApplet.lua?rev=9303&r1=9302&r2=9303&view=diff
==============================================================================
--- 
7.6/trunk/squeezeplay/src/squeezeplay/share/applets/NowPlaying/NowPlayingApplet.lua
 (original)
+++ 
7.6/trunk/squeezeplay/src/squeezeplay/share/applets/NowPlaying/NowPlayingApplet.lua
 Mon Feb  7 15:25:53 2011
@@ -389,10 +389,26 @@
 
 
 function notify_playerDigitalVolumeControl(self, player, digitalVolumeControl)
-       log:info('notify_playerDigitalVolumeControl')
-       self.digitalVolumeControl = digitalVolumeControl
+       if player ~= self.player then
+               return
+       end
+       log:info('notify_playerDigitalVolumeControl: ', digitalVolumeControl)
+       self:_setVolumeSliderStyle()
+end
+
+
+function notify_playerRepeatModeChange(self, player, repeatMode)
+       if player ~= self.player then
+               return
+       end
+       log:debug("notify_playerRepeatModeChange(): ", repeatMode)
+       self:_updateRepeat(repeatMode)
+end
+
+
+function _setVolumeSliderStyle(self)
        if self.volSlider then
-               if digitalVolumeControl == 0 then
+               if self.player:getDigitalVolumeControl() == 0 then
                        log:info('disable volume UI in NP')
                        self.volSlider:setStyle('npvolumeB_disabled')
                        self.volSlider:setEnabled(false)
@@ -405,14 +421,6 @@
                        self.fixedVolumeSet = false
                end
        end
-end
-
-function notify_playerRepeatModeChange(self, player, repeatMode)
-       if player ~= self.player then
-               return
-       end
-       log:debug("notify_playerRepeatModeChange(): ", repeatMode)
-       self:_updateRepeat(repeatMode)
 end
 
 
@@ -596,6 +604,8 @@
        log:debug("notify_playerCurrent(): ", player)
 
        self.player = player
+       self:_setVolumeSliderStyle()
+
        if not self.player then
                return
        end
@@ -1532,13 +1542,7 @@
                        end
                        )
 
-       self.fixedVolumeSet = self.player:getDigitalVolumeControl() == 0
-       local volumeSliderStyle = 'npvolumeB'
-       if self.digitalVolumeControl == 0 then
-               volumeSliderStyle = 'npvolumeB_disabled'
-       end
-
-       self.volSlider = Slider(volumeSliderStyle, 0, 100, 0,
+       self.volSlider = Slider('npvolumeB', 0, 100, 0,
                        function(slider, value, done)
                                if self.fixedVolumeSet then
                                        log:info('FIXED VOLUME. DO NOTHING')
@@ -1671,13 +1675,10 @@
                window:addWidget(self.visuGroup)
        end
 
+       self:_setVolumeSliderStyle()
+
        window:addWidget(self.controlsGroup)
        window:addWidget(self.progressGroup)
-
-       if self.fixedVolumeSet then
-               self.volSlider:setValue(100)
-               self.volSlider:setEnabled(false)
-       end
 
        -- FIXME: the suppressTitlebar skin param should not be necessary if 
the window's style for title is { hidden = 1 }, but this looks to be a bug in 
the underlying skin code
        self.suppressTitlebar = self:getSelectedStyleParam('suppressTitlebar')

Modified: 7.6/trunk/squeezeplay/src/squeezeplay/share/jive/audio/Playback.lua
URL: 
http://svn.slimdevices.com/jive/7.6/trunk/squeezeplay/src/squeezeplay/share/jive/audio/Playback.lua?rev=9303&r1=9302&r2=9303&view=diff
==============================================================================
--- 7.6/trunk/squeezeplay/src/squeezeplay/share/jive/audio/Playback.lua 
(original)
+++ 7.6/trunk/squeezeplay/src/squeezeplay/share/jive/audio/Playback.lua Mon Feb 
 7 15:25:53 2011
@@ -873,6 +873,7 @@
 
 
 function _audg(self, data, isLocal)
+
        if not isLocal then
                local gain, volume = self:translateServerGain(data.gainL)
 
@@ -892,9 +893,16 @@
                -- and the initial volume for fade-out. 
        end
 
-       log:debug("gainL, gainR: ", data.gainL, " ", data.gainR)
-
-       decode:audioGain(data.gainL, data.gainR)
+
+       local player = Player:getLocalPlayer()
+       if player and player:getDigitalVolumeControl() == 0 then
+               log:debug("User setting of 100% Fixed Volume is set")
+               decode:audioGain(65536, 65536)
+       else
+               log:debug("gainL, gainR: ", data.gainL, " ", data.gainR)
+               decode:audioGain(data.gainL, data.gainR)
+       end
+
 end
 
 

_______________________________________________
Jive-checkins mailing list
[email protected]
http://lists.slimdevices.com/mailman/listinfo/jive-checkins

Reply via email to