Sha256: 206805a52d8a57075fe3fc370a228b7f664afae383b4d99fee18df894b1041ec

Contents?: true

Size: 833 Bytes

Versions: 3

Compression:

Stored size: 833 Bytes

Contents

# -*- coding: utf-8 -*-


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

3 entries across 3 versions & 1 rubygems

Version Path
beeps-0.1.35 lib/beeps/sound.rb
beeps-0.1.34 lib/beeps/sound.rb
beeps-0.1.33 lib/beeps/sound.rb