diff options
author | Robin Gareus <robin@gareus.org> | 2016-12-08 12:45:25 +0100 |
---|---|---|
committer | Robin Gareus <robin@gareus.org> | 2016-12-08 12:45:44 +0100 |
commit | 462deb354470499ddca7967d32e01419155fb83e (patch) | |
tree | 3ed3e85a0e0ef0411ad43a1df54ff4f883d29b5e /scripts/s_timecode.lua | |
parent | 61c7af141d339187d229d28a09940e25b2e144f8 (diff) | |
download | ardour-462deb354470499ddca7967d32e01419155fb83e.zip ardour-462deb354470499ddca7967d32e01419155fb83e.tar.gz ardour-462deb354470499ddca7967d32e01419155fb83e.tar.bz2 |
Add timecode example script
Diffstat (limited to 'scripts/s_timecode.lua')
-rw-r--r-- | scripts/s_timecode.lua | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/scripts/s_timecode.lua b/scripts/s_timecode.lua new file mode 100644 index 0000000..5ed1d54 --- /dev/null +++ b/scripts/s_timecode.lua @@ -0,0 +1,17 @@ +ardour { ["type"] = "Snippet", name = "Timecode" } + +function factory () return function () + + -- generic convert, explicitly provide Timecode (fps) and sample-rate + hh, mm, ss, ff = ARDOUR.LuaAPI.sample_to_timecode (Timecode.TimecodeFormat.TC25, 48000, 1920) + print (ARDOUR.LuaAPI.sample_to_timecode (Timecode.TimecodeFormat.TC25, 48000, 1920)) + + -- generic convert, explicitly provide Timecode (fps) and sample-rate + local s = ARDOUR.LuaAPI.timecode_to_sample (Timecode.TimecodeFormat.TC25, 48000, 10, 11, 12, 13) + assert (25 * (10 * 3600 + 11 * 60 + 12 ) + 13 == s * 25 / 48000) + + -- use session-settings + print (Session:sample_to_timecode_lua (12345)) + print (Session:timecode_to_sample_lua (10, 11, 12, 13)) + +end end |