GLBasic forum

Codesnippets => Userlibs [ *.gbal] => Topic started by: trucidare on 2010-Feb-08

Title: [iPhone] GLBMusic
Post by: trucidare on 2010-Feb-08
Hi there,

now the possibility to play musik in your application.

8 Steps to luck:

1. -> Download the lib and gbas from: http://davis.org.au/trucidare/GLBMusic.zip (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)
7. -> edit info.plist
8. -> compile and have fun.

issues:
- Statusbar is not shown - fixed
- on close the MediaPicker flickered for a second - fixed


have fun and let me know whats wrong and which functions are missing

regards
-trucidare

sample code:

Code (glbasic) Select
// --------------------------------- //
// Project: MusicTest
// Start: Monday, February 08, 2010
// IDE Version: 7.250

//SETCURRENTDIR("Media") // seperate media and binaries?

AUTOPAUSE FALSE
LIMITFPS -1

Menu()

WHILE TRUE
SHOWSCREEN
WEND

FUNCTION foo:
ENDFUNCTION

FUNCTION Menu:
pressed = 0
stat = 0
LOADSPRITE "Media/choose.bmp",0
LOADSPRITE "Media/play.bmp",1

WHILE TRUE
DRAWSPRITE 0,50,40
DRAWSPRITE 1,50,90

MOUSESTATE mx,my,b1,b2
IF b1 = 0 THEN pressed = 0

PRINT "Hello World!",0,0
PRINT "isPlaying: "+GLB_MP_isPlaying(),0,10

IF BOXCOLL(50,40,143,39,mx,my,1,1) AND b1 AND pressed = 0
GLB_MP_StartMusicPlayer()
pressed = 1
ENDIF

IF BOXCOLL(50,90,143,39,mx,my,1,1) AND b1 AND pressed = 0
GLB_MP_PlayMusic()
pressed = 1
ENDIF

SHOWSCREEN
WEND
ENDFUNCTION


Title: Re: [iPhone] GLBMusic
Post by: fjsantosb on 2010-Feb-08
I can't believe trucidare!
I coming here to report agon, and you have finish 'play custom music' wrapper.
Really impressive work!

I will test inmmediatly.

King Regards, fjsantos.



Title: Re: [iPhone] GLBMusic
Post by: fjsantosb on 2010-Feb-08
Hi trucidare,
I have a little question about that.
Can i use a lib compiled by a user. Please correct me if i am worng but I think that apple don't let to use this knid of libs.

Can anyone confirm that?

King Regards, fjsantos.
Title: Re: [iPhone] GLBMusic
Post by: trucidare on 2010-Feb-08
The lib is official compiled with apple sdk and static cocoa lib template. i can release sources that can be implemented in xcode projects but isnt the easiest way i think.
but yes you can use it. cocos2d is a user lib too and there are some games in appstore.
Title: Re: [iPhone] GLBMusic
Post by: fjsantosb on 2010-Feb-08
Hi there,

Great then! I am currently testing! I will post feedback as soon i finish test!

King Regards, fjsantos.
Title: Re: [iPhone] GLBMusic
Post by: codegit on 2010-Feb-09
Nice, what else can be said. Once again awesome. Thank you for your contributions of cool libs for the iPhone.  :good:
Title: Re: [iPhone] GLBMusic
Post by: codegit on 2010-Feb-09
I was thinking, maybe the moderators would allow an area on the forum for all the extensions that are being added to the iPhone. Just a thought.  ;) It would be nice if all the iPhone specific stuff was kept in an easy to find area.  8)
Title: Re: [iPhone] GLBMusic
Post by: trucidare on 2010-Feb-09
i Want your Macbook Uni codegit :D
Title: Re: [iPhone] GLBMusic
Post by: fjsantosb on 2010-Feb-09
Hi trucidare,

After all, yesterday i couldn't complete the test of the lib.
I am currently completing the testing now.

King Regards, fjsantos.
Title: Re: [iPhone] GLBMusic
Post by: fjsantosb on 2010-Feb-09
Ok, i have complete the test, and seems to work pretty well!!

Only a few details.
- When open player, not fill all screen (I suppose that on upper side its must show iPhone / iPod state bar?).
- Player can be rotated?
- When close application, player blinds for a second (Must be closed by code before close the application to avoid to blind player?).

That's all for now! (I will continue testing).

Thanks again for sharing your work trucidare!

King Regards, fjsantos.
Title: Re: [iPhone] GLBMusic
Post by: trucidare on 2010-Feb-09
oh not seen the bar thing :D had a silverbackground window. Check this.

you mean the picker? i can check if this available.
ok i check the close function. but i remove the view from superview


thanks for testing
Title: Re: [iPhone] GLBMusic
Post by: fjsantosb on 2010-Feb-09
Hi there,

The status bar will be great to show (to get uniformity).
About rotate thing (i think it's not possible, isn't it).
Close player, will be great too (to avoid bliding).

About the picker, what's the picker?

King Regards, fjsantos.
Title: Re: [iPhone] GLBMusic
Post by: trucidare on 2010-Feb-09
the picker is the list thingy you see if you start the musicplayer. Where you can choose your music.

Title: Re: [iPhone] GLBMusic
Post by: trucidare on 2010-Feb-09
hey updated the archive now. statusbar is now there and the flicker on close is gone.

rotate is not possible until i create a complete new controller. sorry
Title: Re: [iPhone] GLBMusic
Post by: fjsantosb on 2010-Feb-09
Hi Trucidare!

Great!! I will test inmediatelly.
I don't care too much about orientation, cause is a iPhone Component.

I will send you feedback when tested.

Great Work!

King Regards, fjsantos.
Title: Re: [iPhone] GLBMusic
Post by: codegit on 2010-Feb-09
Quote from: trucidare on 2010-Feb-09
i Want your Macbook Uni codegit :D

LOL.... :nana:
Title: Re: [iPhone] GLBMusic
Post by: trucidare on 2010-Feb-09
found that the MPMediaPickerController is only available in portrait mode. So no landscape. sorry
Title: Re: [iPhone] GLBMusic
Post by: fjsantosb on 2010-Feb-09
Hi trucidare,

Seems that all is working pretty well now; the upper bar is here and don't blind on close game, which is great!
Anyway I will continue testing this week (i like to test intensively).
About landscape mode, no problem about that, cause its related to iPod / iPhone interface which is not belong to us.

Great work so far trucidare! And thanks so much for sharing!

King Regards, fjsantos.
Title: Re: [iPhone] GLBMusic
Post by: trucidare on 2010-Feb-09
Hey i made a simple TestProgramm.

Download here, only provisioning change and compile for your phone.

have a look ;)



[attachment deleted by admin]
Title: Re: [iPhone] GLBMusic
Post by: fjsantosb on 2010-Feb-09
I just test your program.
Really great, all works like a charm!!
I think it's perfect now.

Great work!

I will implement in my next release, also i wonder if you will give an opportunity to OpenFeint?

King Regards, fjsantos.
Title: Re: [iPhone] GLBMusic
Post by: trucidare on 2010-Feb-09
how do you mean opportunity to OpenFeint?

Title: Re: [iPhone] GLBMusic
Post by: fjsantosb on 2010-Feb-09
I mean opportunity to OpenFeint (with slowdowns), cause it's seems to be a lot more popular that AGON (i did a few question to some friends, about 20 or 30 and only 2 know of AGON).

King Regards, fjsantos.
Title: Re: [iPhone] GLBMusic
Post by: trucidare on 2010-Feb-09
i could have a look to openfeint again, but i dont know if the slowmo bug can be fixed.
Title: Re: [iPhone] GLBMusic
Post by: fjsantosb on 2010-Feb-09
It's really extrange the slowdown bug.
But its only this bug the problem, or it has some others ones?

King Regards, fjsantos.
Title: Re: [iPhone] GLBMusic
Post by: trucidare on 2010-Feb-09
no its only the slowmo bug.
Title: Re: [iPhone] GLBMusic
Post by: fjsantosb on 2010-Feb-09
Mmmm if it's only this bug, it's almost done.

Maybe we can write to OpenFeint support to help? What do you think about that?

King Regards, fjsantos.
Title: Re: [iPhone] GLBMusic
Post by: trucidare on 2010-Feb-09
i wrote to openfeint dev team but no answer. bug is still there in 2.4.3

i got a ticket from agon dev team. they would show for solution for the crash. if agon works we have a social platform.

i think openfeint doesnt want to support glbasic.
Title: Re: [iPhone] GLBMusic
Post by: fjsantosb on 2010-Feb-09
Hi trucidere,

I will try to write them, maybe they don't be interested in support glbasic, but they may be interested in support GAMES!

King Regards, fjsantos.
Title: Re: [iPhone] GLBMusic
Post by: trucidare on 2010-Feb-09
Try your luck, thanks
Title: Re: [iPhone] GLBMusic
Post by: bigsofty on 2010-Feb-10
Excellent addition to the iPhone, thanks Trucidare!  :good:
Title: Re: [iPhone] GLBMusic
Post by: fjsantosb on 2010-Feb-10
Hi trucidare,

I have write to OpenFeint an email, looking for help to fix the slow down issue.
The reference number is #FTP-58259-189

I hope we have lucky and get any response.

King regards, fjsantos.
Title: Re: [iPhone] GLBMusic
Post by: trucidare on 2010-Feb-10
Hope too
Title: Re: [iPhone] GLBMusic
Post by: Kitty Hello on 2010-Feb-11
\o/
Is there a link where to follow that issue?
Title: Re: [iPhone] GLBMusic
Post by: trucidare on 2010-Feb-11
found some posts with slowdowns but using cocos2d.

http://www.cocos2d-iphone.org/forum/topic/1561 (http://www.cocos2d-iphone.org/forum/topic/1561)
Title: Re: [iPhone] GLBMusic
Post by: fjsantosb on 2010-Feb-12
Hi trucidare,

I get a response from OpenFeint:

"Hi,

Thanks for your patience.  It's a bit difficult for us to diagnose this issue, but I am tempted to ask what you mean by "close".  If you mean just close the dashboard, which I suspect, there are significant things that are still running on behalf of OF including network communications and a bunch of memory to be recovered as UI destructors do their thing.  This could also vary significantly between device hardware and OS.  Do you have any other details that could help us investigate?

-Steve"

Here i need your help to translate the issue to them.

Please, can you give me more info about the issue, so We can write them back?

King Regards, fjsantos.
Title: Re: [iPhone] GLBMusic
Post by: trucidare on 2010-Feb-12
if you close the dashboard the engine will be slower. if you close it a second and a third time the engine will be slower and slower.
i think it isnt the connection thread from of.
Title: Re: [iPhone] GLBMusic
Post by: Kitty Hello on 2010-Feb-12
Reply somthing like:

"Yes, we experience huge slowdowns when we close the dashboard.
Is there anything we can to to stop the background activity or get a notification when this is done?
Our game is totally unplayable after the dashboard was opened and closed again."
Title: Re: [iPhone] GLBMusic
Post by: fjsantosb on 2010-Feb-12
Thanks Gernot, trucidare.

I have just repply to OpenFeint.
Waiting for the response now.

King Regards, fjsantos.
Title: Re: [iPhone] GLBMusic
Post by: Ozden79 on 2010-Apr-10
Hello There,

I've a question regarding the implementation of ITunes music. I can launch the music selection dialog and user can select the available tracks in his device and after the dialog close I want it to start playing right away. As far as I see, this is achieved using another method to start playing, is there anything can be done about this?

Also, after showing the music selection dialog, subsequent calls does not bring it up anymore, is this normal?

Thanks,

Ãâ€"zden
Title: Re: [iPhone] GLBMusic
Post by: michael on 2011-Jul-23
GREAT SUPER COOL
I like this function, thanks a lot
Title: Re: [iPhone] GLBMusic
Post by: quangdx on 2011-Aug-26
I've finally got round to upgrading to GLBasic v10 and when I try to build my app for iPod in xcode,
I get errors telling me there's a problem with the functions not supporting ARM7.
Have I set something wrong in xcode?
Or does the wrapper need updating?
Title: Re: [iPhone] GLBMusic
Post by: Kitty Hello on 2011-Aug-26
you don't get errors. Just warnings. Ignore them.
Title: Re: [iPhone] GLBMusic
Post by: quangdx on 2011-Aug-27
Quote from: Kitty Hello on 2011-Aug-26
you don't get errors. Just warnings. Ignore them.

Must be a settings issue in XCODE, as I've just compiled and run on an iPhone with no problems using my Hackintosh.
But my MacMini gives me warnings and actual errors that stop it from running.
Or do you mean I need to disable something so it ignores those errors.
Title: Re: [iPhone] GLBMusic
Post by: Kitty Hello on 2011-Aug-29
Don't compile for the Simulator, OK?
Title: Re: [iPhone] GLBMusic
Post by: quangdx on 2011-Sep-01
Quote from: Kitty Hello on 2011-Aug-29
Don't compile for the Simulator, OK?
I know GLBasic does not work with the Simulator,
I can compile fine on my Hackintosh but not my MacMini, it must be a settings problem with XCode,
the errors I'm getting are

Code (glbasic) Select

"_GLB_MP_StopMusic", referenced from:
_GLBASIC__::__MainGameSub_() in libPROGRAM.a(gpc_temp0.o)
"_GLB_MP_PlayMusic", referenced from:
_GLBASIC__::__MainGameSub_() in libPROGRAM.a(gpc_temp0.o)
"_GLB_MP_StartMusicMusic", referenced from:
_GLBASIC__::__MainGameSub_() in libPROGRAM.a(gpc_temp0.o)
Symbol(s) not found for architecture armv7
Collect2: Id returned 1 exit status


But any apps that don't use GLBMusic, they compile fine.
So I'll carry on using my Hackintosh to compile any programs I write the GLBMusic.
Title: Re: [iPhone] GLBMusic
Post by: trucidare on 2011-Sep-02
uhm compile for armv6 only - i compiled the lib for armv6 only? why? hmm long time ago.
Title: Re: [iPhone] GLBMusic
Post by: Kitty Hello on 2011-Sep-05
the old compiler is v6 only.
Title: Re: [iPhone] GLBMusic
Post by: michael on 2011-Oct-15
Hi this code does not more work with ios5, it's not more possible to select the songs... iphone hung with this function...  :help: :giveup: