Author: bklaas
Date: Tue Aug 10 15:47:56 2010
New Revision: 9037
URL: http://svn.slimdevices.com/jive?rev=9037&view=rev
Log:
Bug: 14807
Description: support for obeying server-side playerpref for fixed 100% volume
output
UI and skin support in Now Playing for fixed volume
add player object method getDigitalVolumeControl() to query setting
IRBlaster support is not (fully) there yet, will be working with Felix on this
Modified:
7.6/trunk/squeezeplay/src/squeezeplay/share/applets/NowPlaying/NowPlayingApplet.lua
7.6/trunk/squeezeplay/src/squeezeplay/share/applets/QVGAlandscapeSkin/QVGAlandscapeSkinApplet.lua
7.6/trunk/squeezeplay/src/squeezeplay/share/applets/QVGAportraitSkin/QVGAportraitSkinApplet.lua
7.6/trunk/squeezeplay/src/squeezeplay/share/applets/SlimBrowser/SlimBrowserApplet.lua
7.6/trunk/squeezeplay/src/squeezeplay/share/applets/SlimBrowser/Volume.lua
7.6/trunk/squeezeplay/src/squeezeplay/share/applets/WQVGAsmallSkin/WQVGAsmallSkinApplet.lua
7.6/trunk/squeezeplay/src/squeezeplay/share/jive/slim/Player.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=9037&r1=9036&r2=9037&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
Tue Aug 10 15:47:56 2010
@@ -386,6 +386,25 @@
end
+function notify_playerDigitalVolumeControl(self, player, digitalVolumeControl)
+ log:info('notify_playerDigitalVolumeControl')
+ self.digitalVolumeControl = digitalVolumeControl
+ if self.volSlider then
+ if digitalVolumeControl == 0 then
+ log:info('disable volume UI in NP')
+ self.volSlider:setStyle('npvolumeB_disabled')
+ self.volSlider:setEnabled(false)
+ self.volSlider:setValue(100)
+ self.fixedVolumeSet = true
+ else
+ log:info('enable volume UI in NP')
+ self.volSlider:setStyle('npvolumeB')
+ self.volSlider:setEnabled(true)
+ self.fixedVolumeSet = false
+ end
+ end
+end
+
function notify_playerRepeatModeChange(self, player, repeatMode)
if player ~= self.player then
return
@@ -1008,7 +1027,7 @@
end
local volume = tonumber(self.player:getVolume())
- if self.volSlider then
+ if self.volSlider and not self.fixedVolumeSet then
local sliderVolume = self.volSlider:getValue()
if sliderVolume ~= volume then
log:debug("new volume from player: ", volume)
@@ -1511,18 +1530,31 @@
end
)
- --todo: this slider is not applicable for Jive, how do we handle this
when on the controller
- self.volSlider = Slider('npvolumeB', 0, 100, 0,
+ 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,
function(slider, value, done)
- --rate limiting since these are serial networks
calls
- adjustVolume(self, value, true)
- self.volumeSliderDragInProgress = true
+ if self.fixedVolumeSet then
+ log:info('FIXED VOLUME. DO NOTHING')
+ else
+ --rate limiting since these are serial
networks calls
+ adjustVolume(self, value, true)
+ self.volumeSliderDragInProgress = true
+ end
end,
function(slider, value, done)
- --called after a drag completes to insure final
value not missed by rate limiting
- self.volumeSliderDragInProgress = false
-
- adjustVolume(self, value, false)
+ if self.fixedVolumeSet then
+ log:info('FIXED VOLUME. DO NOTHING')
+ else
+ --called after a drag completes to
insure final value not missed by rate limiting
+ self.volumeSliderDragInProgress = false
+
+ adjustVolume(self, value, false)
+ end
end)
self.volSlider.jumpOnDown = true
self.volSlider.pillDragOnly = true
@@ -1624,6 +1656,11 @@
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')
if not self.suppressTitlebar then
Modified:
7.6/trunk/squeezeplay/src/squeezeplay/share/applets/QVGAlandscapeSkin/QVGAlandscapeSkinApplet.lua
URL:
http://svn.slimdevices.com/jive/7.6/trunk/squeezeplay/src/squeezeplay/share/applets/QVGAlandscapeSkin/QVGAlandscapeSkinApplet.lua?rev=9037&r1=9036&r2=9037&view=diff
==============================================================================
---
7.6/trunk/squeezeplay/src/squeezeplay/share/applets/QVGAlandscapeSkin/QVGAlandscapeSkinApplet.lua
(original)
+++
7.6/trunk/squeezeplay/src/squeezeplay/share/applets/QVGAlandscapeSkin/QVGAlandscapeSkinApplet.lua
Tue Aug 10 15:47:56 2010
@@ -331,6 +331,7 @@
-- sliders
s.npvolumeB = { hidden = 1 }
+ s.npvolumeB_disabled = { hidden = 1 }
s.icon_photo_loading = _uses(s._icon, {
img = _loadImage(self, "Icons/image_viewer_loading.png"),
Modified:
7.6/trunk/squeezeplay/src/squeezeplay/share/applets/QVGAportraitSkin/QVGAportraitSkinApplet.lua
URL:
http://svn.slimdevices.com/jive/7.6/trunk/squeezeplay/src/squeezeplay/share/applets/QVGAportraitSkin/QVGAportraitSkinApplet.lua?rev=9037&r1=9036&r2=9037&view=diff
==============================================================================
---
7.6/trunk/squeezeplay/src/squeezeplay/share/applets/QVGAportraitSkin/QVGAportraitSkinApplet.lua
(original)
+++
7.6/trunk/squeezeplay/src/squeezeplay/share/applets/QVGAportraitSkin/QVGAportraitSkinApplet.lua
Tue Aug 10 15:47:56 2010
@@ -615,6 +615,7 @@
s.nowplaying.npprogress.npprogressB_disabled =
_uses(s.nowplaying.npprogress.npprogressB)
s.npvolumeB = { hidden = 1 }
+ s.npvolumeB_disabled = { hidden = 1 }
-- line in is the same as s.nowplaying but with transparent background
s.linein = _uses(s.nowplaying, {
Modified:
7.6/trunk/squeezeplay/src/squeezeplay/share/applets/SlimBrowser/SlimBrowserApplet.lua
URL:
http://svn.slimdevices.com/jive/7.6/trunk/squeezeplay/src/squeezeplay/share/applets/SlimBrowser/SlimBrowserApplet.lua?rev=9037&r1=9036&r2=9037&view=diff
==============================================================================
---
7.6/trunk/squeezeplay/src/squeezeplay/share/applets/SlimBrowser/SlimBrowserApplet.lua
(original)
+++
7.6/trunk/squeezeplay/src/squeezeplay/share/applets/SlimBrowser/SlimBrowserApplet.lua
Tue Aug 10 15:47:56 2010
@@ -514,10 +514,10 @@
function(_, checkboxFlag)
log:debug("checkbox updated: ", checkboxFlag)
if (checkboxFlag) then
- log:warn("ON: ", checkboxFlag)
+ log:info("ON: ", checkboxFlag)
_actionHandler(nil, nil, db, nil, nil,
'on', item)
else
- log:warn("OFF: ", checkboxFlag)
+ log:info("OFF: ", checkboxFlag)
_actionHandler(nil, nil, db, nil, nil,
'off', item)
end
end,
@@ -3663,6 +3663,31 @@
_attachPlayer(self, player)
end
+
+function notify_playerDigitalVolumeControl(self, player, digitalVolumeControl)
+ if player == _player then
+ return
+ end
+
+ log:info('notify_playerDigitalVolumeControl()', digitalVolumeControl)
+
+ if digitalVolumeControl == 0 then
+ log:warn('set volume to 100')
+ self.cachedVolume = player:getVolume()
+ if player:isLocal() then
+ player:volumeLocal(100)
+ end
+ player:volume(100, true)
+ elseif self.cachedVolume then
+ log:warn('set volume to cached level')
+ if player:isLocal() then
+ player:volumeLocal(self.cachedVolume)
+ end
+ player:volume(self.cachedVolume, true)
+ end
+end
+
+
function _attachPlayer(self, player)
-- has the player actually changed?
if _player == player then
Modified:
7.6/trunk/squeezeplay/src/squeezeplay/share/applets/SlimBrowser/Volume.lua
URL:
http://svn.slimdevices.com/jive/7.6/trunk/squeezeplay/src/squeezeplay/share/applets/SlimBrowser/Volume.lua?rev=9037&r1=9036&r2=9037&view=diff
==============================================================================
--- 7.6/trunk/squeezeplay/src/squeezeplay/share/applets/SlimBrowser/Volume.lua
(original)
+++ 7.6/trunk/squeezeplay/src/squeezeplay/share/applets/SlimBrowser/Volume.lua
Tue Aug 10 15:47:56 2010
@@ -50,7 +50,6 @@
module(..., oo.class)
-
local function _updateDisplay(self)
if tonumber(self:_getVolume()) <= 0 then
self.title:setValue(self.applet:string("SLIMBROWSER_MUTED"))
@@ -90,7 +89,13 @@
local function _openPopup(self)
+
if self.popup or not self.player then
+ return
+ end
+
+ -- don't do this if we have fixed volume
+ if self.player:getDigitalVolumeControl() == 0 then
return
end
@@ -165,6 +170,11 @@
function _updateVolume(self, mute, directSet, noAccel, minAccelDelta)
if not self.popup then
self.timer:stop()
+ return
+ end
+
+ -- don't update volume if we're set for fixed volume
+ if self.player and self.player:getDigitalVolumeControl() == 0 then
return
end
@@ -541,6 +551,7 @@
return delta
end
+
--[[
=head1 LICENSE
Modified:
7.6/trunk/squeezeplay/src/squeezeplay/share/applets/WQVGAsmallSkin/WQVGAsmallSkinApplet.lua
URL:
http://svn.slimdevices.com/jive/7.6/trunk/squeezeplay/src/squeezeplay/share/applets/WQVGAsmallSkin/WQVGAsmallSkinApplet.lua?rev=9037&r1=9036&r2=9037&view=diff
==============================================================================
---
7.6/trunk/squeezeplay/src/squeezeplay/share/applets/WQVGAsmallSkin/WQVGAsmallSkinApplet.lua
(original)
+++
7.6/trunk/squeezeplay/src/squeezeplay/share/applets/WQVGAsmallSkin/WQVGAsmallSkinApplet.lua
Tue Aug 10 15:47:56 2010
@@ -3084,6 +3084,9 @@
img = _volumeSliderBar,
pillImg = _volumeSliderPill,
}
+ s.npvolumeB_disabled = _uses(s.npvolumeB, {
+ pillImg = false,
+ })
-- pressed styles
s.nowplaying.title.pressed = _uses(s.nowplaying.title, {
Modified: 7.6/trunk/squeezeplay/src/squeezeplay/share/jive/slim/Player.lua
URL:
http://svn.slimdevices.com/jive/7.6/trunk/squeezeplay/src/squeezeplay/share/jive/slim/Player.lua?rev=9037&r1=9036&r2=9037&view=diff
==============================================================================
--- 7.6/trunk/squeezeplay/src/squeezeplay/share/jive/slim/Player.lua (original)
+++ 7.6/trunk/squeezeplay/src/squeezeplay/share/jive/slim/Player.lua Tue Aug 10
15:47:56 2010
@@ -14,6 +14,7 @@
playerConnected:
playerNewName:
+ playerDigitalVolumeControl:
playerDisconnected:
playerPower:
playerNew (performed by SlimServer)
@@ -410,6 +411,7 @@
self.info.needsUpgrade = tonumber(playerInfo.player_needs_upgrade) == 1
self.info.isUpgrading = tonumber(playerInfo.player_is_upgrading) == 1
self.info.pin = tostring(playerInfo.pin)
+ self.info.digitalVolumeControl =
tonumber(playerInfo.digital_volume_control)
self.lastSeen = Framework:getTicks()
@@ -462,6 +464,12 @@
-- Check if the player name has changed
if oldInfo.name ~= self.info.name then
self.jnt:notify('playerNewName', self, self.info.name)
+ end
+
+ -- Check if the player name has changed
+ if oldInfo.digitalVolumeControl ~= self.info.digitalVolumeControl then
+ log:debug('notify_playerDigitalVolumeControl: ',
self.info.digitalVolumeControl)
+ self.jnt:notify('playerDigitalVolumeControl', self,
self.info.digitalVolumeControl)
end
-- Check if the player power status has changed
@@ -1176,6 +1184,7 @@
-- update our state in one go
local oldState = self.state
self.state = event.data
+
-- used for calculating getTrackElapsed(), getTrackRemaining()
self.rate = tonumber(event.data.rate)
@@ -1200,6 +1209,7 @@
local playerInfo = {}
playerInfo.uuid = self.info.uuid
playerInfo.name = event.data.player_name
+ playerInfo.digital_volume_control = event.data.digital_volume_control
playerInfo.model = self.info.model
playerInfo.connected = event.data.player_connected
playerInfo.power = event.data.power
@@ -1877,6 +1887,13 @@
return self.alarmSnoozeSeconds or 540
end
+-- 0 is fixed volume
+-- 1 is not-fixed volume (default, if nothing stored in player object)
+function getDigitalVolumeControl(self)
+ return self.info.digitalVolumeControl or 1
+end
+
+
function getAlarmTimeoutSeconds(self)
return self.alarmTimeoutSeconds or 3600
end
_______________________________________________
Jive-checkins mailing list
[email protected]
http://lists.slimdevices.com/mailman/listinfo/jive-checkins