Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MP3 2

Status
Not open for further replies.

fergmj

Programmer
Feb 21, 2001
276
US
I am looking for a way to play an MP3 file in Borland C++ Builder 5.0. I know how to play wav files (through the TMedia component) but how about MP3 files?

Thanks

fergmj
 
What do you think about using COM? John Fill
1c.bmp


ivfmd@mail.md
 
There is excellent FREE software at dbpoweramp.com that can play and convert all sorts of audiocompressions. The author was also so friendly to make an interface to his program with scripting and he even explains how to use this scripting in Builder. Even more, if you put a question on his forum he gives very good and fast answers.
This software is really a must and it is completely free, no shareware, nothing to pay.

Wim Vanherp
Wim.Vanherp@myself.com
 
Wim -

I have used dbPowerAmp for many things and I agree it is wonderful. However I am looking for something that will allow me to write an MP3Player.

fergmj
 
John -

i don't know that much about COM. How could I use it to play MP3?

fergmj
 
hey, i just stuck the MP3 in my mediaplayer, and told it to play. and it's worked fine every time. Cyprus
 
fergmj,
using COM, you can use avery COM objects what offer interfaces to do what do you want. For example you may use WinAmp's COM interfaces to play your MP3. John Fill
1c.bmp


ivfmd@mail.md
 
Cyprus106 -

What media Player are you referring to? One you wrote?

fergmj
 
Windows Media Player has a nice IDispatch with every would you like to do. John Fill
1c.bmp


ivfmd@mail.md
 
what i did was simple...i made the filename (yoursongnamehere).mp3, and it played just fine. i was kinda surprised, but it worked. just the windows media player. now i cant get the file 2 change very easily. but that happens with alot of sound files Cyprus
 
Cyprus -

Can you post your sample code?

Thanks

fergmj
 
you need 3 Labels, an OpenDialog, and a MediaPlayer with the Device Type set to AutoSelect. I have made a whole MP3 Player with a playlist and a CD Player with this code. I made it stripped down with the simplest code possible, so its pretty easy to understand. If you want it e-mail me and Ill send it to you. gooutandshootthedog@hotmail.com

int TheLength;
if (OpenDialog1->Execute())
{
if (OpenDialog1->FileName!=NULL)
{
MediaPlayer1->FileName=OpenDialog1->FileName.c_str();
MediaPlayer1->Open();
MediaPlayer1->Play();
MediaPlayer1->TimeFormat=tfHMS;
TheLength = MediaPlayer1->Position;
Label1->Caption = IntToStr(LOBYTE(HIWORD(TheLength))) + ":" + IntToStr(HIBYTE(LOWORD(TheLength)));
TheLength =MediaPlayer1->Length;
Label2->Caption = IntToStr(LOBYTE(HIWORD(TheLength))) + ":" + IntToStr(HIBYTE(LOWORD(TheLength)));
Label3->Caption = MediaPlayer1->FileName.c_str();
}
}


Cyprus Cyprus
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top