More s/frame/sample/ -- Lua Scripts
Sadly this breaks existing loaded scripts. C'est la vie.
This commit is contained in:
parent
53fb2f6235
commit
eb928b05e9
|
@ -728,14 +728,14 @@ LuaInstance::register_classes (lua_State* L)
|
|||
|
||||
.beginClass <RegionSelection> ("RegionSelection")
|
||||
.addFunction ("start", &RegionSelection::start)
|
||||
.addFunction ("end_frame", &RegionSelection::end_sample)
|
||||
.addFunction ("end_sample", &RegionSelection::end_sample)
|
||||
.addFunction ("n_midi_regions", &RegionSelection::n_midi_regions)
|
||||
.addFunction ("regionlist", &RegionSelection::regionlist) // XXX check windows binding (libardour)
|
||||
.endClass ()
|
||||
|
||||
.deriveClass <TimeSelection, std::list<ARDOUR::AudioRange> > ("TimeSelection")
|
||||
.addFunction ("start", &TimeSelection::start)
|
||||
.addFunction ("end_frame", &TimeSelection::end_sample)
|
||||
.addFunction ("end_sample", &TimeSelection::end_sample)
|
||||
.addFunction ("length", &TimeSelection::length)
|
||||
.endClass ()
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@ function factory (params)
|
|||
tx:send ("/session/solo_changed", "")
|
||||
elseif (signal == LuaSignal.TransportStateChange) then
|
||||
tx:send ("/session/transport", "if",
|
||||
Session:transport_frame(), Session:transport_speed())
|
||||
Session:transport_sample(), Session:transport_speed())
|
||||
elseif (signal == LuaSignal.RegionPropertyChanged) then
|
||||
obj,pch = ...
|
||||
tx:send ("/region_property_changed", "sTTiii",
|
||||
|
|
|
@ -21,13 +21,13 @@ function factory (params)
|
|||
local p = params["print"] or "no"
|
||||
local timeout = params["time"] or 90
|
||||
a = a or 0
|
||||
if p ~= "no" then print (a, n_samples, Session:frame_rate (), Session:transport_rolling ()) end -- debug output (not rt safe)
|
||||
if p ~= "no" then print (a, n_samples, Session:sample_rate (), Session:transport_rolling ()) end -- debug output (not rt safe)
|
||||
if (not Session:transport_rolling()) then
|
||||
a = 0
|
||||
return
|
||||
end
|
||||
a = a + n_samples
|
||||
if (a > timeout * Session:frame_rate()) then
|
||||
if (a > timeout * Session:sample_rate()) then
|
||||
Session:request_transport_speed(0.0, true)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -14,7 +14,7 @@ function factory () return function ()
|
|||
|
||||
-- load the Vamp Plugin with Id "libardourvampplugins:dBTP"
|
||||
-- http://manual.ardour.org/lua-scripting/class_reference/#ARDOUR:LuaAPI:Vamp
|
||||
local vamp = ARDOUR.LuaAPI.Vamp("libardourvampplugins:dBTP", Session:nominal_frame_rate())
|
||||
local vamp = ARDOUR.LuaAPI.Vamp("libardourvampplugins:dBTP", Session:nominal_sample_rate())
|
||||
print (vamp:plugin():getName())
|
||||
|
||||
-- for each selected region
|
||||
|
|
|
@ -19,7 +19,7 @@ function factory () return function ()
|
|||
-- http://manual.ardour.org/lua-scripting/class_reference/#ArdourUI:Editor
|
||||
-- http://manual.ardour.org/lua-scripting/class_reference/#ArdourUI:Selection
|
||||
local sel = Editor:get_selection ()
|
||||
local sr = Session:nominal_frame_rate ()
|
||||
local sr = Session:nominal_sample_rate ()
|
||||
|
||||
-- Instantiate a Vamp Plugin
|
||||
-- see http://manual.ardour.org/lua-scripting/class_reference/#ARDOUR:LuaAPI:Vamp
|
||||
|
|
|
@ -12,7 +12,7 @@ function factory () return function ()
|
|||
--
|
||||
-- here: the "Queen Mary Note Onset Detector" Vamp plugin (which comes with Ardour)
|
||||
-- http://vamp-plugins.org/plugin-doc/qm-vamp-plugins.html#qm-onsetdetector
|
||||
local vamp = ARDOUR.LuaAPI.Vamp("libardourvampplugins:qm-onsetdetector", Session:nominal_frame_rate())
|
||||
local vamp = ARDOUR.LuaAPI.Vamp("libardourvampplugins:qm-onsetdetector", Session:nominal_sample_rate())
|
||||
|
||||
-- prepare table to hold results
|
||||
local onsets = {}
|
||||
|
|
|
@ -10,7 +10,7 @@ function factory () return function ()
|
|||
-- Instantiate the QM BarBeat Tracker
|
||||
-- see http://manual.ardour.org/lua-scripting/class_reference/#ARDOUR:LuaAPI:Vamp
|
||||
-- http://vamp-plugins.org/plugin-doc/qm-vamp-plugins.html#qm-barbeattracker
|
||||
local vamp = ARDOUR.LuaAPI.Vamp("libardourvampplugins:qm-barbeattracker", Session:nominal_frame_rate())
|
||||
local vamp = ARDOUR.LuaAPI.Vamp("libardourvampplugins:qm-barbeattracker", Session:nominal_sample_rate())
|
||||
|
||||
-- prepare table to hold results
|
||||
local beats = {}
|
||||
|
|
|
@ -19,7 +19,7 @@ have to wait for the export.
|
|||
|
||||
function factory (unused_params) return function ()
|
||||
|
||||
local fr = Session:frame_rate()
|
||||
local fr = Session:sample_rate()
|
||||
local chaps = {}
|
||||
|
||||
for l in Session:locations():list():iter() do
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
ardour { ["type"] = "Snippet", name = "Fader Automation" }
|
||||
|
||||
function factory () return function ()
|
||||
local playhead = Session:transport_frame ()
|
||||
local samplerate = Session:nominal_frame_rate ()
|
||||
local playhead = Session:transport_sample ()
|
||||
local samplerate = Session:nominal_sample_rate ()
|
||||
|
||||
-- get selected tracks
|
||||
rl = Editor:get_selection ().tracks:routelist ()
|
||||
|
|
|
@ -2,8 +2,8 @@ ardour { ["type"] = "Snippet", name = "Plugin automation" }
|
|||
|
||||
function factory () return function ()
|
||||
-- query playhead position and session sample-rate
|
||||
local playhead = Session:transport_frame ()
|
||||
local samplerate = Session:nominal_frame_rate ()
|
||||
local playhead = Session:transport_sample ()
|
||||
local samplerate = Session:nominal_sample_rate ()
|
||||
|
||||
-- get Track/Bus with RID 3
|
||||
local r = Session:get_remote_nth_route(3)
|
||||
|
|
|
@ -11,8 +11,8 @@ function factory () return function ()
|
|||
--
|
||||
|
||||
-- Range selection, total span of all ranges (0, 0 if no time range is selected)
|
||||
if sel.time:start () < sel.time:end_frame () then
|
||||
print ("Total Range:", sel.time:start (), sel.time:end_frame ())
|
||||
if sel.time:start () < sel.time:end_sample () then
|
||||
print ("Total Range:", sel.time:start (), sel.time:end_sample ())
|
||||
end
|
||||
|
||||
-- Range selection, individual ranges.
|
||||
|
|
|
@ -3,7 +3,7 @@ function factory () return function ()
|
|||
|
||||
local plugins = ARDOUR.LuaAPI.Vamp.list_plugins ();
|
||||
for id in plugins:iter () do
|
||||
local vamp = ARDOUR.LuaAPI.Vamp(id, Session:nominal_frame_rate())
|
||||
local vamp = ARDOUR.LuaAPI.Vamp(id, Session:nominal_sample_rate())
|
||||
local vp = vamp:plugin ()
|
||||
print (" --- VAMP Plugin ---")
|
||||
print ("Id:", vp:getIdentifier ())
|
||||
|
|
|
@ -13,7 +13,7 @@ function factory ()
|
|||
return
|
||||
end
|
||||
|
||||
local pos = Session:transport_frame () -- current playhead position
|
||||
local pos = Session:transport_sample () -- current playhead position
|
||||
local loc = Session:locations () -- all marker locations
|
||||
|
||||
-- find first marker after the current playhead position, ignore loop + punch ranges
|
||||
|
|
|
@ -171,7 +171,7 @@ function factory (params) return function ()
|
|||
local itt = ARDOUR.InterThreadInfo () -- bounce progress info (unused)
|
||||
|
||||
local loop = Session:locations ():auto_loop_location ()
|
||||
local playhead = Session:transport_frame ()
|
||||
local playhead = Session:transport_sample ()
|
||||
|
||||
-- make sure we have a loop, and the playhead (edit point) is after it
|
||||
if not loop then
|
||||
|
|
|
@ -15,13 +15,13 @@ The plugin works best at 44.1KHz input sample rate, and is tuned for piano and g
|
|||
|
||||
function factory () return function ()
|
||||
local sel = Editor:get_selection ()
|
||||
local sr = Session:nominal_frame_rate ()
|
||||
local sr = Session:nominal_sample_rate ()
|
||||
local tm = Session:tempo_map ()
|
||||
local vamp = ARDOUR.LuaAPI.Vamp ("libardourvampplugins:qm-transcription", sr)
|
||||
local midi_region
|
||||
local audio_regions = {}
|
||||
local start_time = Session:current_end_frame ()
|
||||
local end_time = Session:current_start_frame ()
|
||||
local start_time = Session:current_end_sample ()
|
||||
local end_time = Session:current_start_sample ()
|
||||
for r in sel.regions:regionlist ():iter () do
|
||||
if r:to_midiregion():isnil() then
|
||||
local st = r:position()
|
||||
|
@ -56,8 +56,8 @@ function factory () return function ()
|
|||
local fd = Vamp.RealTime.realTime2Frame (f.duration, sr)
|
||||
local fn = f.values:at (0)
|
||||
|
||||
local bs = tm:exact_qn_at_frame (a_off + ft, 0)
|
||||
local be = tm:exact_qn_at_frame (a_off + ft + fd, 0)
|
||||
local bs = tm:exact_qn_at_sample (a_off + ft, 0)
|
||||
local be = tm:exact_qn_at_sample (a_off + ft + fd, 0)
|
||||
|
||||
local pos = Evoral.Beats (bs - b_off)
|
||||
local len = Evoral.Beats (be - bs)
|
||||
|
|
Loading…
Reference in New Issue