iPhone - Play while hear his own music

Previous topic - Next topic

fjsantosb

Hi there,

Many of my customers, are asking if in my next update of 'Noid' they could use his own music while playing.
Actually, i think that is not possible on glbasic. I wonder if anyone has get to managed to do this.

King Regards, fjsantos.
Francisco Santos Belmonte founder of Tip Tap Games.
Website: www.tiptapgames.com
Twitter: www.twitter.com/tiptapgames
Facebook: http://dld.bz/dYVd
iPhone News & Sales: www.gamesappetizer.com

codegit

My customers are asking the same thing. I do not think its possible from GLBASIC alone (please correct me if I am wrong). You will most probably have to try hook into the apple api's from Xcode?  ;/

------------------------------------------
1 X Acer TravelMate 4270, laptop, XP PRO
1 X Dell Studio 17 laptop, Windows 7
1 X MacBook Pro 2,2 GHz Core 2 Duo, 2 GB RAM, 160 GB HDD, 9400M
2 X iTouch
1 X HTC Desire (Android 2.1)
iPad soon to be added

Kitty Hello

There is an API for the iPod library. We have to wait for Trucidare I guess.

Ozden79

Any news about this, I'm looking forward to it as well...

trucidare

MacBook Pro 2,2 GHz Core 2 Duo, 4 GB RAM, 160 GB HDD, 8600M GT
Core i3 - 3,07 GHz, 8 GB Ram, 2.5 TB HDD, Geforce GTX 260+ OC

fjsantosb

Wow, really great!!!

I think that will be a great improvement for GLBasic!

Thanks for share your great work trucidare!

I am a volunteer for beta testing :P.

King Regards, fjsantos.
Francisco Santos Belmonte founder of Tip Tap Games.
Website: www.tiptapgames.com
Twitter: www.twitter.com/tiptapgames
Facebook: http://dld.bz/dYVd
iPhone News & Sales: www.gamesappetizer.com

Mindfield

I'd definitely like to see this happen as well.  It's a popular option among many players who'd rather have their own music than the in-game music provided.  A way to detect whether the user is already playing music on the iPod at game launch would be good so you can give the player the option of continuing to listen to their music or turn it off to listen to in-game music.

Ozden79

Hate to bring this up but this is also something that our customers are asking us a lot... :)

trucidare

Look at userlibs iPhone Musik
MacBook Pro 2,2 GHz Core 2 Duo, 4 GB RAM, 160 GB HDD, 8600M GT
Core i3 - 3,07 GHz, 8 GB Ram, 2.5 TB HDD, Geforce GTX 260+ OC

Ozden79

Damn, how did I miss that, thank you very much once more, much appreciated... =D

michael

is there any sample code for this function with glbasic?

Crivens

Put this in it's own .gbas file attached to your project (mine is GLBMusic.gbas):-
Code (glbasic) Select
// PRoject GLBMusic Wrapper
//
// Wrapper GBAS

//1. -> Download the lib AND gbas from: http://davis.org.au/trucidare/GLBMusic.zip
//2. -> Add GLBMusic.gbas TO your Project
//3. -> Use functions TO add Music support AND compile
//4. -> copy TO mac
//5. -> open xcode project
//6. -> drag AND drop libGLBMusic.a TO frameworks on the left side (dont forget TO add MediaPlayer.framework, thats missing IN the glbasic xcode project, simple right click on frameworks add-> existing frameworks -> choose mediaplayer AND click ok)
//NOTE: It seems Mediaplayer.framework is already there now. No worries...
//7. -> edit info.plist
//8. -> compile AND have fun.


?IFDEF IPHONE
IMPORT "C" void GLB_MP_StartMusicPlayer()
IMPORT "C" void GLB_MP_PlayMusic()
IMPORT "C" void GLB_MP_StopMusic()
IMPORT "C" void GLB_MP_NextTitle()
IMPORT "C" void GLB_MP_PreviousTitle()
IMPORT "C" int GLB_MP_isPlaying()
?ELSE
FUNCTION GLB_MP_StartMusicPlayer:
ENDFUNCTION

FUNCTION GLB_MP_PlayMusic:
IF ISMUSICPLAYING()=0 THEN PLAYMUSIC "Media/music.mp3",TRUE
ENDFUNCTION

FUNCTION GLB_MP_StopMusic:
STOPMUSIC
ENDFUNCTION

FUNCTION GLB_MP_NextTitle:
ENDFUNCTION

FUNCTION GLB_MP_PreviousTitle:
ENDFUNCTION

FUNCTION GLB_MP_isPlaying:
RETURN FALSE
ENDFUNCTION
?ENDIF

FUNCTION GLBMusicDummy:

ENDFUNCTION

Then in your main code use these commands:-
GLB_MP_StartMusicPlayer()     This brings up the iPod music selection screen. You can select as many songs as you like
GLB_MP_PlayMusic()                This plays the music you selected earlier
GLB_MP_StopMusic()               This stops the music

Also when you start the game again, assuming it carries on from where it left off, then do this:-
Code (glbasic) Select

SUB GLB_ON_RESUME: //Happens when gets loaded again
IF musicon=1 THEN GLB_MP_PlayMusic()
ENDSUB
Note musicon is just a variable I use to know I selected music in the first place.

This all seems to work on my iPhone game that is on the app store. It is Rotaslider if you want to see it working (free version availble), just select music option in options menu. Music starts when you go back to main menu.

Cheers
Current fave quote: Cause you like musicians and I like people with boobs.

michael

has anyone try this code with ios 5??? since I have update there is no sound more playing :rant:
any idea ?