class Timecode::ComputationValues

Attributes

drop_count[R]
frames_per_10_min[R]
frames_per_hour[R]
frames_per_min[R]
nd_frames_per_min[R]

Public Class Methods

new(fps, drop_frame) click to toggle source
# File lib/timecode.rb, line 20
def initialize(fps, drop_frame)
  rounded_base = fps.round
  if (drop_frame)
    # first 2 frame numbers shall be omitted at the start of each minute,
    # except minutes 0, 10, 20, 30, 40 and 50
    @drop_count = 2
    if (fps > 59 && fps < 60)
      @drop_count *= 2
    end

    @frames_per_min = rounded_base * 60 - @drop_count
    @frames_per_10_min = @frames_per_min * 10 + @drop_count
  else
    @frames_per_min = rounded_base * 60
    @frames_per_10_min = @frames_per_min * 10
  end

  @frames_per_hour = @frames_per_10_min * 6
  @nd_frames_per_min = rounded_base * 60
end