fix mistaken "do not roll" conclusion in TransportFSM::compute_should_roll()
[ardour.git] / scripts / s_timecode.lua
1 ardour { ["type"] = "Snippet", name = "Timecode" }
2
3 function factory () return function ()
4
5         local samplerate = 48000 -- samples per second
6
7         -- generic convert, explicitly provide Timecode (fps) and sample-rate
8         -- http://manual.ardour.org/lua-scripting/class_reference/#Timecode.TimecodeFormat
9         hh, mm, ss, ff = ARDOUR.LuaAPI.sample_to_timecode (Timecode.TimecodeFormat.TC25, samplerate, 1920)
10         print (ARDOUR.LuaAPI.sample_to_timecode (Timecode.TimecodeFormat.TC25, samplerate, 1920))
11
12         -- generic convert, explicitly provide Timecode (fps) and sample-rate
13         local s = ARDOUR.LuaAPI.timecode_to_sample (Timecode.TimecodeFormat.TC25, samplerate, 10, 11, 12, 13)
14         assert (25 * (10 * 3600 + 11 * 60 + 12 ) + 13 == s * 25 / samplerate)
15
16         -- use session-settings: sample-rate and timecode format is taken from the
17         -- current session. Note that the sample-rate includes pull-up/down
18         print (Session:sample_to_timecode_lua (12345))
19         print (Session:timecode_to_sample_lua (10, 11, 12, 13))
20
21 end end