/* * call-seq: * load( filename ) -> sound * * Load the given audio file. * Supported file formats are WAV, AIFF, RIFF, OGG (Ogg Vorbis), and * VOC (SoundBlaster). * * filename:: Full or relative path to the file. (String, required) * * Returns:: The new Sound instance. (Sound) * May raise:: SDLError, if the sound file could not be loaded. * */ static VALUE rg_sound_load( VALUE klass, VALUE filename ) { RG_Sound *sound; VALUE s = rg_sound_alloc( cSound ); Data_Get_Struct( s, RG_Sound, sound ); char *file = StringValuePtr( filename ); int result = _rg_sound_load( sound, file ); if( result == -1 ) { rb_raise(eSDLError, "Could not load Sound file '%s': %s", file, Mix_GetError()); } return s; }