class SFML::Sound
Attributes
sound[R]
Public Class Methods
dtor()
click to toggle source
# File lib/sfml/audio.rb, line 77 def self.dtor proc { |id| SFMLImporter.sfSound_stop(id) SFMLImporter.sfSound_destroy(id) } end
new(buffer=nil)
click to toggle source
# File lib/sfml/audio.rb, line 86 def initialize(buffer=nil) @sound = SFMLImporter.sfSound_create() raise "Failed create SFML::Sound" if @sound.null? @buffer = buffer if buffer SFMLImporter.sfSound_setBuffer(@sound, buffer.buffer) end ObjectSpace.define_finalizer @sound, SFML::Sound.dtor end
Public Instance Methods
get_buffer()
click to toggle source
# File lib/sfml/audio.rb, line 103 def get_buffer @buffer end
get_loop()
click to toggle source
# File lib/sfml/audio.rb, line 128 def get_loop SFMLImporter.sfSound_getLoop(@sound) > 0 end
get_pitch()
click to toggle source
# File lib/sfml/audio.rb, line 134 def get_pitch SFMLImporter.sfSound_getPitch(@sound) end
get_playing_offset()
click to toggle source
# File lib/sfml/audio.rb, line 146 def get_playing_offset SFMLImporter.sfSound_getPlayingOffset(@sound) / 1000000.0 end
get_status()
click to toggle source
# File lib/sfml/audio.rb, line 115 def get_status case SFMLImporter.sfSound_getStatus(@sound) when SFMLImporter::SFSTOPPED :stopped when SFMLImporter::SFPAUSED :paused when SFMLImporter::SFPLAYING :playing end end
get_volume()
click to toggle source
# File lib/sfml/audio.rb, line 140 def get_volume SFMLImporter.sfSound_getVolume(@sound) end
initialize_copy(obj)
click to toggle source
# File lib/sfml/audio.rb, line 95 def initialize_copy(obj) @sound = SFMLImporter.sfSound_copy(obj.sound) @buffer = obj.buffer end
pause()
click to toggle source
# File lib/sfml/audio.rb, line 109 def pause SFMLImporter.sfSound_pause(@sound) end
play()
click to toggle source
# File lib/sfml/audio.rb, line 106 def play SFMLImporter.sfSound_play(@sound) end
set_buffer(buffer)
click to toggle source
# File lib/sfml/audio.rb, line 99 def set_buffer(buffer) @buffer = buffer SFMLImporter.sfSound_setBuffer(@sound, buffer.buffer) end
set_loop(b)
click to toggle source
# File lib/sfml/audio.rb, line 125 def set_loop(b) SFMLImporter.sfSound_setLoop(@sound, (b ? 1 : 0)) end
set_pitch(f)
click to toggle source
# File lib/sfml/audio.rb, line 131 def set_pitch(f) SFMLImporter.sfSound_setPitch(@sound, f) end
set_playing_offset(time)
click to toggle source
# File lib/sfml/audio.rb, line 143 def set_playing_offset(time) SFMLImporter.sfSound_setPlayingOffset(@sound, time * 1000000.0) end
set_volume(f)
click to toggle source
# File lib/sfml/audio.rb, line 137 def set_volume(f) SFMLImporter.sfSound_setVolume(@sound, f) end
stop()
click to toggle source
# File lib/sfml/audio.rb, line 112 def stop SFMLImporter.sfSound_stop(@sound) end