Method: Tea::Sound#initialize

Defined in:
lib/tea/c_sound.rb

#initialize(path) ⇒ Sound

Load a sound file.

May raise Tea::Error on failure.



61
62
63
64
65
66
67
68
69
# File 'lib/tea/c_sound.rb', line 61

def initialize(path)
  @wave = SDL::Mixer::Wave.load(path)
  @channel = -1

  # Tracked because Ruby/SDL's mixer API can't get sound volumes.
  @volume = VOLUME_MAX
rescue SDL::Error => e
  raise Tea::Error, e.message, e.backtrace
end