class SDL2::Mixer::Chunk
The internal format for an audio chunk
* allocated - :int * abuf - :pointer of :uint8 * alen - :uint32 * volume - :uint8 "Per-sample volume, 0-128"
Public Class Methods
load_wav(filepath)
click to toggle source
Load a chunk from a wave file path (string)
# File lib/sdl2/mixer/chunk.rb, line 26 def self.load_wav(filepath) Mixer.load_wav!(filepath) end
playing?()
click to toggle source
Check if anything is playing?
# File lib/sdl2/mixer/chunk.rb, line 44 def self.playing? Mixer::playing?(-1) end
release(pointer)
click to toggle source
Release this structure with Mixer::free_chunk
# File lib/sdl2/mixer/chunk.rb, line 50 def self.release(pointer) Mixer::free_chunk(pointer) end
Public Instance Methods
play(opts = {})
click to toggle source
Plays chunk
opts[:channel]: defaults to -1 opts[:loop]: defaults to 0 opts[:ms]: defaults to -1
# File lib/sdl2/mixer/chunk.rb, line 35 def play(opts = {}) channel = opts[:channel] || -1 loop = opts[:loop] || 0 ms = opts[:ms] || -1 Mixer::play_channel_timed(channel, self, loop, ms) end