fader feedback v2.2
This commit is contained in:
parent
f0a00a359f
commit
3a4c50f9aa
4 changed files with 138 additions and 111 deletions
|
|
@ -1,6 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<GMA3 DataVersion="2.0.2.0">
|
|
||||||
<UserPlugin Name="RB Fader Feedback v2_1" Guid="14 73 AC F0 E4 73 10 04 31 CA 06 09 09 E9 2B 8B" Version="2.1.0.0">
|
|
||||||
<ComponentLua Name="[RBFaderFeedbackv2_1_lua]" Guid="14 73 AC F0 9A 5B 10 04 76 04 7B C7 DB 82 10 8B" FileName="RBFaderFeedbackv2_1.lua" />
|
|
||||||
</UserPlugin>
|
|
||||||
</GMA3>
|
|
||||||
6
Fader Feedback 2/RB Fader Feedback v2_2.xml
Normal file
6
Fader Feedback 2/RB Fader Feedback v2_2.xml
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<GMA3 DataVersion="2.3.2.0">
|
||||||
|
<UserPlugin Name="RB Fader Feedback v2_2" Guid="14 73 AC F0 E4 73 10 04 31 CA 06 09 09 E9 2B 8B" Author="Rik Berkelder" Version="2.2.0.0">
|
||||||
|
<ComponentLua Name="[RBFaderFeedbackv2_2_lua]" Guid="14 73 AC F0 9A 5B 10 04 76 04 7B C7 DB 82 10 8B" FileName="RBFaderFeedbackv2_2.lua"/>
|
||||||
|
</UserPlugin>
|
||||||
|
</GMA3>
|
||||||
|
|
@ -1,105 +0,0 @@
|
||||||
-- Edit the variables below to suit your situation
|
|
||||||
|
|
||||||
local faders = {201, 202, 203, 204, 205, 206, 207, 208, 209, 401, 402, 403, 404, 405, 406, 407, 408}
|
|
||||||
local keys = {201, 202, 203, 204, 205, 206, 207, 208, 101, 102, 103, 104, 105, 106, 107, 108, 109, 301, 302, 303, 304, 305, 306, 307, 308, 401, 402, 403, 404, 405,406, 407, 408, 191, 192, 193, 194, 195, 196, 197, 198, 291, 292, 293, 294, 295, 296, 297, 298}
|
|
||||||
|
|
||||||
-- how many seconds should be between updates.
|
|
||||||
-- set this higher if you have performance issues
|
|
||||||
-- you can go lower for smoother feedback at your own risk
|
|
||||||
local updateInterval = 0.1
|
|
||||||
|
|
||||||
-- the name of the OSC object that feedback should be sent out from
|
|
||||||
local feedbackOSCName = "Feedback"
|
|
||||||
|
|
||||||
-- The name of the OSC object that receives OSC data.
|
|
||||||
-- This object will automatically be enabled/disabled based on desk lock state
|
|
||||||
-- so locking the desk will also prevent people from messing around with your faders
|
|
||||||
local inputOSCName = "SC"
|
|
||||||
|
|
||||||
-- set this to true if you don't want desk lock to disable OSC input
|
|
||||||
-- this makes the "inputOSCName" variable irrelevant
|
|
||||||
local disableInputWhenLocked = false
|
|
||||||
|
|
||||||
-- run a full update every x amount of loops
|
|
||||||
local fullUpdateLoops = 20
|
|
||||||
|
|
||||||
-- No need to edit anything under this line
|
|
||||||
|
|
||||||
|
|
||||||
local function sendOSC(type, id, value)
|
|
||||||
local address = "/Page/" .. type .. id
|
|
||||||
local cmd = 'SendOSC "' .. feedbackOSCName .. '" "' .. address .. ',f, ' .. value ..'"'
|
|
||||||
Cmd(cmd)
|
|
||||||
end
|
|
||||||
|
|
||||||
local function buildValueStore(store, items, type)
|
|
||||||
for _, item in ipairs(items) do
|
|
||||||
store[#store + 1] = {id = item, type = type, value = nil}
|
|
||||||
sendOSC(type, item, 0)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
local function main()
|
|
||||||
breakRBloops = false
|
|
||||||
|
|
||||||
local currentLockedState = false
|
|
||||||
local valueStore = {}
|
|
||||||
|
|
||||||
buildValueStore(valueStore, faders, "Fader")
|
|
||||||
buildValueStore(valueStore, keys, "Key")
|
|
||||||
|
|
||||||
local iters = 0
|
|
||||||
while not breakRBloops do
|
|
||||||
iters = iters + 1
|
|
||||||
if (DeskLocked() ~= currentLockedState and disableInputWhenLocked == false) then
|
|
||||||
currentLockedState = DeskLocked()
|
|
||||||
|
|
||||||
local receiveOSCValue = currentLockedState and 0 or 1
|
|
||||||
Cmd('Set OSC "' .. inputOSCName .. '" "receive" ' .. receiveOSCValue)
|
|
||||||
Cmd('Set OSC "' .. inputOSCName .. '" "receivecommand" ' .. receiveOSCValue)
|
|
||||||
end
|
|
||||||
|
|
||||||
for localExecId, storedExec in pairs(valueStore) do
|
|
||||||
local endValue = storedExec["value"]
|
|
||||||
local exec = GetExecutor(storedExec["id"])
|
|
||||||
|
|
||||||
if exec ~= nil then
|
|
||||||
if storedExec["type"] == "Fader" then
|
|
||||||
local faderValue = exec:GetFader({})
|
|
||||||
endValue = faderValue
|
|
||||||
else -- exec is key
|
|
||||||
local obj = exec.object
|
|
||||||
endValue = 1
|
|
||||||
|
|
||||||
-- check if we're an active sequence
|
|
||||||
-- if it is, and it's active, send value 2
|
|
||||||
if obj ~= nil and obj.type == "Sequence" then
|
|
||||||
if obj:HasActivePlayback() then
|
|
||||||
endValue = 2
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
else -- exec is nil
|
|
||||||
endValue = nil
|
|
||||||
end
|
|
||||||
|
|
||||||
-- if the value has changed, send feedback over
|
|
||||||
if (storedExec["value"] ~= endValue or iters == fullUpdateLoops) then
|
|
||||||
local sendValue = endValue == nil and 0 or endValue
|
|
||||||
sendOSC(storedExec["type"], storedExec["id"], sendValue)
|
|
||||||
end
|
|
||||||
|
|
||||||
valueStore[localExecId]["value"] = endValue
|
|
||||||
end
|
|
||||||
|
|
||||||
if iters == fullUpdateLoops then
|
|
||||||
iters = 0
|
|
||||||
|
|
||||||
end
|
|
||||||
|
|
||||||
coroutine.yield(updateInterval)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
return main
|
|
||||||
132
Fader Feedback 2/RBFaderFeedbackv2_2.lua
Normal file
132
Fader Feedback 2/RBFaderFeedbackv2_2.lua
Normal file
|
|
@ -0,0 +1,132 @@
|
||||||
|
-- Edit the variables below to suit your situation
|
||||||
|
|
||||||
|
local faders = {201, 202, 203, 204, 205, 206, 207, 208, 209, 401, 402, 403, 404, 405, 406, 407, 408}
|
||||||
|
local keys = {201, 202, 203, 204, 205, 206, 207, 208, 101, 102, 103, 104, 105, 106, 107, 108, 109, 301, 302, 303, 304, 305, 306, 307, 308, 401, 402, 403, 404, 405,406, 407, 408, 191, 192, 193, 194, 195, 196, 197, 198, 291, 292, 293, 294, 295, 296, 297, 298}
|
||||||
|
|
||||||
|
-- how many seconds should be between updates.
|
||||||
|
-- set this higher if you have performance issues
|
||||||
|
-- you can go lower for smoother feedback at your own risk
|
||||||
|
local updateInterval = 0.1
|
||||||
|
|
||||||
|
-- the name of the OSC object that feedback should be sent out from
|
||||||
|
local feedbackOSCName = "Feedback"
|
||||||
|
|
||||||
|
-- The name of the OSC object that receives OSC data.
|
||||||
|
-- This object will automatically be enabled/disabled based on desk lock state
|
||||||
|
-- so locking the desk will also prevent people from messing around with your faders
|
||||||
|
local inputOSCName = "SC"
|
||||||
|
|
||||||
|
-- set this to true if you don't want desk lock to disable OSC input
|
||||||
|
-- this makes the "inputOSCName" variable irrelevant
|
||||||
|
local disableInputWhenLocked = false
|
||||||
|
|
||||||
|
-- run a full update every x amount of loops
|
||||||
|
local fullUpdateLoops = 20
|
||||||
|
|
||||||
|
-- if this is turned on, button feedback for sequences will have value 2 for "active"
|
||||||
|
-- it will also send 4 osc arguments when a sequence has an appearance
|
||||||
|
-- data being active,red,green,blue where active is 1
|
||||||
|
-- set to false for only getting 0 or 1 values
|
||||||
|
local enhancedSequenceFeedback = true
|
||||||
|
|
||||||
|
-- No need to edit anything under this line
|
||||||
|
|
||||||
|
|
||||||
|
local function sendOSC(type, id, value, valueType)
|
||||||
|
if valueType == nil then valueType = 'f' end
|
||||||
|
local address = "/Page/" .. type .. id
|
||||||
|
local cmd = 'SendOSC "' .. feedbackOSCName .. '" "' .. address .. ',' .. valueType .. ',' .. value ..'"'
|
||||||
|
Cmd(cmd)
|
||||||
|
end
|
||||||
|
|
||||||
|
local function buildValueStore(store, items, type)
|
||||||
|
for _, item in ipairs(items) do
|
||||||
|
store[#store + 1] = {id = item, type = type, value = nil}
|
||||||
|
sendOSC(type, item, 0)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
local function main()
|
||||||
|
breakRBloops = false
|
||||||
|
|
||||||
|
local currentLockedState = false
|
||||||
|
local valueStore = {}
|
||||||
|
|
||||||
|
buildValueStore(valueStore, faders, "Fader")
|
||||||
|
buildValueStore(valueStore, keys, "Key")
|
||||||
|
|
||||||
|
local iters = 0
|
||||||
|
while not breakRBloops do
|
||||||
|
iters = iters + 1
|
||||||
|
if (DeskLocked() ~= currentLockedState and disableInputWhenLocked == false) then
|
||||||
|
currentLockedState = DeskLocked()
|
||||||
|
|
||||||
|
local receiveOSCValue = currentLockedState and 0 or 1
|
||||||
|
Cmd('Set OSC "' .. inputOSCName .. '" "receive" ' .. receiveOSCValue)
|
||||||
|
Cmd('Set OSC "' .. inputOSCName .. '" "receivecommand" ' .. receiveOSCValue)
|
||||||
|
end
|
||||||
|
|
||||||
|
for localExecId, storedExec in pairs(valueStore) do
|
||||||
|
local endValue = storedExec["value"]
|
||||||
|
local sendType = "f"
|
||||||
|
local exec = GetExecutor(storedExec["id"])
|
||||||
|
|
||||||
|
if exec ~= nil then
|
||||||
|
if storedExec["type"] == "Fader" then
|
||||||
|
local faderValue = exec:GetFader({})
|
||||||
|
endValue = faderValue
|
||||||
|
else -- exec is key
|
||||||
|
local obj = exec.object
|
||||||
|
endValue = 1
|
||||||
|
|
||||||
|
if enhancedSequenceFeedback then
|
||||||
|
if obj ~= nil and obj.type == "Macro" then
|
||||||
|
endValue = "1,255,0,0"
|
||||||
|
sendType = "ffff"
|
||||||
|
end
|
||||||
|
|
||||||
|
-- check if we're an active sequence
|
||||||
|
-- if it is, and it's active, send value 2
|
||||||
|
if obj ~= nil and obj.type == "Sequence" then
|
||||||
|
if obj:HasActivePlayback() then
|
||||||
|
endValue = 2
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Send appearance color + activity
|
||||||
|
if obj ~= nil then
|
||||||
|
local appearance = obj.Appearance
|
||||||
|
if appearance ~= nil then
|
||||||
|
endValue = endValue ..
|
||||||
|
"," .. appearance.BackR ..
|
||||||
|
"," .. appearance.BackG ..
|
||||||
|
"," .. appearance.BackB
|
||||||
|
|
||||||
|
sendType = "ffff"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
else -- exec is nil
|
||||||
|
endValue = nil
|
||||||
|
end
|
||||||
|
|
||||||
|
-- if the value has changed, send feedback over
|
||||||
|
if (storedExec["value"] ~= endValue or iters == fullUpdateLoops) then
|
||||||
|
local sendValue = endValue == nil and 0 or endValue
|
||||||
|
sendOSC(storedExec["type"], storedExec["id"], sendValue, sendType)
|
||||||
|
end
|
||||||
|
|
||||||
|
valueStore[localExecId]["value"] = endValue
|
||||||
|
end
|
||||||
|
|
||||||
|
if iters == fullUpdateLoops then
|
||||||
|
iters = 0
|
||||||
|
end
|
||||||
|
|
||||||
|
coroutine.yield(updateInterval)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return main
|
||||||
Loading…
Add table
Add a link
Reference in a new issue