Class: SoundPlayer

Inherits:
Object
  • Object
show all
Defined in:
lib/musical_spec/bloops.rb

Instance Method Summary collapse

Constructor Details

#initializeSoundPlayer

Returns a new instance of SoundPlayer.



3
4
5
6
7
8
9
# File 'lib/musical_spec/bloops.rb', line 3

def initialize
  @bloopsaphone = Bloops.new
  @sound = @bloopsaphone.sound(Bloops::SQUARE)
  @sound.sustain = 1

  @note = Note.new
end

Instance Method Details

#startObject



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/musical_spec/bloops.rb', line 11

def start
  200.times do
    @bloopsaphone.clear
    if success?
      @note.next!
    else
      @note.next!
      # @note.prev!
    end

    @bloopsaphone.tune(@sound, @note.note)
    @bloopsaphone.play
    sleep 0.1 #while [email protected]?
  end
end