Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit/AppGameKit Studio Showcase / MP3 Player -- [Code Example]

Conjured Entertainment
AGK Developer
Years of Service
User Offline
Joined: 12th Sep 2005
Location: Nirvana
Posted: 26th Sep 2017 18:46 Edited at: 26th Sep 2017 20:31

I was having trouble loading my OGG files, only to realize that the LoadMusic() command needs to be LoadMusicOGG() instead.
I was thinking that the LoadMusic() would handle MP3s and OGGs.
So, when the OGGs weren't working, I opted for using MP3s which I have always avoided in the past due to the licensing issues they had.

Anyway, I was working on new game that I wanted to give the user control of a play list of songs, and decided to extract that code for use as an example.
So, here is is, but I will be changing this to handle OGGs now that I have realized the proper way to load those in AGK.

Unfortunately though, the LoadMusic() let me loop a list of music IDs and the LoadMusicOGG() will not.
So, this code example will need a major modification to get it to work the same way with the OGGs.
But, I thought that this made be helpful to anyone who is planning on using MP3 files in their projects.
I am sure this is not the cleanest code for an MP3 Player, but at <160 lines it doesn't seem that bad to me.

Anyway, see the attached ZIP, and I hope it helps give some idea...

Having trouble uploading from this WiFi, so the Zip will be up later when I get it sorted out.
oh well, maybe the ZIP is too large for the forums here (59mb??)
I forget what the limit is, but the app itself is only 6mb, but I included 7 mp3's which made the zip bigger.

i'll try breaking the zip up and see if that it was it is, but you guys will need to put the mp3s back in the media/music folder before trying to run it
so extract each song and place all 7 of them in the music folder (sorry about the file size limit on the zips)
the ZIP extraction will create a folder for each song, but do not put that in the music folder, just the mp3 itself

Coding things my way since 1981 -- Currently using AppGameKit V2 Tier 1


Login to view attachments

Login to post a reply

Server time is: 2019-11-14 19:09:33
Your offset time is: 2019-11-14 19:09:33