/* * call-seq: * fade_out( fade_time ) -> self * * Fade out to silence over the given number of seconds. Once the sound * is silent, it is automatically stopped. * * Returns:: The receiver (self). * * **NOTE**: If the sound is currently paused, the fade will start, * but you won't be able to hear it happening unless you #unpause during * the fade. Does nothing if the sound is currently stopped. * */ static VALUE rg_sound_fadeout( VALUE self, VALUE fade_time ) { RG_Sound *sound; Data_Get_Struct(self, RG_Sound, sound); int channel = sound->channel; int fade_ms = (int)(1000 * NUM2DBL(fade_time)); /* Make sure the sound actually belongs to the channel */ if( _rg_sound_channel_check(sound) ) { Mix_FadeOutChannel( channel, fade_ms ); } return self; }