Sha256: 7a72eb60e59345fac35490051747d74c0f3c3757adc0bb4016b37918f48ef3ff

Contents?: true

Size: 741 Bytes

Versions: 2

Compression:

Stored size: 741 Bytes

Contents

# Copyright (C) 2013-2014, Eric Wong <e@80x24.org> and all contributors
# License: GPLv3 or later (https://www.gnu.org/licenses/gpl-3.0.txt)
require_relative '../dtas'
class DTAS::CueIndex
  attr_reader :offset
  attr_reader :index

  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

  def to_hash
    { "index" => @index, "offset" => @offset }
  end

  def offset_samples(format)
    case @offset
    when /\A(\d+)s\z/
      $1.to_i
    else
      format.hhmmss_to_samples(@offset)
    end
  end

  def pregap?
    @index == 0
  end

  def track?
    @index == 1
  end

  def subindex?
    @index > 1
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
dtas-0.9.0 lib/dtas/cue_index.rb
dtas-0.8.0 lib/dtas/cue_index.rb