summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2016-12-08 12:45:25 +0100
committerRobin Gareus <robin@gareus.org>2016-12-08 12:45:44 +0100
commit462deb354470499ddca7967d32e01419155fb83e (patch)
tree3ed3e85a0e0ef0411ad43a1df54ff4f883d29b5e /scripts
parent61c7af141d339187d229d28a09940e25b2e144f8 (diff)
Add timecode example script
Diffstat (limited to 'scripts')
-rw-r--r--scripts/s_timecode.lua17
1 files changed, 17 insertions, 0 deletions
diff --git a/scripts/s_timecode.lua b/scripts/s_timecode.lua
new file mode 100644
index 0000000000..5ed1d54631
--- /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