Vtc.Timecode.add

You're seeing just the function add, go back to Vtc.Timecode module for more information.

Specs

add(a :: t(), b :: t() | Vtc.Source.Frames.t()) :: t()

Adds two timecodoes together using their real-world seconds representation. When the rates of a and b are not equal, the result will inheret the framerat of a and be rounded to the seconds representation of the nearest whole-frame at that rate.

b May be any value that implements the Frames protocol, such as a timecode string, and will be assumed to be the same framerate as a. This is mostly to support quick scripting. This function will raise if there is an error parsing b.

Examples

Two timecodes running at the same rate:

iex> a = Timecode.with_frames!("01:00:00:00", Rates.f23_98())
iex> b = Timecode.with_frames!("01:30:21:17", Rates.f23_98())
iex> Timecode.add(a, b) |> inspect()
"<02:30:21:17 @ <23.98 NTSC NDF>>"

Two timecodes running at different rates:

iex> a = Timecode.with_frames!("01:00:00:00", Rates.f23_98())
iex> b = Timecode.with_frames!("00:00:00:02", Rates.f47_95())
iex> Timecode.add(a, b) |> inspect()
"<01:00:00:01 @ <23.98 NTSC NDF>>"

Using a timcode and a bare string:

iex> a = Timecode.with_frames!("01:00:00:00", Rates.f23_98())
iex> Timecode.add(a, "01:30:21:17") |> inspect()
"<02:30:21:17 @ <23.98 NTSC NDF>>"