Update Lua VAMP scripts, follow readable API change since 7.0
This commit is contained in:
parent
bc6a9609ff
commit
84b11298c9
@ -19,10 +19,14 @@ function factory () return function ()
|
||||
|
||||
-- for each selected region
|
||||
for r in sel.regions:regionlist ():iter () do
|
||||
local ar = r:to_audioregion ()
|
||||
if ar:isnil () then
|
||||
goto next
|
||||
end
|
||||
print ("Region:", r:name ())
|
||||
|
||||
-- run the plugin, analyze the first channel of the audio-region
|
||||
vamp:analyze (r:to_readable (), 0, nil)
|
||||
vamp:analyze (ar:to_readable (), 0, nil)
|
||||
|
||||
-- get analysis results
|
||||
local f = vamp:plugin ():getRemainingFeatures ()
|
||||
@ -59,5 +63,6 @@ function factory () return function ()
|
||||
|
||||
-- reset the plugin for the next iteration
|
||||
vamp:reset ()
|
||||
::next::
|
||||
end
|
||||
end end
|
||||
|
@ -20,6 +20,10 @@ function factory () return function ()
|
||||
-- http://manual.ardour.org/lua-scripting/class_reference/#ArdourUI:RegionSelection
|
||||
for r in sel.regions:regionlist ():iter () do
|
||||
-- "r" is-a http://manual.ardour.org/lua-scripting/class_reference/#ARDOUR:Region
|
||||
local ar = r:to_audioregion ()
|
||||
if ar:isnil () then
|
||||
goto next
|
||||
end
|
||||
|
||||
-- prepare lua table to hold results for the given region (by name)
|
||||
beats[r:name ()] = {}
|
||||
@ -60,11 +64,12 @@ function factory () return function ()
|
||||
vamp:plugin ():setParameter ("Beats Per Bar", 4); -- TODO ask
|
||||
|
||||
-- run the plugin, analyze the first channel of the audio-region
|
||||
vamp:analyze (r:to_readable (), 0, callback)
|
||||
vamp:analyze (ar:to_readable (), 0, callback)
|
||||
-- get remaining features (end of analysis)
|
||||
callback (vamp:plugin ():getRemainingFeatures ())
|
||||
-- reset the plugin (prepare for next iteration)
|
||||
vamp:reset ()
|
||||
::next::
|
||||
end
|
||||
|
||||
-- print results (for now)
|
||||
|
Loading…
Reference in New Issue
Block a user