diff options
author | Robin Gareus <robin@gareus.org> | 2016-12-08 15:42:11 +0100 |
---|---|---|
committer | Robin Gareus <robin@gareus.org> | 2016-12-08 15:42:11 +0100 |
commit | 3242bbd84c70b497810480cd7b7780cb4658d088 (patch) | |
tree | 2a548f5a573ec92a1aeaf5dd86e4f4ddd62fc920 /scripts | |
parent | 3fe99b0c7c2e4cc97779a79a06b86317810dc6a3 (diff) |
Add some doc/comments to the timecode example script
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/s_timecode.lua | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/scripts/s_timecode.lua b/scripts/s_timecode.lua index 5ed1d54631..9f6601f903 100644 --- a/scripts/s_timecode.lua +++ b/scripts/s_timecode.lua @@ -2,15 +2,19 @@ ardour { ["type"] = "Snippet", name = "Timecode" } function factory () return function () + local samplerate = 48000 -- samples per second + -- 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)) + -- http://manual.ardour.org/lua-scripting/class_reference/#Timecode.TimecodeFormat + hh, mm, ss, ff = ARDOUR.LuaAPI.sample_to_timecode (Timecode.TimecodeFormat.TC25, samplerate, 1920) + print (ARDOUR.LuaAPI.sample_to_timecode (Timecode.TimecodeFormat.TC25, samplerate, 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) + local s = ARDOUR.LuaAPI.timecode_to_sample (Timecode.TimecodeFormat.TC25, samplerate, 10, 11, 12, 13) + assert (25 * (10 * 3600 + 11 * 60 + 12 ) + 13 == s * 25 / samplerate) - -- use session-settings + -- use session-settings: sample-rate and timecode format is taken from the + -- current session. Note that the sample-rate includes pull-up/down print (Session:sample_to_timecode_lua (12345)) print (Session:timecode_to_sample_lua (10, 11, 12, 13)) |