I wish to do a program in c++ that enables me to play music as part of my school project.
I want to know if is this is possible.
I also wish to know if photos and other media can be similarly accessed and where i can get information on how to do the above.

Recommended Answers

All 6 Replies

standalone i dont think c++ can play anythings other than pc-speaker sounds, so if you plan to play actual music (mp3 etc) you'd need to look into fmod, bass audio lib, alegro (or whatever they call it) and so on.

If you wish to play music there are 2 ways possible:
Windows PlaySound() : Works only for .wav
MMSYSTEM mciSendString(): Works for midi & mp3

Photo's can also be read just like normal file's & barring their header information I don't see what you can make of it, since you cannot display them like an Image Viewer inside your program until & unless it's an Windows form app.

windows form app? :s
What exactly does that mean?

And the what is the syntax for the above mentioned functions?
How should the file location be specified?

If you'd like to restrict yourself purely to windows here's a few things you can look into: Win32api, MFC (Microsoft Foundation Class), ATL(Active Template Library), WTL (Windows Template Library).

each and every one should give you access to image processing and some form of sound/music handling.

PlaySound
mciSendString

PlaySound("Blinds.wav",NULL, SND_FILENAME|SND_ASYNC);
mciSendString("play Blinds.mp3",NULL,0,NULL);

HI SHIJO
You can always do that. For that you need to installed latest windows SDK and you will find Microsoft DirectX - DirectShow library in the Multimedia folder. This library provides a set of C++ APIs to handle multimedia streams.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.