Sha256: a6d84fcb0a5c42b969ab3c30905272f2f8833873f7ef85326478bdb26822a37c

Contents?: true

Size: 885 Bytes

Versions: 4

Compression:

Stored size: 885 Bytes

Contents

module Music
module Transcription

# Describes how to transition from one value to another.
class Transition
  attr_reader :duration
  
  def initialize duration
    @duration = duration
  end
  
  def ==(other)
    @duration == other.duration
  end

  class Immediate < Transition
    def initialize
      super(0)
    end
    
    def clone
      Immediate.new
    end
  end
  
  class Linear < Transition
    def initialize duration
      super(duration)
    end
    
    def clone
      Linear.new @duration
    end
  end
  
  class Sigmoid < Transition
    attr_reader :abruptness
    def initialize duration, abruptness = 0.5
      @abruptness = abruptness
      super(duration)
    end
    
    def clone
      Sigmoid.new @duration, @abruptness
    end
    
    def == other
      @abruptness == other.abruptness &&
      @duration == other.duration
    end
  end
end

end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
music-transcription-0.4.3 lib/music-transcription/transition.rb
music-transcription-0.4.2 lib/music-transcription/transition.rb
music-transcription-0.4.1 lib/music-transcription/transition.rb
music-transcription-0.4.0 lib/music-transcription/transition.rb