Class: Rubygame::Mixer::Sample
- Inherits:
-
Object
- Object
- Rubygame::Mixer::Sample
- Defined in:
- lib/rubygame/deprecated_mixer.rb
Overview
NOTE: This class is DEPRECATED and will be removed in Rubygame 3.0.
Please use the Rubygame::Sound class instead.
Stores audio data to play with Rubygame::Mixer.play
Class Method Summary collapse
-
.load_audio(filename) ⇒ Object
NOTE: Rubygame::Mixer::Sample is DEPRECATED and will be removed in Rubygame 3.0.
Instance Method Summary collapse
-
#initialize(struct = nil) ⇒ Sample
constructor
call-seq: new.
Constructor Details
#initialize(struct = nil) ⇒ Sample
call-seq: new
277 278 279 |
# File 'lib/rubygame/deprecated_mixer.rb', line 277 def initialize( struct=nil ) @struct = struct end |
Class Method Details
.load_audio(filename) ⇒ Object
NOTE: Rubygame::Mixer::Sample is DEPRECATED and will be removed in
Rubygame 3.0. Please use the Rubygame::Sound class instead.
Load an audio sample (a "chunk", to use SDL_mixer's term) from a file.
Only WAV files are supported at this time.
Raises SDLError if the sample could not be loaded.
257 258 259 260 261 262 263 264 265 266 267 268 269 |
# File 'lib/rubygame/deprecated_mixer.rb', line 257 def self.load_audio( filename ) Rubygame.deprecated( "Rubygame::Mixer::Sample", "3.0" ) chunk = SDL::Mixer.LoadWAV( filename ) if( chunk.pointer.null? ) raise( Rubygame::SDLError, "Error loading audio Sample from file `%s': %s"% [filename, SDL.GetError()] ) end return new( chunk ) end |