Class: MovieMaker::Action::PlaySound
- Inherits:
-
SimpleAction
- Object
- SimpleAction
- MovieMaker::Action::PlaySound
- Defined in:
- lib/movie_maker/action.rb
Overview
Plays a sound
Instance Attribute Summary collapse
-
#playing ⇒ Object
readonly
Returns the value of attribute playing.
Attributes inherited from SimpleAction
Instance Method Summary collapse
- #finalize ⇒ Object
-
#initialize(options = {}, sound = nil) ⇒ PlaySound
constructor
A new instance of PlaySound.
- #playing?(current_time) ⇒ Boolean
- #stop ⇒ Object
Methods inherited from SimpleAction
Constructor Details
#initialize(options = {}, sound = nil) ⇒ PlaySound
Returns a new instance of PlaySound.
362 363 364 365 366 367 368 369 370 371 |
# File 'lib/movie_maker/action.rb', line 362 def initialize( = {}, sound = nil) super() @sound = sound || [:object] @volume = [:volume] || 1.0 @repeats = [:repeats] || 1 @fade_in = [:fade_in] || nil @stop_after = @duration @sound.volume = @volume if @sound.respond_to? :volume end |
Instance Attribute Details
#playing ⇒ Object (readonly)
Returns the value of attribute playing.
361 362 363 |
# File 'lib/movie_maker/action.rb', line 361 def @playing end |
Instance Method Details
#finalize ⇒ Object
377 378 379 380 |
# File 'lib/movie_maker/action.rb', line 377 def finalize @sound.play @finalized = true end |
#playing?(current_time) ⇒ Boolean
373 374 375 |
# File 'lib/movie_maker/action.rb', line 373 def (current_time) @playing end |
#stop ⇒ Object
382 383 384 |
# File 'lib/movie_maker/action.rb', line 382 def stop @sound.stop end |