Class: Beeps::Sound
Instance Method Summary collapse
-
#initialize(processor, seconds = 0, nchannels: 1, sample_rate: 0, **options, &block) ⇒ Sound
constructor
A new instance of Sound.
- #play(**options, &block) ⇒ Object
Constructor Details
#initialize(processor, seconds = 0, nchannels: 1, sample_rate: 0, **options, &block) ⇒ Sound
Returns a new instance of Sound.
14 15 16 17 18 19 20 |
# File 'lib/beeps/sound.rb', line 14 def initialize( processor, seconds = 0, nchannels: 1, sample_rate: 0, **, &block) setup processor, seconds, nchannels, sample_rate set(**) unless .empty? Xot::BlockUtil.instance_eval_or_block_call self, &block if block end |
Instance Method Details
#play(**options, &block) ⇒ Object
22 23 24 25 26 27 |
# File 'lib/beeps/sound.rb', line 22 def play(**, &block) play!.tap do |player| player.set(**) unless .empty? Xot::BlockUtil.instance_eval_or_block_call player, &block if block end end |