/*
* call-seq:
* fading?( direction=:either ) -> true or false
*
* True if the Music is currently fading in or out.
* See also #play and #fade_out.
*
* direction:: Check if it is fading :in, :out, or :either.
* (Symbol, required)
*
*/
static VALUE rg_music_fadingp( int argc, VALUE *argv, VALUE self )
{
RG_Music *music;
Data_Get_Struct(self, RG_Music, music);
VALUE vdirection;
rb_scan_args(argc, argv, "01", &vdirection);
/* If the music is not current, return false right away. */
if( !(_rg_music_current_check(self)) )
{
return Qfalse;
}
if( RTEST(vdirection) )
{
if( make_symbol("in") == vdirection )
{
return ( (Mix_FadingMusic() == MIX_FADING_IN) ? Qtrue : Qfalse );
}
else if( make_symbol("out") == vdirection )
{
return ( (Mix_FadingMusic() == MIX_FADING_OUT) ? Qtrue : Qfalse );
}
else if( make_symbol("either") == vdirection )
{
return ( (Mix_FadingMusic() != MIX_NO_FADING) ? Qtrue : Qfalse );
}
}
/* default */
return ( (Mix_FadingMusic() != MIX_NO_FADING) ? Qtrue : Qfalse );
}