From 000247d02c5bc0c202129c511b0a986138e662ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Minisini?= Date: Mon, 27 Jan 2014 18:46:09 +0000 Subject: [PATCH] [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 --- gb.sdl.sound/src/sound.c | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/gb.sdl.sound/src/sound.c b/gb.sdl.sound/src/sound.c index b2c375a73..0d489478a 100644 --- a/gb.sdl.sound/src/sound.c +++ b/gb.sdl.sound/src/sound.c @@ -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 };