diff options
author | Robin Gareus <robin@gareus.org> | 2020-02-23 20:48:02 +0100 |
---|---|---|
committer | Robin Gareus <robin@gareus.org> | 2020-02-23 20:48:02 +0100 |
commit | 180843f9bd28b191c7404245ba0a121107992511 (patch) | |
tree | c60312dc09f76c2f55ba2383245c427e15c38dea /scripts/_midi_rec_start.lua | |
parent | bf649cd68ad46c34a656700aa6cb89416d648c64 (diff) |
Also move Lua scripts to share subfolder
Diffstat (limited to 'scripts/_midi_rec_start.lua')
-rw-r--r-- | scripts/_midi_rec_start.lua | 37 |
1 files changed, 0 insertions, 37 deletions
diff --git a/scripts/_midi_rec_start.lua b/scripts/_midi_rec_start.lua deleted file mode 100644 index b2e03ba28b..0000000000 --- a/scripts/_midi_rec_start.lua +++ /dev/null @@ -1,37 +0,0 @@ -ardour { - ["type"] = "session", - name = "MIDI Record Enable", - category = "Example", -- "Utility" - license = "MIT", - author = "Ardour Lua Task Force", - description = [[An example script to start recording on note-on.]] -} - -function factory () - return function (n_samples) - if Session:actively_recording() then return end -- when recording already, do nothing - -- iterate over all MIDI ports - _, t = Session:engine ():get_ports (ARDOUR.DataType.midi (), ARDOUR.PortList ()) - for p in t[2]:iter () do - -- skip output ports - if not p:receives_input () then goto next end - local midiport = p:to_midiport () - -- and skip async event ports - if midiport:isnil () then goto next end - local mb = midiport:get_midi_buffer (n_samples) -- get the midi-data buffers - local events = mb:table () -- copy event list into lua table - for _,e in pairs (events) do -- iterate over all events in the midi-buffer - if (e:buffer():array()[1] & 0xf0) == 0x90 then -- note on - Session:maybe_enable_record (true) -- global record-enable from rt-context - -- maybe-enable may fail if there are no tracks or step-entry is active - -- roll transport if record-enable suceeded: - if ARDOUR.Session.RecordState.Enabled == Session:record_status() then - Session:request_transport_speed (1.0, true, ARDOUR.TransportRequestSource.TRS_UI) -- ...and go. - end - return - end - end - ::next:: - end - end -end |