Class: DTAS::CueIndex
- Inherits:
-
Object
- Object
- DTAS::CueIndex
- Defined in:
- lib/dtas/cue_index.rb
Overview
embedded CUE sheet representation for -player
Instance Attribute Summary collapse
-
#index ⇒ Object
readonly
Returns the value of attribute index.
-
#offset ⇒ Object
readonly
Returns the value of attribute offset.
Instance Method Summary collapse
-
#initialize(index, offset) ⇒ CueIndex
constructor
A new instance of CueIndex.
- #offset_samples(format) ⇒ Object
- #pregap? ⇒ Boolean
- #subindex? ⇒ Boolean
- #to_hash ⇒ Object
- #track? ⇒ Boolean
Constructor Details
#initialize(index, offset) ⇒ CueIndex
Returns a new instance of CueIndex.
10 11 12 13 14 15 |
# File 'lib/dtas/cue_index.rb', line 10 def initialize(index, offset) @index = index.to_i # must be compatible with the sox "trim" effect @offset = offset # "#{INTEGER}s" (samples) or HH:MM:SS:FRAC end |
Instance Attribute Details
#index ⇒ Object (readonly)
Returns the value of attribute index.
8 9 10 |
# File 'lib/dtas/cue_index.rb', line 8 def index @index end |
#offset ⇒ Object (readonly)
Returns the value of attribute offset.
7 8 9 |
# File 'lib/dtas/cue_index.rb', line 7 def offset @offset end |
Instance Method Details
#offset_samples(format) ⇒ Object
21 22 23 24 25 26 27 28 |
# File 'lib/dtas/cue_index.rb', line 21 def offset_samples(format) case @offset when /\A(\d+)s\z/ $1.to_i else format.hhmmss_to_samples(@offset) end end |
#pregap? ⇒ Boolean
30 31 32 |
# File 'lib/dtas/cue_index.rb', line 30 def pregap? @index == 0 end |
#subindex? ⇒ Boolean
38 39 40 |
# File 'lib/dtas/cue_index.rb', line 38 def subindex? @index > 1 end |
#to_hash ⇒ Object
17 18 19 |
# File 'lib/dtas/cue_index.rb', line 17 def to_hash { "index" => @index, "offset" => @offset } end |
#track? ⇒ Boolean
34 35 36 |
# File 'lib/dtas/cue_index.rb', line 34 def track? @index == 1 end |