View Full Version : Device Manager for Receiver done now want FlatSytle ccf working
rickd
January 28th, 2008, 05:42 PM
I have built a DM in G5 for my Theta receiver with full two way support. This is working with Webserver so web server has generated webpage with Volume, Mute, power, Source and surround mode. (Will add Zone two and surround channel control later.)
This is full two way at least to the browser running on the same machine ie update volume via ir or front panel of receiver and it is reflected on webpage as is source etc.
Now I want to take the next step. I have NR whole house and NR Designer. I want to base my first project on the Flatstyle as it has the music all done.
So the next step is to get the DM functioning in NR flatstyle sheet with Volume source working etc.
I have opened the ccf and it looks a little daunting.
Can you help me get started with volume control in receiver section.
Firstly nothing is showing up in NR in that screen.
Thanks Rick
Rob H
January 28th, 2008, 06:30 PM
If you've built the DM provider correctly it should work automatically. Perhaps your device types are wrong?
rickd
January 29th, 2008, 12:06 AM
Must have done it wrong when I try to slect HTPC in zones in the pc tab I get a dm.query in girde console on htpc but NR crashes on client...
Music is working however
here is my provider and serial scripts
Rob H
January 29th, 2008, 02:09 AM
Normally you would only get a DM.Query when NetRemote connects to Girder - something odd happening there.
The provider looks okay to me, at least there's nothing obviously wrong with it.
Can you put this file in luascript\DeviceManager\Providers (you may already have a version - just replace it), and create a scripting action as follows :-
require 'DeviceManager.Providers.TestHarness'
harness = DeviceManager.Providers.Classes.TestHarness:New()
Disable your component for now to eliminate it from the equation. Restart Girder and run the above scripting action.
Can you now select between the zones of the test harness' receiver without NR crashing.
And the other question is - is this a Win32 client or PPC?
rickd
January 30th, 2008, 12:47 AM
Dumb question how do I disable my device provider rename it ...
Anyway tried harness also renamed my music zone names in media bridge (both were master zone ie one on my htpc and the client zone on laptop) have not disabled my provider but all working in test mode volume slider etc showing up in receiver tab, lighting HAVC etc no more crashes
I am on win 32 XP SP2 client and server running girder is too
So guess next step is how to get my provider working
Rob H
January 30th, 2008, 02:28 AM
Ah, I think I might see the problem.
Can you try changing the Type field of the Processor to "AV\\Zone\\Stereo" or "AV\\Zone\\Surround"
rickd
January 30th, 2008, 03:03 AM
ok thanks Rob that worked ....I get two additional slider left and right front channels I assume I need to make my dm use those. Also want to add zone two which is not volume contolled but source selectable for my receiver.
How do I add these to my dm
Rob H
January 30th, 2008, 03:51 AM
You would add another device to the dt table in the GetDeviceTable method.
We can worry about removing the unused volume control later.
rickd
January 30th, 2008, 05:57 PM
Actually it would be cool to get all 7 channel volumes working.
But my first step is to setup zone two control so zone two is stereo and sources are the same
volume in zone two is controlled via local amps via ir so not sure if we can add a usb-uirt olume control with no feedback.
Also want to add a generic transport device which is remaps in girder based on the zone.
ie like the DVD device commented out at mo
so how would I add zone two stereo zone source slection only and ir based volume
Thanks rick
rickd
January 31st, 2008, 01:35 PM
[code]['kitchen'] = {Type = 'AV\\Setero\\Zone', Name = 'zone2', Description = 'Casablanca III zone out',
Sources = {'LDVD', 'VCR', 'MySky', 'Sky', 'CDSII','HTPC', 'Tunes'},
ZoneSourceCommand = function(value) self.Plugin['ZoneSource'..value](self.Plugin) end,//[code]
would this work?
rickd
January 31st, 2008, 01:36 PM
//
['kitchen'] = {Type = 'AV\\Stereo\\Zone', Name = 'zone2', Description = 'Casablanca III zone 2',
ZoneSources = {'LDVD', 'VCR', 'MySky', 'Sky', 'CDSII','HTPC', 'Tunes'},
ZoneSourceCommand = function(value) self.Plugin['ZoneSource'..value](self.Plugin) end,
would this work?
or do I just need to do this?
GetZones()
{Main = {Name = 'Main zone', Type = 'Surround'}, Zone1 = {Name = 'Zone 1', Type = 'Stereo'}}
Rob H
February 1st, 2008, 02:09 AM
I'd go for the first of those I think. That would of course be within the 'dt' table.
rickd
February 1st, 2008, 07:58 PM
great wokrs
Controls = {Presets = {Class = 'Dropdown', ID = 'Presets', Values = PresetValues,
Command = function(value) self.Plugin['Mode'..value](self.Plugin) end},
StepVolume = {Class = 'Dropdown', ID = 'StepVolume', Values = {"VolUp", "VolDown"},
Command = function(value) self.Plugin[value](self.Plugin) end},
},
how do I make the this appear on the netremote screen this sets up surround modes and step volume appears as drop downs on webpage. Do I need to use another Class other than Drop down? (PresetValues is surround modes table)
Thanks
Rob H
February 2nd, 2008, 03:56 AM
You'll have to modify Flatstyle to cope with this I'm afraid and add your own control.
Unfortunately, NetRemote does not yet have the ability to dynamically create frames and buttons from Lua code
rickd
February 2nd, 2008, 08:57 PM
ok great the last things I need to do before I dive into NR and Designer then is complete what is possible in the DM.
I would like to add:
1. The surround channnel sliders for my individaul channels currently I only have left and right for the main surround zone
2. Add Balance slider for Surround zone
Zone2
Can I remove the DM generated Balance and volume slider for zone 2 or do I just build them so they send ir to increase volume for zone two ie not a slide but volume up down via ir simly for on off for zone two which is another local receiver ir controlled.
Rob H
February 3rd, 2008, 03:11 AM
For the first one you should change the type of the device from AV\Zone\Stereo to AV\Zone\Surround and implement a GetChannels method in your plugin. The GetChannels method should return a numerically indexed table with {Name = <channel name>, FuncName = <function name to call to set the value>} for each channel.
There should already be a balance slider in an AV\Zone\Stereo - you just need to implement the BalanceCommand in your device table. Later... ah, I see this is for the Surround zone - unusual to have a Balance in a surround zone but why not. So you'd add something like this to your surround zone device table :-
Controls = {Balance = {Class = 'Balance', ID = 'Balance', Command = BalanceCommand},}
You'll also have to provide a BalanceCommand (which you could provide inline in that table).
To hide controls you can implement an AcceptControl method in your device, however, this means that you would need to create a subclass of the device and use that instead. This is not as bad as it sounds - take a look at luascript\DeviceManager\Devices\MediaBridge.lua for an example.
I'll have to see if I can provide some other way of hiding controls in a later DM version to simplify this.
Rob H
February 3rd, 2008, 03:55 AM
Here's a new version of luascript\DeviceManager\Providers\Simple.lua
With this version, you can add an Exclude table to your device table in a similar way to the Controls table.
This is a table of the IDs of controls you want to exclude from the device.
e.g. for your zone2 you would use
Exclude = {'Balance', 'Volume'},
rickd
March 16th, 2008, 02:02 AM
Controls = {Balance = {Class = 'Balance', ID = 'Balance', Command = BalanceCommand},},
BalanceCommand = function(value)
print('Casablanca Provider Received Balance Value '..value)
if tonumber(value) then
plugin:SetPercentBal(tonumber(value))
else
print('Casablanca Provider Received Unknown Balance Command')
end
end,
},
So this should work ?
Rob H
March 16th, 2008, 03:33 AM
Probably,yes.
rickd
March 16th, 2008, 04:16 PM
Rob can you show me a Getchannels code for showing all my channel sliders. Currently I only have left and right.
My receiver has Front Left & right, center, Left and Right Surrond, left and right front subs and center rear. I want sliders for all channels to appear.
GetChannels(zone) - returns a table of the form..
--If it's 'Surround' then the receiver will be asked for the channels
{
['FL'] = 'Front Left',
['FR'] = 'Front Right',
['C'] = 'Centre',
['SWL'] = 'Subwoofer Left',
['SWR'] = 'Subwoofer Right',
['SL'] = 'Surround Left',
['SR'] = 'Surround Right',
['SC'] = 'Surround Centre',
}
this code is used to ask the receiver what surround channels it has....how does it do that given it does not know how to ask that...presumeably...unless I need to create a serial function to do that in my serial control file if so how is that done and how does it populate this table for the provider?
Thanks Rick
rickd
March 18th, 2008, 03:07 PM
GetChannels(zone) - returns a table of the form
{
['FL'] = 'Front Left',
['FR'] = 'Front Right',
['C'] = 'Centre',
['SW'] = 'Subwoofer Left',
['SL'] = 'Surround Left',
['SR'] = 'Surround Right',
['SBL'] = 'Subwoofer Right',
['SBR'] = '', --this one unused in my case so not sure if this is correct?
['SB'] = 'Surround Back',
}
Actually does that mean in my case I do the above map my channel names to the standard get channels shortcuts? And is that code all I need to activate the sliders?
Rob H
March 18th, 2008, 04:24 PM
To be honest, I can't remember - remind me tomorrow and I'll check what actually happens in the Denon provider and device.
rickd
March 18th, 2008, 06:54 PM
for id, desc in pairs(zones) do
local zone = self.Plugin.Zones[id]
local VolFunc = function(value)
--print ('denon provider volume vol func',zone.Name,value,type (value))
if tonumber(value) then
--print ('denon provider volume',zone.Name,tonumber (value))
zone:SetPercentVol(value)
elseif string.upper(value) == 'UP' then
zone:VolUp()
elseif string.upper(value) == 'DOWN' then
zone:VolDown()
end
end
local MuteFunc = self:MakeToggleFunc(function() zone:Mute() end, function() zone:Unmute() end)
local PowerFunc = self:MakeToggleFunc(function() zone:On() end, function() zone:Off() end)
local SourceFunc = function(value)
local inputs = self.Plugin:GetSources()
assert(inputs, 'No inputs found!!!')
local inputFunc = inputs[value]
assert(inputFunc, 'No matching input function!')
assert(zone[inputFunc], "Receiver doesn't have a corresponding function for "..inputFunc)
-- now call the function
zone[inputFunc](zone)
end
local aZone
local channels = self.Plugin:GetChannels(id)
if channels then
aZone = {Type = 'AV\\Zone\\Surround', Name = id, Description = desc .. ' controls', Sources = inputNames, Sliders = channels, VolumeCommand = VolFunc, MuteCommand = MuteFunc, PowerCommand = PowerFunc, SourceCommand = SourceFunc}
else
aZone = {Type = 'AV\\Zone\\Stereo', Name = id, Description = desc .. ' controls', Sources = inputNames, VolumeCommand = VolFunc, MuteCommand = MuteFunc, PowerCommand = PowerFunc, SourceCommand = SourceFunc}
end
dt[id] = aZone
end
return dt
end, here is the code in denon receiver provider
rickd
March 19th, 2008, 01:05 AM
also Balance slider not showing up
local dt = {
['Processor'] = {Type = 'AV\\Zone\\Surround', Name = 'Casablanca Processor', Description = 'Casablanca III Surround Processor',
Sources = {'LDVD', 'VCR', 'MySky', 'Sky', 'CDSII','HTPC', 'Tunes'},
SourceCommand = function(value) self.Plugin['Source'..value](self.Plugin) end,
PowerCommand = self:MakeToggleFunc(function() plugin:PowerOn() end, function() plugin:PowerOff() end),
MuteCommand = self:MakeToggleFunc(function() plugin:Mute() end, function() plugin:UnMute() end),
Controls = {
Presets = {Class = 'Dropdown', ID = 'Presets', Values = PresetValues,
Command = function(value) self.Plugin['Mode'..value](self.Plugin) end},
StepVolume = {Class = 'Dropdown', ID = 'StepVolume', Values = {"VolUp", "VolDown"},
Command = function(value) self.Plugin[value](self.Plugin) end},
Balance = {Class = 'Balance', ID = 'Balance', Command = BalanceCommand},},
},
BalanceCommand = function(value)
print('Casablanca Provider Received Balance Value '..value)
if tonumber(value) then
plugin:SetPercentBalance(tonumber(value))
else
print('Casablanca Provider Received Unknown Balance Command')
end
end,
},
ps don't forget get channels above for sliders Thanks
Rob H
March 19th, 2008, 08:46 AM
Kind of unusual to have a balance control when you have individual channels too, but what the hey.
That looks okay to me - when you say it's not showing up is this just in the Flatstyle CCF or does it not show up in Girder either?
rickd
March 19th, 2008, 12:02 PM
not showing up in the webpage have not checked the flatstyle can do that though
My receiver changes channel sliders by input and balance can be f to r and l to r but also need to understand how getchannels works see above post prior to the balance issue arising perhaps i need to keep focused on one issue I relise I keep distracting you :)
Rob H
March 19th, 2008, 04:53 PM
But does it show up in the DeviceManager in Girder itself?
re the Channels - you will need both the GetChannels method which maps a code to a channel name. And you'll need something that will transform the code into a command. It's a while since I wrote that and will have to have a good look at the code to see just how it does it.
rickd
March 19th, 2008, 05:40 PM
cheers Rob
when you say show up in device manager where can I check that?
also can you give me an example as there are none I can find so a little lost on how to do it
Thanks
rickd
March 20th, 2008, 01:37 AM
ok got bracket in wrong place and girder needed restart so slider is there now but now my Balancecommand is not working
Controls = {
Presets = {Class = 'Dropdown', ID = 'Presets', Values = PresetValues,
Command = function(value) self.Plugin['Mode'..value](self.Plugin) end},
StepVolume = {Class = 'Dropdown', ID = 'StepVolume', Values = {"VolUp", "VolDown"},
Command = function(value) self.Plugin[value](self.Plugin) end},
Balance = {Class = 'Balance', ID = 'Balance', Command = BalanceCommand},
},
BalanceCommand = function(value)
print('Casablanca Provider Received Balance Value '..value)
if tonumber(value) then
plugin:SetPercentBalance(tonumber(value))
else
print('Casablanca Provider Received Unknown Balance Command')
end
end,
Rob H
March 20th, 2008, 02:51 AM
Try this
Balance = {Class = 'Balance', ID = 'Balance',
Command = function(value)
print('Casablanca Provider Received Balance Value '..value)
if tonumber(value) then
self.plugin:SetPercentBalance(tonumber(value))
else
print('Casablanca Provider Received Unknown Balance Command')
end
end},
Rob H
March 20th, 2008, 02:56 AM
Oh, and if you go to File|Settings in the Automation group on the left you'll see Device Manager - from there you can see all your devices and controls.
rickd
March 20th, 2008, 07:45 PM
Controls = {
Presets = {Class = 'Dropdown', ID = 'Presets', Values = PresetValues,
Command = function(value) self.Plugin['Mode'..value](self.Plugin) end},
StepVolume = {Class = 'Dropdown', ID = 'StepVolume', Values = {"VolUp", "VolDown"},
Command = function(value) self.Plugin[value](self.Plugin) end},
Balance = {Class = 'Balance', ID = 'Balance', Command = function(value)
print('Casablanca Provider Received Balance Value '..value)
if tonumber(value) then
self.plugin:SetBal(tonumber(value))
else
print('Casablanca Provider Received Unknown Balance Command')
end
end},
}, still not sending command to serial device and nothing is printing from above balance function in the console...would this have anything to do with the exclude balancve volume you gave me in simple.lua file in earlier post?
rickd
March 20th, 2008, 11:59 PM
my bad had something commented out
question is there a command to round a decimal number to nearest integer?
My Balance is 0-14 scale with 7 as middle so have to map -100- 0 -+100 to 0-7-14
Thanks Rick
rickd
March 21st, 2008, 12:30 AM
Rob found math.round () all working
Only one thing left now GetChannels to setup my sliders in surround zone only have left and right :)
rickd
March 24th, 2008, 01:46 AM
Serial: Casablanca III with functions for provider : Command queued: 05 27 00 00 .'.. at postion 1
Serial: Casablanca III with functions for provider : Simple Send: FE EC 05 27 00 00 ώμ.'..
Length: 1
Data: 0
Serial: Casablanca III with functions for provider : Simple Receive: Data 00 . Code: 8192
Serial: Casablanca III with functions for provider : ERROR: Incomplete response to last command
See log above for execution of this code in my serial device.
if math.band (code,serial.INCOMPLETERESPONSETIMEOUT) > 0 then
print ('Length: '..string.len(data))
print ('Data: '..string.byte(data))
gir.TriggerEvent (self.GlobalName..':ThetaCommand Failed',18)
-- not enough bytes received response
This occurs when I request a value for center level slider...since it is not 64bytes long as per a normal full response I get the incomplete response as one would expect...the data arriving in the response is what I want to store and is correct...how do I trap it and store it knowing I just requested it???
...when everything is geared toward fixed length response (see my serial file attached). is there an easy way to know what was just requested and capture it store it ...without a major rewrite?
here is the function that requests it
GetCenterLevel = function(self)
self:SendHex('05 25 00 00') -- level center
end,
Thanks also need the getchannels code for my provider to complete the circle
see my lastest serial file attached
rickd
March 26th, 2008, 02:38 AM
ok heres my go at anwsering the question above
ProcessSliders = function ( self, data ) --processes the channel level for current input
if string.len(data) == 1 and GetSliders > 0 then
if GetSliders==1 then MainLeftLevel = string.byte(data)
self:GetCenterLevel
elseif
GetSliders==2 then CenterLevel = string.byte(data)
self:GetMainRightLevel
elseif
GetSliders==3 then MainRightLevel = string.byte(data)
self:GetLeftRearLevel
elseif
GetSliders==4 then LeftRearLevel = string.byte(data)
self:GetRightRearLevel
elseif
GetSliders==5 then RightRearLevel = string.byte(data)
self:GetSub1Level
elseif
GetSliders==6 then Sub1Level = string.byte(data)
self:GetSub2Level
elseif
GetSliders==7 then Sub2Level = string.byte(data)
self:GetRearCenterLevel
elseif
GetSliders==8 then CenterRearLevel = string.byte(data)
local GetSliders=0
print ('Sliders Complete')
end
end
end
there is probably a smarter way but this I assume would work? What is the smarter way?
here is the functions for requesting each slider value
--Request variable for input levels to populate sliders avoids using status level 4
local GetSliders = 0
GetMainLeftLevel = function(self)
self:SendHex('05 24 00 00') -- level left front
local GetSliders=1
end,
GetCenterLevel = function(self)
self:SendHex('05 25 00 00') -- level center
local GetSliders=2
end,
GetMainRightLevel = function(self)
self:SendHex('05 26 00 00') -- level right front
local GetSliders=3
end,
GetLeftRearLevel = function(self)
self:SendHex('05 27 00 00') -- level left rear
local GetSliders=4
end,
GetRightRearLevel = function(self)
self:SendHex('05 28 00 00') -- level right rear
local GetSliders=5
end,
GetSub1Level = function(self)
self:SendHex('05 29 00 00') -- level sub1
local GetSliders=6
end,
GetSub2Level = function(self)
self:SendHex('05 7E 00 00') -- level sub2
local GetSliders=7
end,
GetRearCenterLevel = function(self)
self:SendHex('05 7F 00 00') -- level rear center
local GetSliders=8
end, to execute a full refresh will issue Casablanca:GetMainLeftLevel on an input change which will retrieve all the slider values for current input
Rob H
March 26th, 2008, 12:51 PM
You definitely don't want all those 'local's in there. Each time you do that you're declaring a new scope for that local variable, ie they are all different.
rickd
March 26th, 2008, 03:08 PM
ok I made them global and it works but had to place it in the imcomplete response function to get it to trigger and process...how or were do I put it to process as I have it above as I had it in receiveresponse but it is not working or processing it? see lastest file attached.
I think I need to add this
ProcessSliders = function ( self, data, code ) --processes the channel level for current input
if math.band(code, serial.RXCHAR) > 0 then ...
Also I want to put the results into a table rather than separate variables not sure syntax or how to use ipairs in this situtation
Will this do
local ChannelLevels = {
'Main Left'
'Center'
'Main Right'
'Left Surround'
'Right Surround'
'Sub1'
'Sub2'
'Center Rear'
}
ProcessSliders = function ( self, data, code ) --processes the channel level for current input
if math.band(code, serial.RXCHAR) > 0 then
if string.len(data) == 1 and GetSliders > 0 then
if GetSliders==1 then self.ChannelLevels[GetSliders] = string.byte(data)
self:GetCenterLevel()
print ('MainLeftLevel: '..self.ChannelLevels[GetSliders])
elseif...
Also still need the GetChannnels to link this back to in the provider as currently am only getting two sliders showing up...you asked me to remind you to provide the code example of how to do that
thanks R.
rickd
March 30th, 2008, 02:09 PM
Any chance of getting info on how to use GetChannels for the provider currently only have left and right slider? Thanks Rick
Rob H
March 31st, 2008, 03:35 AM
GetChannels and the code that supports it is all rather convoluted I'm afraid.
This is to make things flexible but that comes at a price.
GetChannels simply returns a table that maps a slider ID to a channel name - see the MapControlsToCommands method in Providers\DenonAVR.lua for how this is used to generate the functions that map to methods in the plugin.
Since you don't need the same flexiblity (ie you don't have a varying number of channels) it would probably be better to just create an AV\Zone\Surround device with all the sliders hardcoded. See the source of the SliderPanel and AVReceiverZone devices in Devices\AudioVisual.lua
rickd
March 31st, 2008, 04:53 PM
Thanks Rob had a look at those not sure where to start how would I manually add say a center slider for example.
Thanks r.
rickd
April 6th, 2008, 11:49 PM
local SliderPanel = AVComponent:New({
Type = 'AV\\Sliders',
AddControls = function(self)
assert(self.Sliders, 'No sliders specified')
for i, v in ipairs(self.Sliders) do
-- print('Creating slider '..v.FuncName..', '.. v.Name)
local volume = Controls.Volume:New({ID = v.FuncName, Name = v.Name, Device = self, Group = self:GetID(), Key = i-1, Command = v.Command}) -- Key = i-1 because NR loops start at 0
self:AddControl(volume)
end
end,
})
Do you mean this how would I add it in context of a surround processor?
Rob H
April 7th, 2008, 02:51 AM
Well, you need to pass a table of sliders e.g.
{
{Name = 'Front Left', FuncName = 'FL', Command = function(value) plugin:FrontLeftVolume(value) end},
{Name = 'Front Right', FuncName = 'FR', Command = function(value) plugin:FrontRightVolume(value) end},
// etc.
}
In this table Name is the name that would appear in the Flatstyle CCF, FuncName becomes the ID for this channel control and Command is a function that does the actual work.
rickd
April 7th, 2008, 04:18 PM
ok thanks ...so I would just add that table to my provider under the dt would I call that table sliders? or does it need to be something specific to work?
eg
sliders =
{
{Name = 'Front Left', FuncName = 'FL', Command = function(value) plugin:FrontLeftVolume(value) end},
{Name = 'Front Right', FuncName = 'FR', Command = function(value) plugin:FrontRightVolume(value) end},
// etc.
}
Rob H
April 8th, 2008, 12:50 AM
It's one of the parameters of the AV Receiver device called, I think, Sliders.
rickd
August 26th, 2008, 09:41 PM
I have my sliders working but have an issue with webserver it appears to select a 0-100 slider when my scale for channel sliders is -100 to 0 to +100 is their a way to set this in the provider? this causes errors in console from webserver. It works fine in NR.
Also can I add delay sliders to the the channel volume sliders definition ? ie
Sliders =
{
{Name = 'Front Left', FuncName = 'FL', Command = function(value) plugin:FrontLeftVolume(value) end},
{Name = 'Front Right', FuncName = 'FR', Command = function(value) plugin:FrontRightVolume(value) end},
// etc.
{Name = 'Center Delay' FuncName = 'CD', Command = function(value) plugin:CenterDelay(value) end},
}
Ron
August 27th, 2008, 07:08 AM
I believe the webserver doesn't know how to handle that scale. I'll see if I get a bit of time to add it.
rickd
August 27th, 2008, 03:32 PM
Thanks Ron
On the other question can I add a delay sliderto channel sliders will that work ok?
Sliders =
{
{Name = 'Front Left', FuncName = 'FL', Command = function(value) plugin:FrontLeftVolume(value) end},
{Name = 'Front Right', FuncName = 'FR', Command = function(value) plugin:FrontRightVolume(value) end},
// etc.
{Name = 'Center Delay' FuncName = 'CD', Command = function(value) plugin:CenterDelay(value) end},
Rob H
August 27th, 2008, 04:15 PM
That shouldn't be a problem.
rickd
August 31st, 2008, 05:08 AM
Sliders ={
{Name = 'Front Left', FuncName = 'FL', Command = function(value) plugin:FrontLeftVolume(value) end},
{Name = 'Front Right', FuncName = 'FR', Command = function(value) plugin:FrontRightVolume(value) end},
{Name = 'Center', FuncName = 'C', Command = function(value) plugin:CenterVolume(value) end},
{Name = 'Surround Left', FuncName = 'SL', Command = function(value) plugin:SurroundLeftVolume(value) end},
{Name = 'Surround Right', FuncName = 'SR', Command = function(value) plugin:SurroundRightVolume(value) end},
{Name = 'Subwoofer Left', FuncName = 'SW1', Command = function(value) plugin:SubwooferLeftVolume(value) end},
{Name = 'Subwoofer Right', FuncName = 'SW2', Command = function(value) plugin:SubwooferRightVolume(value) end},
{Name = 'Center Rear', FuncName = 'CR', Command = function(value) plugin:CenterRearVolume(value) end},
},--to here
I got sliders working in that it loads the correct value to slider but changing value does not activate my serial command.
eg
SetSliderHex=function(self, value)
sliderhex=nil
print (value)
local realval = math.round(value*0.15) --sets balance to scale on slider to match balance range of Casablancca which is -15-0-15 with 0 as middle
if realval<0 then reallev = realval+256 --add 15 to bring it to match Casablanca 241-0-15 from -15 0 +15
print (reallev)
else reallev = realval
print (reallev)
end
sliderhex = string.format('%02x', reallev) --make it a byte to send to casablanca
print (sliderhex)
end,
FrontLeftVolume=function(self, value)
self:SetSliderHex(value)
if sliderhex then self:SendHex('01 24 00 '..sliderhex)
print (sliderhex)
end
end,
what am I missing to I need a tonumber in the plugin? ps it works in the webserver ok???
Rob H
August 31st, 2008, 05:17 AM
You're saying that it doesn't work in NR?
Sounds like you haven't called NetRemote.RegisterVariableWatch() for the slider variable. That shouldn't be necessary in FlatStyle itself, but you never know.
rickd
August 31st, 2008, 03:30 PM
yeah your right I think that is it...forgot to do that...
Also I have a Netremote variable set in girder called htpc.app it updates most of the time when it changes but sometimes it does not do I need to register variable watch for that too?
panel jumping seems to update it or is variable watch for feedback to girder from NR
Rob H
September 1st, 2008, 02:35 AM
What are you doing with this variable htpc.app ? If it appears on pages inside <> brackets then you'll need to call NetRemote.Rebind() e.g.
NetRemote.RegisterVariableWatch('htpc.app',
function()
NetRemote.Rebind()
end)
rickd
October 14th, 2008, 02:55 AM
I want to add a toggle function to my Receiver provider for Dolby digital compression on off
So current functions look like this
local dt = {
['Processor'] = {Type = 'AV\\Zone\\Surround', Name = 'Casablanca Processor', Description = 'Casablanca III Surround Processor',
Sources = {'PS3', 'VCR', 'MySky', 'SkyHDi', 'CDSII','HTPC', 'Tunes'},
SourceCommand = function(value) self.Plugin['Source'..value](self.Plugin) end,
PowerCommand = self:MakeToggleFunc(function() plugin:PowerOn() end, function() plugin:PowerOff() end),
MuteCommand = self:MakeToggleFunc(function() plugin:Mute() end, function() plugin:UnMute() end),
could I just add something like this
DDCompressionCommand = self:MakeToggleFunc(function() plugin:CompressionOn() end, function() plugin:CompressionOff() end),
Would that work or do I need to use a drop down approach?
Rob H
October 14th, 2008, 03:08 AM
That looks fine to me assuming you have the CompressionOn and CompressionOff functions in your plugin.
rickd
October 19th, 2008, 01:58 PM
I have a small issue with my sliders.
They will not pass the negitive values 0f a -100 to 0 to 100 slider
In NR action designer for the slider button do I need to have minimum set to -100 and max to 100 as I note that this is not the case for some of the demo sliders in the flatstyle ccf.
All my + and - 100 sliders work fine with positive numbers but zero is returned for -ve values from the publisher. This is for my channel sliders and the Dolby Digital level and delay sliders.
Sliders ={ {Name = 'Front Left', FuncName = 'FL', Command = function(value) plugin:FrontLeftVolume(value) end},
{Name = 'Front Right', FuncName = 'FR', Command = function(value) plugin:FrontRightVolume(tonumber(value)) end},
{Name = 'Center', FuncName = 'C', Command = function(value) plugin:CenterVolume(tonumber(value)) end},
{Name = 'Surround Left', FuncName = 'SL', Command = function(value) plugin:SurroundLeftVolume(tonumber(value)) end},
{Name = 'Surround Right', FuncName = 'SR', Command = function(value) plugin:SurroundRightVolume(tonumber(value)) end},
{Name = 'Subwoofer Left', FuncName = 'SW1', Command = function(value) plugin:SubwooferLeftVolume(tonumber(value)) end},
{Name = 'Subwoofer Right', FuncName = 'SW2', Command = function(value) plugin:SubwooferRightVolume(tonumber(value)) end},
{Name = 'Center Rear', FuncName = 'CR', Command = function(value) plugin:CenterRearVolume(tonumber(value)) end},
--sliders for DD
{Name = 'Center DD Delay', FuncName = 'DDCD', Command = function(value) plugin:CenterDDelay(value) end},
{Name = 'Center DD Volume', FuncName = 'DDCL', Command = function(value) plugin:CenterDDVolume(value) end}, {Name = 'Surround DD Delay', FuncName = 'DDSD', Command = function(value) plugin:SurroundDDelay(value) end},
{Name = 'Surround DD Volume', FuncName = 'DDSL', Command = function(value) plugin:SurroundDDVolume(value) end},
{Name = 'LFE DD Volume', FuncName = 'DDLFE', Command = function(value) plugin:LFEDDVolume(value) end},
},
That is provider side
here is the plugin side
SetDDHex=function(self, value)
DDhex==nil
print ('slider percent level:'..value)
local realval = math.round(value*0.15) --sets balance to scale on slider to match balance range of Casablancca which is -15-0-15 with 0 as middle
if realval<0 then reallev = realval+256 --add 15 to bring it to match Casablanca 245-0-15 from -10 0 +15
print (reallev)
else reallev = realval
print (reallev)
end
DDhex = string.format('%02x', reallev) --make it a byte to send to casablanca
print (DDhex)
end,
CenterDDVolume=function(self, value)
self:SetDDHex(value)
if DDhex then self:SendHex('01 3C 00 '..DDhex)
print (DDhex)
end
end,
Thanks Rick
Rob H
October 19th, 2008, 02:57 PM
Not entirely sure what's going on there - I'll have to take a look tomorrow.
That should work okay providing the surround channels are correctly set to specify the min and max values as -100 and 100
rickd
October 19th, 2008, 05:44 PM
ok the -100 was max instead of min so let me try that first
Rob H
October 20th, 2008, 12:20 AM
I meant for the DM controls, not for the sliders. The sliders in the Flatstyle CCF are set up correctly.
rickd
October 20th, 2008, 06:32 PM
ok so max and min is confusing in NR min should -100 and max 100 for +_slider?
I note min is 100 for a volume slider and max is 0 what is the reason for that.
In the DM provider do we need to define the sliders as + and - 100 is that the issue?
thanks Rick
rickd
October 27th, 2008, 07:14 PM
Rob
Is their a way to tell the provider it has a -100 0 100 slider scale ie like a balance slider for example which does this already?
If not I will rescale it in the plugin and deal with it that way
Cheers Rick
Rob H
October 28th, 2008, 05:43 AM
Hmm... that's odd - I thought I'd posted the fix for this - here's a replacement for luascript\DeviceManager\Devices\AudioVisual.lua
rickd
November 5th, 2008, 01:30 AM
Thanks Rob that workd ...how do I turn a -ve number positive in lua?
eg if it equals -1 how do I make it +1 ie remove the negitive values?
Rob H
November 5th, 2008, 02:43 AM
You can use math.abs() to do that.
rickd
January 9th, 2009, 01:13 AM
I have added a Dolby Digital compression command dropdown but it does not work cannot see what I am missing here is provider code
Controls = {
Presets = {Class = 'Dropdown', ID = 'Presets', Values = PresetValues,
Command = function(value) self.Plugin['Mode'..value](self.Plugin) end},
StepVolume = {Class = 'Dropdown', ID = 'StepVolume', Values = {"VolUp", "VolDown"},
Command = function(value) self.Plugin[value](self.Plugin) end},
DDCompression = {Class = 'Dropdown', ID = 'DDCompression', Values = {"On", "Off"},
Command = function(value) self.Plugin[value](self.Plugin) end},
DDialogNorm = {Class = 'Dropdown', ID = 'DDialogNorm', Values = {"Analog", "Digital"},
Command = function(value) self.Plugin[value](self.Plugin) end},
Balance = {Class = 'Balance', ID = 'Balance',
Command = function(value)
print('Casablanca Provider Received Balance Value '..value)
if tonumber(value) then
self.Plugin:SetPercentBalance(tonumber(value))
else
print('Casablanca Provider Received Unknown Balance Command')
end
end},
errors as follows when event fcomes from NR:
...cript\DeviceManager/Providers/ThetaCasablancaIII.lua:71: attempt to call field `?' (a nil value)
C:\Program Files\Promixis\Girder5\luascript\DeviceManager/Providers/ThetaCasablancaIII.lua:71 in function <C:\Program Files\Promixis\Girder5\luascript\DeviceManager/Providers/ThetaCasablancaIII.lua:71>
(tail call): ?
[C]: in function `xpcall'
Locals
pfunc : function: 0CD2E570
pargs : table: 0DDE5818
arg : table: 0DDE5818
func : function: 10F18A58
Upvalues
clearLines : function: 0CCBD950
errorHandler : function: 15A5D100
C:\Program Files\Promixis\Girder5\luascript\DeviceManager/Providers/Simple.lua:56 in function <C:\Program Files\Promixis\Girder5\luascript\DeviceManager/Providers/Simple.lua:51>
Locals
self : table: 0ACE2E10
dev : table: 10F19178
control : DDCompression
_ : 42
devPath : HTPC\CasablancaIII\Processor
event : HTPC\CasablancaIII\Processor\DDCompression
payloads : table: 0DDE5758
Upvalues
ThisMachine : HTPC
C:\Program Files\Promixis\Girder5\luascript\DeviceManager/ConnectionManager.lua:484 in function <C:\Program Files\Promixis\Girder5\luascript\DeviceManager/ConnectionManager.lua:462>
Locals
modifier : 0
device : 232
handler : 1428
event : HTPC\CasablancaIII\Processor\DDCompression
payloads : table: 0DDE5758
Upvalues
self : table: 0ACE2E10
C:\Program Files\Promixis\Girder5\luascript\DeviceManager/ConnectionManager.lua:103 in function <C:\Program Files\Promixis\Girder5\luascript\DeviceManager/ConnectionManager.lua:102>
thanks
Rob H
January 9th, 2009, 04:33 AM
Assuming that this code is at line 71
Command = function(value) self.Plugin[value](self.Plugin) end},
I'd want to know what the value of the parameter 'value' is - I'd expect it to 'On' or 'Off' - but you'd really want to be calling something like self.Plugin.DDCompression(self.Plugin, value) I'd have thought.
And something similar for DDialogNorm as well.
rickd
January 9th, 2009, 12:12 PM
yes you are right that is code at 71 and yes DDCompression values are on or off
so something like this would work?
DDCompression = {Class = 'Dropdown', ID = 'DDCompression', Values = {"On", "Off"},
Command = function(value) self.Plugin.DDCompression(self.Plugin, value) end},
on the plugin side
DDCompression=function(self,value)
print ("got compression")
if value=="On" then
self:SendHex('01 36 00 00') end
end,
Rob H
January 9th, 2009, 03:58 PM
Yes, that looks right to me.
Powered by vBulletin® Version 4.1.8 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.