class TRecs::Recorder

Attributes

current_content[RW]
current_time[RW]
offset[RW]
recording[RW]
step[R]
strategy[R]
writer[R]

Public Class Methods

new(options={}) click to toggle source
# File lib/trecs/recorder.rb, line 12
def initialize(options={})
  @writer            = options.fetch(:writer)
  @writer.recorder   = self

  @strategy          = options.fetch(:strategy)
  @strategy.recorder = self

  @step   = options.fetch(:step)   { 100 }
  @offset = options.fetch(:offset) { 0 }

  @recording    = false
  @current_time = nil
end

Public Instance Methods

next_timestamp() click to toggle source
# File lib/trecs/recorder.rb, line 33
def next_timestamp
  @current_time = -step unless @current_time
  @current_time += step
end
record() click to toggle source
# File lib/trecs/recorder.rb, line 26
def record
  self.current_time = nil
  self.recording    = true
  strategy.write_frames_to(writer)
  self.recording    = false
end
stop() click to toggle source
# File lib/trecs/recorder.rb, line 38
def stop
  strategy.stop
end