Class: SFML::SoundBuffer
- Inherits:
-
Object
- Object
- SFML::SoundBuffer
- Defined in:
- lib/sfml/audio/sound_buffer.rb
Overview
Instance Attribute Summary collapse
-
#handle ⇒ Object
readonly
:nodoc:.
Class Method Summary collapse
Instance Method Summary collapse
- #channel_count ⇒ Object
- #duration ⇒ Object
- #sample_rate ⇒ Object
-
#save(path) ⇒ Object
Write the buffer out to disk.
Instance Attribute Details
#handle ⇒ Object (readonly)
:nodoc:
30 31 32 |
# File 'lib/sfml/audio/sound_buffer.rb', line 30 def handle @handle end |
Class Method Details
Instance Method Details
#channel_count ⇒ Object
19 |
# File 'lib/sfml/audio/sound_buffer.rb', line 19 def channel_count = C::Audio.sfSoundBuffer_getChannelCount(@handle) |
#duration ⇒ Object
17 |
# File 'lib/sfml/audio/sound_buffer.rb', line 17 def duration = Time.from_native(C::Audio.sfSoundBuffer_getDuration(@handle)) |
#sample_rate ⇒ Object
18 |
# File 'lib/sfml/audio/sound_buffer.rb', line 18 def sample_rate = C::Audio.sfSoundBuffer_getSampleRate(@handle) |
#save(path) ⇒ Object
Write the buffer out to disk. Format is inferred from the file extension (.wav / .ogg / .flac, depends on what CSFML was built with).
24 25 26 27 28 |
# File 'lib/sfml/audio/sound_buffer.rb', line 24 def save(path) ok = C::Audio.sfSoundBuffer_saveToFile(@handle, path.to_s) raise Error, "could not save SoundBuffer to #{path.inspect}" unless ok path end |