Class: FlameChannelParser::TimewarpExtractor::X

Inherits:
Extractor
  • Object
show all
Defined in:
lib/timewarp_extractor.rb

Constant Summary collapse

FRAMECURVE_FORMAT =
"%d\t%.5f\r\n"

Constants inherited from Extractor

Extractor::DEFAULT_CHANNEL_TO_EXTRACT

Instance Method Summary collapse

Methods inherited from Extractor

extract, #extract

Instance Method Details

#find_channel_in(channels, channel_path) ⇒ Object

This one is overridden here since instead of looking for a particular channel we are looking for matches from a list



13
14
15
16
17
18
# File 'lib/timewarp_extractor.rb', line 13

def find_channel_in(channels, channel_path)
  # Ignore the passed channels, just override
  detected_channel = channels.find{|c| CHANNELS.include?(c.path) }
  return detected_channel if detected_channel
  raise ChannelNotFoundError, compose_channel_not_found_message(CHANNELS.join(' or '), channels)
end

#write_channel(interpolator, to_io, from_frame_i, to_frame_i) ⇒ Object

Overridden to write a framecurve header



28
29
30
31
32
# File 'lib/timewarp_extractor.rb', line 28

def write_channel(interpolator, to_io, from_frame_i, to_frame_i)
  @c = Framecurve::Curve.new
  super
  Framecurve::Serializer.new.serialize(to_io, @c)
end

#write_frame(to_io, frame, value) ⇒ Object

Overridden to force CRLF line breaks as per Framecurve spec



23
24
25
# File 'lib/timewarp_extractor.rb', line 23

def write_frame(to_io, frame, value)
  @c.tuple!(frame, value)
end