Class: Metronome::Sound

Inherits:
Object
  • Object
show all
Defined in:
lib/metronome-odd.rb

Instance Method Summary collapse

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

Returns:

  • (Boolean)


14
15
16
# File 'lib/metronome-odd.rb', line 14

def is_sound_file?
  @sound_file.extension == "aiff"
end

#playObject



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