Class: Metronome::Sound
- Inherits:
-
Object
- Object
- Metronome::Sound
- Defined in:
- lib/metronome-odd.rb
Instance Method Summary collapse
-
#initialize(sound_file) ⇒ Sound
constructor
A new instance of Sound.
- #is_sound_file? ⇒ Boolean
- #play ⇒ Object
- #set_sound(sound_file) ⇒ Object
Constructor Details
#initialize(sound_file) ⇒ Sound
Returns a new instance of Sound.
9 10 11 12 |
# File 'lib/metronome-odd.rb', line 9 def initialize(sound_file) @sound_file = sound_file self end |
Instance Method Details
#is_sound_file? ⇒ Boolean
14 15 16 |
# File 'lib/metronome-odd.rb', line 14 def is_sound_file? @sound_file.extension == "aiff" end |
#play ⇒ Object
18 19 20 |
# File 'lib/metronome-odd.rb', line 18 def play spawn("afplay #{@sound_file}") end |
#set_sound(sound_file) ⇒ Object
22 23 24 |
# File 'lib/metronome-odd.rb', line 22 def set_sound(sound_file) @sound_file = sound_file end |