954,483 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Music in c++

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.

Shijo Jose
Newbie Poster
5 posts since Sep 2010
Reputation Points: 10
Solved Threads: 0
 

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.

usagi
Newbie Poster
14 posts since Sep 2010
Reputation Points: 10
Solved Threads: 0
 

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.

nbaztec
Posting Pro in Training
475 posts since May 2010
Reputation Points: 57
Solved Threads: 60
 

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?

Shijo Jose
Newbie Poster
5 posts since Sep 2010
Reputation Points: 10
Solved Threads: 0
 

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.

usagi
Newbie Poster
14 posts since Sep 2010
Reputation Points: 10
Solved Threads: 0
 

PlaySound
mciSendString

PlaySound("Blinds.wav",NULL, SND_FILENAME|SND_ASYNC);
mciSendString("play Blinds.mp3",NULL,0,NULL);
nbaztec
Posting Pro in Training
475 posts since May 2010
Reputation Points: 57
Solved Threads: 60
 

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.

sachin.tendul
Newbie Poster
1 post since Oct 2010
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: