Class: SFML::SoundBuffer
- Inherits:
-
Object
- Object
- SFML::SoundBuffer
- Defined in:
- lib/sfml/audio.rb
Instance Attribute Summary collapse
-
#buffer ⇒ Object
readonly
Returns the value of attribute buffer.
Class Method Summary collapse
Instance Method Summary collapse
- #get_duration ⇒ Object
-
#initialize(filename) ⇒ SoundBuffer
constructor
A new instance of SoundBuffer.
Constructor Details
#initialize(filename) ⇒ SoundBuffer
Returns a new instance of SoundBuffer.
65 66 67 68 69 |
# File 'lib/sfml/audio.rb', line 65 def initialize(filename) @buffer = SFMLImporter.sfSoundBuffer_createFromFile(filename) raise"Couldn't load #{filename}" if @buffer.null? ObjectSpace.define_finalizer @buffer, SFML::SoundBuffer.dtor end |
Instance Attribute Details
#buffer ⇒ Object (readonly)
Returns the value of attribute buffer.
63 64 65 |
# File 'lib/sfml/audio.rb', line 63 def buffer @buffer end |
Class Method Details
.dtor ⇒ Object
57 58 59 60 61 |
# File 'lib/sfml/audio.rb', line 57 def self.dtor proc { |id| SFMLImporter.sfSoundBuffer_destroy(id) } end |
Instance Method Details
#get_duration ⇒ Object
70 71 72 |
# File 'lib/sfml/audio.rb', line 70 def get_duration SFMLImporter.sfSoundBuffer_getDuration(@buffer) / 1000000.0 end |