# Sound in C++

hi, I'm looking to add sound into a program and so far have been unable to find out how to do so, if anybody is able to help it would be greatly appreciated

Masta.z!

• : hi, I'm looking to add sound into a program and so far have been unable to find out how to do so, if anybody is able to help it would be greatly appreciated
:
What platform? If Windows or Linux, you may want to take a look through the source for AMaMP (an open source audio engine). It's under GPL license, so think about what you're doing before just copying. ;-) Here is a link to the CVS repository:-
http://cvs.sourceforge.net/viewcvs.py/amamp/core/

Files of interest are amamp_io_win32wave.c and amamp_io_devdsp.c. Yes, it's C, but I'm sure you can do any stuff to C++ize it if that makes you feel warm and fuzzy inside.

Of course, if you just want to play short sound clips from small wave files on Windows there are simpler ways to do it in one API call, e.g. the sndPlaySound API.

Hope this helps,

Jonathan

###
for(74,117,115,116){$::a.=chr};(($_.='qwertyui')&&
(tr/yuiqwert/her anot/))for($::b);for($::c){$_.=$^X;
/(p.{2}l)/;$_=$1}$::b=~/(..)$/;print("$::a$::b $::c hack$1.");

• : : hi, I'm looking to add sound into a program and so far have been unable to find out how to do so, if anybody is able to help it would be greatly appreciated
: :
: What platform? If Windows or Linux, you may want to take a look through the source for AMaMP (an open source audio engine). It's under GPL license, so think about what you're doing before just copying. ;-) Here is a link to the CVS repository:-
: http://cvs.sourceforge.net/viewcvs.py/amamp/core/
:
: Files of interest are amamp_io_win32wave.c and amamp_io_devdsp.c. Yes, it's C, but I'm sure you can do any stuff to C++ize it if that makes you feel warm and fuzzy inside.
:
: Of course, if you just want to play short sound clips from small wave files on Windows there are simpler ways to do it in one API call, e.g. the sndPlaySound API.
:
: Hope this helps,
:
: Jonathan
:
: ###
: for(74,117,115,116){$::a.=chr};(($_.='qwertyui')&&
: (tr/yuiqwert/her anot/))for($::b);for($::c){$_.=$^X;
: /(p.{2}l)/;$_=$1}$::b=~/(..)$/;print("$::a$::b $::c hack$1.");
:
:

hey, thanx for the reply, it's so i can play short wave files... can you help with how to use the PlaySound function in either MSvisual C++ or borland turbo C++ 4.5

any help will be welcomed

Masta.z!

• : : : hi, I'm looking to add sound into a program and so far have been unable to find out how to do so, if anybody is able to help it would be greatly appreciated
: : :
: : What platform? If Windows or Linux, you may want to take a look through the source for AMaMP (an open source audio engine). It's under GPL license, so think about what you're doing before just copying. ;-) Here is a link to the CVS repository:-
: : http://cvs.sourceforge.net/viewcvs.py/amamp/core/
: :
: : Files of interest are amamp_io_win32wave.c and amamp_io_devdsp.c. Yes, it's C, but I'm sure you can do any stuff to C++ize it if that makes you feel warm and fuzzy inside.
: :
: : Of course, if you just want to play short sound clips from small wave files on Windows there are simpler ways to do it in one API call, e.g. the sndPlaySound API.
: :
: : Hope this helps,
: :
: : Jonathan
: :
: : ###
: : for(74,117,115,116){$::a.=chr};(($_.='qwertyui')&&
: : (tr/yuiqwert/her anot/))for($::b);for($::c){$_.=$^X;
: : /(p.{2}l)/;$_=$1}$::b=~/(..)$/;print("$::a$::b $::c hack$1.");
: :
: :
:
: hey, thanx for the reply, it's so i can play short wave files... can you help with how to use the PlaySound function in either MSvisual C++ or borland turbo C++ 4.5
:
: any help will be welcomed
:
You need to

#include

Then call the function, e.g.

sndPlaySound("C:\path\to\sound.wav", SND_ASYNC);

SND_ASYNC causes the function to return right away, rather than waiting for the sound to finish playing. Change it to SND_SYNC to do that.

More info is, as always, in the MSDN. If you have your sounds in a resource file, look up the PlaySound API in MSDN, which (I think) lets you play stuff from a resource file directly.

Jonathan

###
for(74,117,115,116){$::a.=chr};(($_.='qwertyui')&&
(tr/yuiqwert/her anot/))for($::b);for($::c){$_.=$^X;
/(p.{2}l)/;$_=$1}$::b=~/(..)$/;print("$::a$::b $::c hack$1.");