Class | Rubygame::Mixer::Sample |
In: |
ext/rubygame/rubygame_mixer.c
|
Parent: | Object |
**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 Mixer.play()
**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.
/* call-seq: * load_audio( filename ) -> Sample * * **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. */ VALUE rbgm_sample_new(VALUE class, VALUE filev) { /* This feature will be removed in Rubygame 3.0. */ rg_deprecated("Rubygame::Mixer::Sample", "3.0"); VALUE self; Mix_Chunk* sample; sample = Mix_LoadWAV( StringValuePtr(filev) ); if( sample == NULL ) { rb_raise(eSDLError, "Error loading audio Sample from file `%s': %s", StringValuePtr(filev), Mix_GetError()); } self = Data_Wrap_Struct( cSample, 0, Mix_FreeChunk, sample ); //rb_obj_call_init(self,argc,argv); return self; }