-
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
203 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,151 @@ | ||
--[[ | ||
MIT License | ||
Copyright (c) 2019 Down Right Technical Inc. | ||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. | ||
--]] | ||
|
||
|
||
-- **************************************************************** | ||
-- speed up global functions, by creating local cache | ||
-- this can be very important for high speed plugins | ||
-- caring about performance is imperative for plugins with execute function | ||
-- **************************************************************** | ||
|
||
local F=string.format; | ||
local E=Echo; | ||
|
||
local pluginName = select(1,...); | ||
local componentName = select(2,...); | ||
local signalTable = select(3,...); | ||
local my_handle = select(4,...); | ||
|
||
-- local functions | ||
--local | ||
|
||
-- **************************************************************** | ||
-- plugin main entry point | ||
-- **************************************************************** | ||
local function Main (display_handle, argument) | ||
local arguments = Drt.split(argument, ",") | ||
local tick = 1/30 -- updates / second | ||
local op = "" -- the object we are operating on | ||
local destPage -- the page asked for | ||
local destExec -- the executor on the page | ||
local destSeq -- the sequence | ||
local faderEnd -- the end value for the fader | ||
local faderTime = 0 -- the time to run | ||
local execObject = nil | ||
local v = UserVars() | ||
local gVarName = "" | ||
|
||
|
||
if argument == nil or #arguments ~= 4 then | ||
ErrPrintf("Incorrect number of arguments") | ||
ErrPrintf("Plugin \"Fade Master\" \"<Page|Sequence>, <Page#.Executor# | Sequence#>, <Level>, <Seconds> \"") | ||
return | ||
end | ||
|
||
faderEnd = Drt.clamp(tonumber(arguments[3]), 0.0, 100.0) | ||
faderTime = Drt.clamp(tonumber(arguments[4]), 0.0, 3600.0) | ||
|
||
if string.lower(arguments[1]):sub(1, 3) == "seq" then -- Operate on a Sequence | ||
op = "Sequence" | ||
destSeq = tonumber(arguments[2]) | ||
elseif string.lower(arguments[1]):sub(1, 3) == "pag" then -- Operate on a Page | ||
op = "Page" | ||
local x = Drt.split(arguments[2], ".") | ||
if #x == 2 then | ||
destPage = tonumber(x[1]) | ||
destExec = tonumber(x[2]) | ||
else | ||
ErrPrintf("Incorrect Page Identifier; Page.Ecexutor") | ||
end | ||
end | ||
|
||
|
||
if op == "Sequence" then | ||
gVarName = "FM".."S"..destSeq | ||
execObject = DataPool().sequences:Children()[destSeq] | ||
elseif op == "Page" then | ||
gVarName = "FM".. "P"..destPage.."."..destExec | ||
local executors = DataPool().Pages:Children()[destPage]:Children() | ||
for key, value in pairs(executors) do | ||
if value.No == destExec then | ||
Echo("Found " .. value.Name) | ||
execObject = value | ||
end | ||
end | ||
end | ||
|
||
if GetVar(v, gVarName) ~= nil then | ||
Printf("Exitting, Fade Master already running on " .. gVarName) | ||
return | ||
end | ||
|
||
if execObject == nil then | ||
if op == "Sequence" then | ||
ErrPrintf("Sequence %d not found, Exitting", destSeq) | ||
elseif op == "Page" then | ||
ErrPrintf("Executor %d not found on page %d, Exitting", destExec, destPage) | ||
end | ||
return | ||
else | ||
-- store the current faders position | ||
local faderOptions = {} | ||
faderOptions.value = faderEnd | ||
faderOptions.token = "FaderMaster" | ||
faderOptions.faderDisabled = false; | ||
|
||
local faderStart = execObject:GetFader(faderOptions) | ||
local distance = faderStart - faderEnd | ||
|
||
-- Start momement session | ||
SetVar(v, gVarName, true) | ||
|
||
if faderTime > 0 and math.abs(distance) > 0 then | ||
if op == "Sequence" then | ||
Printf("Running Fade Master on Sequence %d for %d Seconds. To abort fade execute - DelUserVar \"%s\"", destSeq, faderTime, gVarName) | ||
elseif op == "Page" then | ||
Printf("Running Fade Master on Page %d.%d for %d Seconds. To abort fade execute - DelUserVar \"%s\"", destPage, destExec, faderTime, gVarName) | ||
end | ||
local interval = (distance * tick)/faderTime | ||
repeat | ||
local faderCurrent = execObject:GetFader(faderOptions) | ||
faderOptions.value = faderCurrent - interval | ||
execObject:SetFader(faderOptions) | ||
coroutine.yield(tick) | ||
if GetVar(v, gVarName) == nil then | ||
Printf("Exitting ".. gVarName .. " due to Variable Deletion") | ||
return | ||
end | ||
until math.abs(faderOptions.value - faderEnd) <= math.abs(interval) | ||
end | ||
|
||
faderOptions.value = faderEnd | ||
execObject:SetFader(faderOptions) | ||
|
||
-- End momement session | ||
DelVar(v, gVarName) | ||
|
||
Printf("Fade Master ".. gVarName .." Done") | ||
end | ||
end | ||
return Main |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<GMA3 DataVersion="1.0.0.3"> | ||
<Plugin Name="Fade Master" Author="Hoss" Version="1.1.0.1"> | ||
<ComponentLua Name="Fade Master" FileName="Fade Master.lua" Installed="Yes" LoadOnDemand="Yes" /> | ||
<ComponentLua Name="DRT-Utilities" FileName="DRT-Utilities.lua" Installed="Yes" LoadOnDemand="Yes" /> | ||
</Plugin> | ||
</GMA3> |
44 changes: 44 additions & 0 deletions
44
grandMA3/shared/resource/lib_plugins/Fade Master/Fade Master.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# Fade Master | ||
*v1.1.0.1* | ||
Please note that this will likly break in future version of the console. and to use at your own risk. | ||
|
||
 | ||
|
||
Allows you to automate a Executor or Sequence Fader movement over time. | ||
|
||
In grandMA 2 you could do `ExecButton 1.1 At 100 Fade 3` | ||
|
||
With this plugin you can do: | ||
'Plugin "Fade Master" "Page,1.201,100,3"' Which fade executor 1.201 from its current value to 100% over 3 seconds. | ||
|
||
You also can do the following: | ||
'Plugin "Fade Master" "Sequence,4,100,3"' Which Sequence 4 from its current value to 100% over 3 seconds. The executor does not even need to be assigned to an executor or an executor with a master. | ||
|
||
|
||
Additionally, if you have a long running fade that you need to abort you can delete the User Vraiable and the fade will stop. | ||
|
||
### Note: | ||
|
||
* The plugin does it's best to make sure a user does not run the same executor twice, However there are edge cases like assigining Sequence 2 to Page 1.201 and dunning both Page and Sequence modes on the same executor will do undefined things. | ||
* If the Fade Master plugin is already running it will not start again until the previous move is complete (thus its corasponding UserVar is deleted.) | ||
* Fades are limited to 1 Hour, only for a sensible limit. | ||
* Fades are currently always calculated in seconds. | ||
* Spacing between arguments is optional but arguments must be delimited by comma "," | ||
* At the Moment the Plugin only works for `FaderMaster`, but technically it could be modified to allow other types of masters (XFade, Temp, ...) | ||
|
||
### Usage: | ||
|
||
*Fade Executor 1.201 to full* | ||
`Plugin "Fade Maser" "Page , 1.201 , 100 , 5"` | ||
|
||
*Fade Sequence 4 to full* | ||
`Plugin "Fade Maser" "Sequence , 4 , 100 , 5"` | ||
|
||
*Stop Executor 1.201 While running* | ||
`DelUserVar "FMP1.201"` | ||
|
||
*Stop Sequence 4 While running* | ||
`DelUserVar "FMS4"` | ||
|
||
### Releases: | ||
- 1.1.0.1 - Inital Release |