Sha256: e15743fbe616609291a9ee20220d55003aa54061e6fbe3fa25dcede79ae9eaa3
Contents?: true
Size: 1.11 KB
Versions: 12
Compression:
Stored size: 1.11 KB
Contents
require 'xot/setter' require 'xot/const_symbol_accessor' 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 const_symbol_reader :state, **{ unknown: STATE_UNKNOWN, playing: PLAYING, paused: PAUSED, stopped: STOPPED } def playing?() state == :playing end def paused?() state == :paused end def stopped?() state == :stopped end universal_accessor :gain, :loop end# SoundPlayer end# Beeps
Version data entries
12 entries across 12 versions & 1 rubygems