The SDL forums have moved to discourse.libsdl.org.
This is just a read-only archive of the previous forums, to keep old links working.


SDL Forum Index
SDL
Simple Directmedia Layer Forums
pause music for SDL2_mixer on android with background
Brian Lavender
Guest

I apoligize if this is a double post. I did not see the original come through.

I am using SDL2_mixer on my SDL2 android game. Problem is that when my user
hits the home button or does something to background my game, the music keeps
playing. The game suspends, but not the music. I realize this may be desired
behavior in certain cases, but not this one.

How can I have SDL pause the music when my Android app is not in the foreground?

Is there some way to register the following instruction when the app
is backgrounded?

Mix_PauseMusic();

brian
--
Brian Lavender
http://www.brie.com/brian/

"There are two ways of constructing a software design. One way is to
make it so simple that there are obviously no deficiencies. And the other
way is to make it so complicated that there are no obvious deficiencies."

Professor C. A. R. Hoare
The 1980 Turing award lecture
_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
LBandy


Joined: 01 Jan 2013
Posts: 38
You just need to catch the events SDL_APP_WILLENTERBACKGROUND and SDL_APP_WILLENTERFOREGROUND and implement the pause and unpause of the music there.
pause music for SDL2_mixer on android with background
Carles Pagès
Guest

I had the same problem and I don't know why I would have sworn those events were only for IOS, so thanks a lot for the hint!



2014-04-12 9:51 GMT+02:00 LBandy:
Quote:
You just need to catch the events SDL_APP_WILLENTERBACKGROUND and SDL_APP_WILLENTERFOREGROUND and implement the pause and unpause of the music there.



Runic Girls - a hexa match3 game with girls created using SDL 2.0:
http://www.facebook.com/RunicGirls

Gameplay trailer:
http://www.youtube.com/watch?v=yMGdfNHGhIU&hd=1


_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

pause music for SDL2_mixer on android with background
Juan Manuel Borges Caño
Guest

Yep, nice info András, Wink.



On Sat, Apr 12, 2014 at 12:03 PM, Carles Pagès wrote:
Quote:
I had the same problem and I don't know why I would have sworn those events were only for IOS, so thanks a lot for the hint!



2014-04-12 9:51 GMT+02:00 LBandy:
Quote:
You just need to catch the events SDL_APP_WILLENTERBACKGROUND and SDL_APP_WILLENTERFOREGROUND and implement the pause and unpause of the music there.



Runic Girls - a hexa match3 game with girls created using SDL 2.0:
http://www.facebook.com/RunicGirls

Gameplay trailer:
http://www.youtube.com/watch?v=yMGdfNHGhIU&hd=1




_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org






_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org