Also use xjadeo 64bit windows version
[ardour.git] / scripts / _plugin_modulation.lua
1 --- session-script example to modulate plugin parameter(s) globally
2 --
3 -- Ardour > Menu > Session > Scripting > Add Lua Script
4 --   "Add" , select "Modulate Plugin Parameter",  click "Add" + OK.
5 --
6 -----------------------------------------------------------------------------
7 -- This script currently assumes you have a track named "Audio"
8 -- which as a plugin at the top, where the first parameter has a range > 200
9 -- e.g. "No Delay Line"
10 -- 
11 -- edit below..
12
13
14 -- plugin descriptor
15 ardour {
16         ["type"]    = "session",
17         name        = "Modulate Plugin Parameter",
18         license     = "MIT",
19         author      = "Ardour Lua Task Force",
20         description = [[An example session to modulate a plugin parameter.]]
21 }
22
23 function factory () -- generate a new script instance
24
25         local count = 0 -- script-instance "global" variable
26
27         -- the "run" function called at the beginning of every process cycle
28         return function (n_samples)
29                 count = (count + 1) % 200; -- count process cycles
30                 local tri = math.abs (100 - count) -- triangle wave 0..100
31
32                 -- get the track named "Audio"
33                 -- see also http://manual.ardour.org/lua-scripting/class_reference/#ARDOUR:Session
34                 -- and http://manual.ardour.org/lua-scripting/class_reference/#ARDOUR:Route
35                 local route = Session:route_by_name ("Audio")
36                 assert (not route:isnil ()) -- make sure it exists
37
38                 -- the 1st plugin (from top) on that track, ardour starts counting at zero
39                 -- see also http://manual.ardour.org/lua-scripting/class_reference/#ARDOUR:Processor
40                 local plugin = route:nth_plugin (0)
41                 assert (not plugin:isnil ()) -- make sure it exists
42
43                 -- modulate the plugin's first parameter (0)  from  200 .. 300
44                 ARDOUR.LuaAPI.set_processor_param (plugin, 0, 200.0 + tri)
45         end
46 end