Class: Metro::Audio::Song

Inherits:
Model
  • Object
show all
Defined in:
lib/metro/models/audio/song.rb

Overview

A song represents an audio representation.

Constant Summary

Constants included from Units

Units::Bounds

Instance Attribute Summary

Attributes inherited from Model

#scene, #window

Instance Method Summary collapse

Methods inherited from Model

#_load, #_save, #after_initialize, #bounds, #create, #draw, #draw_completed?, hierarchy, inherited, #initialize, metro_name, #model, model_name, models, #name, #notification, #saveable_to_view, #to_hash, #update, #update_completed?

Methods included from HasEvents

included

Methods included from KeyValueCoding

#get, #set

Methods included from PropertyOwner

included, #properties

Constructor Details

This class inherits a constructor from Metro::Model

Instance Method Details

#pauseObject



26
27
28
# File 'lib/metro/models/audio/song.rb', line 26

def pause
  song.playing? ? song.pause : song.play
end

#playObject



22
23
24
# File 'lib/metro/models/audio/song.rb', line 22

def play
  song.play if not song.playing? and not song.paused?
end

#showObject



13
14
15
16
# File 'lib/metro/models/audio/song.rb', line 13

def show
  song.volume = self.volume
  play if state == "play"
end

#stopObject



18
19
20
# File 'lib/metro/models/audio/song.rb', line 18

def stop
  song.stop
end