Class: SoundAgent
- Inherits:
-
Agent
- Object
- Agent
- SoundAgent
- Defined in:
- lib/MINT-sdl/sound.rb
Instance Method Summary collapse
-
#initialize ⇒ SoundAgent
constructor
A new instance of SoundAgent.
- #play_click(result) ⇒ Object
- #play_click2(result) ⇒ Object
- #play_plop(result) ⇒ Object
- #play_windup(result) ⇒ Object
Constructor Details
#initialize ⇒ SoundAgent
Returns a new instance of SoundAgent.
5 6 7 8 9 10 11 12 13 |
# File 'lib/MINT-sdl/sound.rb', line 5 def initialize SDL::init(SDL::INIT_AUDIO) SDL::Mixer.open(22050, SDL::Mixer::DEFAULT_FORMAT, 2, 512) @zoom = SDL::Mixer::Wave.load(File.join(File.dirname(__FILE__), "sounds", "click1.wav")) @click2 = SDL::Mixer::Wave.load(File.join(File.dirname(__FILE__), "sounds","click.wav")) @plop = SDL::Mixer::Wave.load(File.join(File.dirname(__FILE__), "sounds","plop.wav")) @windup = SDL::Mixer::Wave.load(File.join(File.dirname(__FILE__), "sounds","windup.wav")) super end |
Instance Method Details
#play_click(result) ⇒ Object
15 16 17 18 |
# File 'lib/MINT-sdl/sound.rb', line 15 def play_click(result) # STDOUT.puts " in play" SDL::Mixer.play_channel(0, @zoom, 0) end |
#play_click2(result) ⇒ Object
20 21 22 23 |
# File 'lib/MINT-sdl/sound.rb', line 20 def play_click2(result) # STDOUT.puts " in play" SDL::Mixer.play_channel(0, @click2, 0) end |
#play_plop(result) ⇒ Object
25 26 27 |
# File 'lib/MINT-sdl/sound.rb', line 25 def play_plop(result) SDL::Mixer.play_channel(0, @plop, 0) end |
#play_windup(result) ⇒ Object
29 30 31 |
# File 'lib/MINT-sdl/sound.rb', line 29 def play_windup(result) SDL::Mixer.play_channel(0, @windup, 0) end |