Sha256: 098e0b6bf4cb49efc0593bf4ce2c1cc9214f10ac2f7301de6a73676643b77b34

Contents?: true

Size: 553 Bytes

Versions: 3

Compression:

Stored size: 553 Bytes

Contents

# music.rb

module Ruby2D
  class Music

    attr_accessor :data, :loop
    attr_reader :path

    def initialize(path)

      unless RUBY_ENGINE == 'opal'
        unless File.exists? path
          raise Error, "Cannot find audio file `#{path}`"
        end
      end

      @path = path
      @loop = false
      ext_init(path)
    end

    def play
      ext_play
    end

    def pause
      ext_pause
    end

    def resume
      ext_resume
    end

    def stop
      ext_stop
    end

    def fadeout(ms)
      ext_fadeout(ms)
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ruby2d-0.5.1 lib/ruby2d/music.rb
ruby2d-0.5.0 lib/ruby2d/music.rb
ruby2d-0.4.2 lib/ruby2d/music.rb