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.
15 16 17 18 19 20 21 |
# File 'lib/beeps/sound.rb', line 15 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
23 24 25 26 27 28 |
# File 'lib/beeps/sound.rb', line 23 def play(**, &block) play!.tap do |player| player.set(**) unless .empty? Xot::BlockUtil.instance_eval_or_block_call player, &block if block end end |