Pause music for SDL2_mixer on android with background

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

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:

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 :> 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
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Yep, nice info Andr?s, ;-).On Sat, Apr 12, 2014 at 12:03 PM, Carles Pag?s <page.lists at gmail.com> wrote:

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 :

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
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org