How do you include sound files in C++?

Please support our C++ advertiser: Intel Parallel Studio Home
Reply

Join Date: Sep 2007
Posts: 11
Reputation: eeneilson is an unknown quantity at this point 
Solved Threads: 0
eeneilson eeneilson is offline Offline
Newbie Poster

How do you include sound files in C++?

 
0
  #1
Sep 27th, 2007
How do you incorperate sound files into a C++ program?
Reply With Quote Quick reply to this message  
Join Date: Sep 2007
Posts: 11
Reputation: eeneilson is an unknown quantity at this point 
Solved Threads: 0
eeneilson eeneilson is offline Offline
Newbie Poster

Re: How do you include sound files in C++?

 
0
  #2
Sep 27th, 2007
I dont know if it matters or not but im using microsoft visual studio 2005 for my compiler and my OS is Windows Xp home
Reply With Quote Quick reply to this message  
Join Date: Sep 2007
Posts: 11
Reputation: eeneilson is an unknown quantity at this point 
Solved Threads: 0
eeneilson eeneilson is offline Offline
Newbie Poster

Re: How do you include sound files in C++?

 
0
  #3
Sep 27th, 2007
Anyone?
Reply With Quote Quick reply to this message  
Join Date: Apr 2004
Posts: 759
Reputation: Killer_Typo will become famous soon enough Killer_Typo will become famous soon enough 
Solved Threads: 35
Killer_Typo's Avatar
Killer_Typo Killer_Typo is offline Offline
Master Poster

Re: How do you include sound files in C++?

 
0
  #4
Sep 27th, 2007
It can be tricky, there is a playSound function in C++ but it's not all that powerful so you may be best suited to look for a library to do that, or feel free to get your hands dirty with some DirectX.



http://msdn2.microsoft.com/en-us/library/ms712879.aspx
Dont forget to spread the reputation to those that deserve!
Reply With Quote Quick reply to this message  
Join Date: Jun 2007
Posts: 2,462
Reputation: zandiago is on a distinguished road 
Solved Threads: 25
Featured Poster
zandiago's Avatar
zandiago zandiago is offline Offline
Nearly a Posting Maven

Re: How do you include sound files in C++?

 
0
  #5
Sep 27th, 2007
I've always thought about this too....but if you need different colour text..i think you could use "
#define yl system("color 0e");".
Reply With Quote Quick reply to this message  
Join Date: Jun 2007
Posts: 2,462
Reputation: zandiago is on a distinguished road 
Solved Threads: 25
Featured Poster
zandiago's Avatar
zandiago zandiago is offline Offline
Nearly a Posting Maven

Re: How do you include sound files in C++?

 
0
  #6
Sep 27th, 2007
Reply With Quote Quick reply to this message  
Join Date: Sep 2007
Posts: 11
Reputation: eeneilson is an unknown quantity at this point 
Solved Threads: 0
eeneilson eeneilson is offline Offline
Newbie Poster

Re: How do you include sound files in C++?

 
0
  #7
Sep 27th, 2007
Originally Posted by Killer_Typo View Post
It can be tricky, there is a playSound function in C++ but it's not all that powerful so you may be best suited to look for a library to do that, or feel free to get your hands dirty with some DirectX.



http://msdn2.microsoft.com/en-us/library/ms712879.aspx
Ok the site you gave me had this code one it.
BOOL PlaySound(
LPCSTR pszSound,
HMODULE hmod,
DWORD fdwSound
);

but I dont see where I insert the name of my sound file.
Reply With Quote Quick reply to this message  
Join Date: Sep 2007
Posts: 11
Reputation: eeneilson is an unknown quantity at this point 
Solved Threads: 0
eeneilson eeneilson is offline Offline
Newbie Poster

Re: How do you include sound files in C++?

 
0
  #8
Sep 27th, 2007
Originally Posted by zandiago View Post
I've always thought about this too....but if you need different colour text..i think you could use "
#define yl system("color 0e");".
um ok you lost me here why would I have to change the text color to add a sound file? Although I would like to know how to change the text color also with this code do I just change ("color 0e ") to the color I want?

If so does C++ have built in colors that can be defined just by their name like in HTML or is there another method for defining colors? Hexidecimal codes or something.

In case you guys cant tell I'm fairly new to C++ .
Last edited by eeneilson; Sep 27th, 2007 at 9:41 pm.
Reply With Quote Quick reply to this message  
Join Date: Sep 2007
Posts: 11
Reputation: eeneilson is an unknown quantity at this point 
Solved Threads: 0
eeneilson eeneilson is offline Offline
Newbie Poster

Re: How do you include sound files in C++?

 
0
  #9
Sep 27th, 2007
Originally Posted by zandiago View Post
Try this: http://www.daniweb.com/code/snippet190.html
mciSendString("play the_file",NULL,0,NULL);

Ok for this do I just change the "the_file" to the name of my wave file?
Reply With Quote Quick reply to this message  
Join Date: Sep 2007
Posts: 11
Reputation: eeneilson is an unknown quantity at this point 
Solved Threads: 0
eeneilson eeneilson is offline Offline
Newbie Poster

Re: How do you include sound files in C++?

 
0
  #10
Sep 28th, 2007
Um? sorry if im being impatent but are you guys still here?
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



Tag cloud for C++
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC