Sha256: aedb448cb19aece4118ec7d47f75aa81e644b605e31dd72b4f2094defc4f76ef

Contents?: true

Size: 807 Bytes

Versions: 5

Compression:

Stored size: 807 Bytes

Contents

require 'xot/setter'
require 'xot/universal_accessor'
require 'xot/block_util'
require 'beeps/ext'


module Beeps


  class Sound

    include Xot::Setter

    def initialize(
      processor, seconds = 0, nchannels: 1, sample_rate: 0, **options, &block)

      setup processor, seconds, nchannels, sample_rate
      set(**options) unless options.empty?
      Xot::BlockUtil.instance_eval_or_block_call self, &block if block
    end

    def play(**options, &block)
      play!.tap do |player|
        player.set(**options) unless options.empty?
        Xot::BlockUtil.instance_eval_or_block_call player, &block if block
      end
    end

    universal_accessor :gain, :loop

  end# Sound


  class SoundPlayer

    include Xot::Setter

    universal_accessor :gain, :loop

  end# SoundPlayer


end# Beeps

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
beeps-0.1.40 lib/beeps/sound.rb
beeps-0.1.39 lib/beeps/sound.rb
beeps-0.1.38 lib/beeps/sound.rb
beeps-0.1.37 lib/beeps/sound.rb
beeps-0.1.36 lib/beeps/sound.rb