[GB.SDL.SOUND]

* NEW: Music.State is a new property that returns the music state as one of
  the following constant: Music.Stopped, Music.Playing or Music.Paused.


git-svn-id: svn://localhost/gambas/trunk@6108 867c0c6c-44f3-4631-809d-bfa615b0a4ec
This commit is contained in:
Benoît Minisini 2014-01-27 18:46:09 +00:00
parent d1aeb73fde
commit 000247d02c

View File

@ -499,7 +499,7 @@ BEGIN_METHOD(CMUSIC_play, GB_INTEGER loops; GB_FLOAT fadein)
/*Mix_HookMusicFinished(musicDone);*/
//The 'Looping' param should be optional in gambas, default=0. Don't know how?
//BM Now do you now ? ;-)
//BM Now do you know ? ;-)
fadevalue = VARGOPT(fadein, 0) * 1000;
// if fadevalue is too small -> music doesn't want to play !
@ -564,6 +564,20 @@ BEGIN_PROPERTY(CMUSIC_volume)
END_PROPERTY
BEGIN_PROPERTY(Music_State)
if (Mix_PlayingMusic())
{
if (Mix_PausedMusic())
GB.ReturnInteger(2);
else
GB.ReturnInteger(1);
}
else
GB.ReturnInteger(0);
END_PROPERTY
GB_DESC CMusicDesc[] =
{
GB_DECLARE("Music", 0),
@ -579,5 +593,11 @@ GB_DESC CMusicDesc[] =
GB_STATIC_PROPERTY("Volume", "f", CMUSIC_volume),
GB_STATIC_PROPERTY("Pos", "f", CMUSIC_pos),
GB_STATIC_PROPERTY_READ("State", "i", Music_State),
GB_CONSTANT("Stopped", "i", 0),
GB_CONSTANT("Playing", "i", 1),
GB_CONSTANT("Paused", "i", 2),
GB_END_DECLARE
};