Class: MovieMaker::Action::PlaySound

Inherits:
SimpleAction show all
Defined in:
lib/movie_maker/action.rb

Overview

Plays a sound

Instance Attribute Summary collapse

Attributes inherited from SimpleAction

#start_at, #stop_at

Instance Method Summary collapse

Methods inherited from SimpleAction

#finalized?, #started?

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(options = {}, sound = nil)			
	super(options)
	@sound = sound || options[:object]
	@volume = options[:volume] || 1.0
	@repeats = options[:repeats] || 1
	@fade_in = options[:fade_in] || nil
	@stop_after = @duration				
	
	@sound.volume = @volume	if @sound.respond_to? :volume
end

Instance Attribute Details

#playingObject (readonly)

Returns the value of attribute playing.



361
362
363
# File 'lib/movie_maker/action.rb', line 361

def playing
  @playing
end

Instance Method Details

#finalizeObject



377
378
379
380
# File 'lib/movie_maker/action.rb', line 377

def finalize
	@sound.play
	@finalized = true
end

#playing?(current_time) ⇒ Boolean

Returns:

  • (Boolean)


373
374
375
# File 'lib/movie_maker/action.rb', line 373

def playing?(current_time)
	@playing
end

#stopObject



382
383
384
# File 'lib/movie_maker/action.rb', line 382

def stop
	@sound.stop
end