diff --git a/share/scripts/_vamp_example.lua b/share/scripts/_vamp_example.lua index 73552d638c..5c0dea6f7e 100644 --- a/share/scripts/_vamp_example.lua +++ b/share/scripts/_vamp_example.lua @@ -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 diff --git a/share/scripts/_vamp_tempomap_example.lua b/share/scripts/_vamp_tempomap_example.lua index 44de09c629..3b7ba8458b 100644 --- a/share/scripts/_vamp_tempomap_example.lua +++ b/share/scripts/_vamp_tempomap_example.lua @@ -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)