Author Topic: iPhone - Play while hear his own music  (Read 2972 times)

Offline fjsantosb

  • Dr. Type
  • ****
  • Posts: 258
    • View Profile
    • Tip Tap Games - iPhone, iPad and iPod Touch Games
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

Offline codegit

  • Dr. Type
  • ****
  • Posts: 270
    • View Profile
Re: iPhone - Play while hear his own music
« Reply #1 on: 2009-Dec-16 »
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

Offline Kitty Hello

  • code monkey
  • Administrator
  • Prof. Inline
  • *******
  • Posts: 10656
  • here on my island the sea says 'hello'
    • View Profile
    • http://www.glbasic.com
Re: iPhone - Play while hear his own music
« Reply #2 on: 2009-Dec-16 »
There is an API for the iPod library. We have to wait for Trucidare I guess.

Offline Ozden79

  • Mr. Polyvector
  • ***
  • Posts: 121
    • View Profile
Re: iPhone - Play while hear his own music
« Reply #3 on: 2010-Feb-06 »
Any news about this, I'm looking forward to it as well...

Offline trucidare

  • Administrator
  • Prof. Inline
  • *******
  • Posts: 1377
  • Bachelor of Fail
    • View Profile
Re: iPhone - Play while hear his own music
« Reply #4 on: 2010-Feb-06 »
On Todo right after AGON.
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

Offline fjsantosb

  • Dr. Type
  • ****
  • Posts: 258
    • View Profile
    • Tip Tap Games - iPhone, iPad and iPod Touch Games
Re: iPhone - Play while hear his own music
« Reply #5 on: 2010-Feb-06 »
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

  • Guest
Re: iPhone - Play while hear his own music
« Reply #6 on: 2010-Feb-07 »
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.

Offline Ozden79

  • Mr. Polyvector
  • ***
  • Posts: 121
    • View Profile
Re: iPhone - Play while hear his own music
« Reply #7 on: 2010-Apr-07 »
Hate to bring this up but this is also something that our customers are asking us a lot... :)

Offline trucidare

  • Administrator
  • Prof. Inline
  • *******
  • Posts: 1377
  • Bachelor of Fail
    • View Profile
Re: iPhone - Play while hear his own music
« Reply #8 on: 2010-Apr-07 »
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

Offline Ozden79

  • Mr. Polyvector
  • ***
  • Posts: 121
    • View Profile
Re: iPhone - Play while hear his own music
« Reply #9 on: 2010-Apr-07 »
Damn, how did I miss that, thank you very much once more, much appreciated... =D

Offline michael

  • Mc. Print
  • *
  • Posts: 25
    • View Profile
Re: iPhone - Play while hear his own music
« Reply #10 on: 2011-Jul-22 »
is there any sample code for this function with glbasic?

Offline Crivens

  • Prof. Inline
  • *****
  • Posts: 913
    • View Profile
Re: iPhone - Play while hear his own music
« Reply #11 on: 2011-Jul-22 »
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.

Offline michael

  • Mc. Print
  • *
  • Posts: 25
    • View Profile
Re: iPhone - Play while hear his own music
« Reply #12 on: 2011-Oct-14 »
has anyone try this code with ios 5??? since I have update there is no sound more playing :rant:
any idea ?