Sha256: 4a7d011cd65a72fb7ccf73a6039734cd33d0432009200a05a97a3cec8271f20c

Contents?: true

Size: 589 Bytes

Versions: 2

Compression:

Stored size: 589 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_music_init(path)
    end

    def play
      ext_music_play
    end

    def pause
      ext_music_pause
    end

    def resume
      ext_music_resume
    end

    def stop
      ext_music_stop
    end

    def fadeout(ms)
      ext_music_fadeout(ms)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ruby2d-0.4.1 lib/ruby2d/music.rb
ruby2d-0.4.0 lib/ruby2d/music.rb