Method: Gosu::Sample#initialize
- Defined in:
- lib/gosu_android/audio/audio.rb
#initialize(window, filename) ⇒ Sample
Constructs a sample that can be played on the specified audio system and loads the sample from a file.
57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/gosu_android/audio/audio.rb', line 57 def initialize(window, filename) @window = window if not defined? @@pool @@pool = JavaImports::SoundPool.new(MAX_SAMPLES, JavaImports::AudioManager::STREAM_MUSIC, 0) end if(filename.class == Fixnum ) @id = @@pool.load( @window.activity.getApplicationContext, filename, 1 ) else @id = @@pool.load(filename, 1) end #Set finalize ObjectSpace.define_finalizer(self, self.class.finalize(@id)) end |