mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-06 06:44:57 +01:00
Add some doc/comments to the timecode example script
This commit is contained in:
parent
3fe99b0c7c
commit
3242bbd84c
1 changed files with 10 additions and 6 deletions
|
|
@ -2,15 +2,19 @@ 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))
|
||||
local samplerate = 48000 -- samples per second
|
||||
|
||||
-- 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)
|
||||
-- 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))
|
||||
|
||||
-- use session-settings
|
||||
-- generic convert, explicitly provide Timecode (fps) and sample-rate
|
||||
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: 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))
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue