GLBasic forum

Feature request => music/sound => Topic started by: Dark Schneider on 2010-Jun-06

Title: Don't stop the user music on devices under demmand
Post by: Dark Schneider on 2010-Jun-06
There should be a way to say GLBasic not to stop the user music when launch the application.

Some games are preferable to have no music, and allow users to use their own in their music library, but currently GLBasic always stops the playing music when start the application.

Then, I think it could be good add something, probably the best location is in project properties, and mark and option for "Allow user custom music".

The main target I can think for this is of course the iPhone, but it can be used too on others devices, and in the future on iPad too.
Title: Re: Don't stop the user music on devices under demmand
Post by: Nobiag on 2010-Jun-20
I'm very interested in this too.
Title: Re: Don't stop the user music on devices under demmand
Post by: Kitty Hello on 2010-Jun-22
Yes. Me too. How to do that? (Trucidare!?)
Title: Re: Don't stop the user music on devices under demmand
Post by: Slydog on 2010-Jun-22
Here's a good resource for music playback:
http://developer.apple.com/iphone/library/documentation/mediaplayer/reference/MPMusicPlayerController_ClassReference/Reference/Reference.html (http://developer.apple.com/iphone/library/documentation/mediaplayer/reference/MPMusicPlayerController_ClassReference/Reference/Reference.html)


Quote
You use an MPMusicPlayerController object, or music player, to play media items from the iPod library. There are two types of music player:

  • The application music player plays music locally within your application. It is not aware of the iPod app's now-playing item, nor does it affect the iPod state.
  • The iPod music player employs the built-in iPod application on your behalf. On instantiation, it takes on the current iPod application state, such as the identification of the now-playing item. If a user quits your application while music is playing, that music continues to play. The iPod application then has your music player's most recently-set repeat mode, shuffle mode, playback state, and now-playing item.
Title: Re: Don't stop the user music on devices under demmand
Post by: Kitty Hello on 2010-Jun-22
ok, I think I will make it, that if the iPod is on, the PLAYMUSIC commands will be ignored and iPod is played. Is that OK?
Title: Re: Don't stop the user music on devices under demmand
Post by: Slydog on 2010-Jun-22
So, if a song is being played when the game starts, it will keep playing.
And no way to start playing your own custom game music in that case.
(but sound effects would still work?)

That's not a bad option, if the user wants to listen to his/her own music, just start playing it before your game starts.
Otherwise you can play your own music.

When their song ends, the music is over?
It'd be cool to auto set their repeat mode (repeatMode) (default to MPMusicRepeatModeAll?) so the music never ends.
(but is this global?  you may have to set it back when exiting)

How hard is it to allow them to choose songs from their own library while in your game!?  That would be neat.  Does Apple even expose that? 

(Same as photos too I guess.  Having custom photos in your game would add a personal touch.  (A family portrait in a hallway, billboards, etc).  (With the user's permission of course!))

[Edit]
To initialize the playback queue to contain every song in the library, use this:  (Objective C I assume?)
// assign a playback queue containing all media items on the device
[myPlayer setQueueWithQuery: [MPMediaQuery songsQuery]];

from the page:
http://www.iphonedevsdk.com/forum/iphone-sdk-development/22636-mpmediaquery-hanging.html

We could then give them next / previous buttons in our app and call 'skipToNextItem' and 'skipToPreviousItem'.
But with inline code, how do you insert Objective C? or translate it!?
Title: Re: Don't stop the user music on devices under demmand
Post by: Kitty Hello on 2010-Jun-23
If you want that many options, try:
http://www.glbasic.com/forum/index.php?topic=4169.0 (http://www.glbasic.com/forum/index.php?topic=4169.0)
Title: Re: Don't stop the user music on devices under demmand
Post by: Dark Schneider on 2010-Jun-23
Quote from: Kitty Hello on 2010-Jun-22
ok, I think I will make it, that if the iPod is on, the PLAYMUSIC commands will be ignored and iPod is played. Is that OK?

I think that is perfect, no need for more complex things because if users are playing a music from their library it is clear that is because they want that music and not the game one.

Note that the iPod music is stopped when there is no PLAYMUSIC in the code, so the current GLBasic music engine initialization stops the device music.
Title: Re: Don't stop the user music on devices under demmand
Post by: Slydog on 2010-Jun-23
Wow, that's convenient!  Thanks.
Scratch that off my 'To Do' list!

Quote from: Kitty Hello on 2010-Jun-23
If you want that many options, try:
http://www.glbasic.com/forum/index.php?topic=4169.0 (http://www.glbasic.com/forum/index.php?topic=4169.0)
Title: Re: Don't stop the user music on devices under demmand
Post by: Wampus on 2010-Jun-28
Quote from: Kitty Hello on 2010-Jun-22
ok, I think I will make it, that if the iPod is on, the PLAYMUSIC commands will be ignored and iPod is played. Is that OK?
Yes! This would be great.
Title: Re: Don't stop the user music on devices under demmand
Post by: quangdx on 2010-Dec-13
wondering if this ever got implemented?

if the iPod music is playing when the app starts,
it just leaves it playing and playmusic commands are ignored.
Title: Re: Don't stop the user music on devices under demmand
Post by: Dark Schneider on 2011-Mar-31
Hi, could be this change included in the new version, currently in beta?.
Title: Re: Don't stop the user music on devices under demmand
Post by: Falstaff on 2011-Nov-02
*bump*

I've been noticing this behvaiour as well. Any way we can get it resolved?