PlanetSquires Forums

Support Forums => General Board => Topic started by: Ivan Iraola on November 27, 2009, 03:06:19 PM

Title: [TUTORIAL] Simple MP3 Player
Post by: Ivan Iraola on November 27, 2009, 03:06:19 PM
** MP3 Player - Tutorial **

  Step by step guide to create a basic MP3 player.

- Requirements:

  - FireFly 3.04.
  - At least (1) MP3 file.
  - A text file containing Path and MP3 name(s) (see instructions in source code).

- Specs:

  - Format         : Project
  - Compiler       : PB9
  - GUI Designer : FireFly 3.04
  - Language     : English

NOTE: The attached file contains a little fix, it adds quotes to the MP3Name$ variable in order to prevent not playing a track when the path or name contains spaces.
Title: Re: [TUTORIAL] Simple MP3 Player
Post by: Haakon Birkeland on November 27, 2009, 05:07:55 PM
Quote
' Setup the values for volume in reverse order (because is vertical)
' the Volume control on the slider should go from 0 to 1000
' 11 values in total, YES, the volume on this player goes to 11!!!
Yes, yess...! 8o)
Title: Re: [TUTORIAL] Simple MP3 Player
Post by: Stephane Fonteyne on November 29, 2009, 08:20:51 PM
Dear developer,

Nice first project. But whynot do you added the source code for your current applications such I can see the GUI interface in you Euphony.exe ?

I would like to learn how FireFly SDK source code works, the controls

Thanks if you can share your source code

Stephane
Title: Re: [TUTORIAL] Simple MP3 Player
Post by: Gary Stout on November 29, 2009, 08:23:14 PM
Flashbacks......OOPs  ;) :D ;D >:( :( :o 8) ??? ::) :-[ :-\ :'(
Title: Re: [TUTORIAL] Simple MP3 Player
Post by: Ivan Iraola on November 29, 2009, 10:02:42 PM
Quote from: Stephane Fonteyne on November 29, 2009, 08:20:51 PM
Dear developer,

Nice first project. But whynot do you added the source code for your current applications such I can see the GUI interface in you Euphony.exe ?

I would like to learn how FireFly SDK source code works, the controls

Thanks if you can share your source code

Stephane

Of course I can share, my question is, what exactly are you looking for?, the code in this tutorial is Euphony's base code, if you need some samples about using controls, I've posted a Code Sampler on This (http://www.planetsquires.com/protect/forum/index.php?topic=2096.0) thread.
Title: Re: [TUTORIAL] Simple MP3 Player
Post by: Barry Marks on November 30, 2009, 11:11:57 PM
I hope if it's okay to ask an MCI question here.  One of the problems I had with the little program I made based on some source I found in the PB forums about a year or two ago was that I didn't really understand how to control the volume, among other things.  I'm using your Firefly sample code to try to figure out how you did it to get my little program working better.  Basically I'm adding a trackbar for volume and I haven't used one before.

It seems like the code I'm using has the maximum volume at 1000.  I'm not sure if that's because it was that way in the code I started with or if it's something I did.  Since the default range of the trackbar is 0 to 100 I thought I'd set the volume the same way.  I think I remember there is a way to do that but I can't seem to find it.

I have the trackbar working okay and I'm using arithmetic to make up the difference in scales so there's no real problem to solve here, except that I think there should be a way to do this without the arithmetic and I'd like to know what it is.

I realize I can change the scale on the trackbar but I already know how to do that (I think) and I want to learn how to change the scale in MCI if that can be done.  Or learn that it can't be done and go from there.

Any suggestions on this will be very much appreciated.

I do realize that this isn't really a Firefly question and I hope that's okay.  If not, somebody please say something and I'll stay on the topic of Firefly more directly from now on.
Title: Re: [TUTORIAL] Simple MP3 Player
Post by: Ivan Iraola on December 01, 2009, 09:25:44 AM
I don't know if I understood you correctly, but let explain something about the volume.

On the example I set the volume like this:

MciSendString "SetAudio " + MP3Name$ + " Volume to " + Volume$, "", 0, 0

Where MP3Name$ is the file to play (e.g MySong.mp3) and Volume$ is the level (e.g. 500)

The range for volume is from 0-1000, so, if you create a Trackbar, you can set the range of it from 0 to 1000 and Small Change = 1 (do this on the FireFly Workspace, under properties of the trackbar in this example)

Once you have that setup, then you just read the value of the trackbar position and set the volume:

tPos& = FF_TrackBar_GetPos(HWND_FORM1_VOLUME) (VOLUME is the name of the trackbar in this example)

MciSendString "SetAudio " + MP3Name$ + " Volume to " + Str$(tPos&), "", 0, 0

That way, you don't have to do any arithmetic, the volume will go from 0 to 1000 and the increment will be 1, but you can change that as well, to 10 or 20 or whatever value you like.

I hope this answer your question.
Title: Re: [TUTORIAL] Simple MP3 Player
Post by: Barry Marks on December 01, 2009, 07:37:20 PM
Yep that answers my question. :)

I had thought there was a way to set the range of numbers that was used to control the volume and I couldn't find it anywhere.  I guess I just remembered wrong.

Thanks,
Barry
Title: Re: [TUTORIAL] Simple MP3 Player
Post by: Stephane Fonteyne on December 02, 2009, 08:17:17 PM
Ivan

I would scaled my trackbar with +10dB(top) 0dB (middele) and -60dB (bottom) on the tracker.

1) How can I do this in FF3 and don't know how, can you give an example in code?

2) How can I get de value on the Trackbar en used then ?

Thanks
Stephane
Title: Re: [TUTORIAL] Simple MP3 Player
Post by: Ivan Iraola on December 02, 2009, 10:30:08 PM
Quote from: Stephane Fonteyne on December 02, 2009, 08:17:17 PM
Ivan

I would scaled my trackbar with +10dB(top) 0dB (middele) and -60dB (bottom) on the tracker.

1) How can I do this in FF3 and don't know how, can you give an example in code?

2) How can I get de value on the Trackbar en used then ?

Thanks
Stephane
I hope this sample helps you.
Title: Re: [TUTORIAL] Simple MP3 Player
Post by: Stephane Fonteyne on December 06, 2009, 06:20:24 AM
Hi Ivan,

Thanks for sharing

Stephane