Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > To Play ".wave" file with C++(Background music)

Reply
Thread Tools

To Play ".wave" file with C++(Background music)

 
 
andrew.smith.cpp@gmail.com
Guest
Posts: n/a
 
      05-07-2008
Hello
how can i play a ".wav" file in C++.means with the help of the C++
code i just want to play a "a.wav" file more then 10 times. i just
want to play background music.
Can i do it in C++ ?
if yes then how ?

Thanks
 
Reply With Quote
 
 
 
 
Daniel Pitts
Guest
Posts: n/a
 
      05-07-2008
wrote:
> Hello
> how can i play a ".wav" file in C++.means with the help of the C++
> code i just want to play a "a.wav" file more then 10 times. i just
> want to play background music.
> Can i do it in C++ ?
> if yes then how ?
>
> Thanks

You can, but its not a simple question nor a simple solution. If you
are a beginner to C++, it is likely out of your league. I'm *not* a
beginner, and I would struggle with it

--
Daniel Pitts' Tech Blog: <http://virtualinfinity.net/wordpress/>
 
Reply With Quote
 
 
 
 
andrew.smith.cpp@gmail.com
Guest
Posts: n/a
 
      05-07-2008
On May 7, 8:02 pm, Daniel Pitts
<newsgroup.spamfil...@virtualinfinity.net> wrote:
> andrew.smith....@gmail.com wrote:
> > Hello
> > how can i play a ".wav" file in C++.means with the help of the C++
> > code i just want to play a "a.wav" file more then 10 times. i just
> > want to play background music.
> > Can i do it in C++ ?
> > if yes then how ?

>
> > Thanks

>
> You can, but its not a simple question nor a simple solution. If you
> are a beginner to C++, it is likely out of your league. I'm *not* a
> beginner, and I would struggle with it
>
> --
> Daniel Pitts' Tech Blog: <http://virtualinfinity.net/wordpress/>

Hello D
I m Not a Beginner but i don't know anything about it.
i search its archive but all are showing "PlaySound" Function with the
"windows.h" header and i m user of "g++"
its not working there. so what should i use for it.
Boz of i have to play a music with the code of C++.
if u know then Tell Me How?
Thanks
 
Reply With Quote
 
Daniel Pitts
Guest
Posts: n/a
 
      05-07-2008
wrote:
> On May 7, 8:02 pm, Daniel Pitts
> <newsgroup.spamfil...@virtualinfinity.net> wrote:
>> andrew.smith....@gmail.com wrote:
>>> Hello
>>> how can i play a ".wav" file in C++.means with the help of the C++
>>> code i just want to play a "a.wav" file more then 10 times. i just
>>> want to play background music.
>>> Can i do it in C++ ?
>>> if yes then how ?
>>> Thanks

>> You can, but its not a simple question nor a simple solution. If you
>> are a beginner to C++, it is likely out of your league. I'm *not* a
>> beginner, and I would struggle with it
>>
>> --
>> Daniel Pitts' Tech Blog: <http://virtualinfinity.net/wordpress/>

> Hello D
> I m Not a Beginner but i don't know anything about it.
> i search its archive but all are showing "PlaySound" Function with the
> "windows.h" header and i m user of "g++"
> its not working there. so what should i use for it.
> Boz of i have to play a music with the code of C++.
> if u know then Tell Me How?
> Thanks

It depends on what OS/platform your targeting. There is no standard way
to do it.

--
Daniel Pitts' Tech Blog: <http://virtualinfinity.net/wordpress/>
 
Reply With Quote
 
andrew.smith.cpp@gmail.com
Guest
Posts: n/a
 
      05-08-2008
On May 8, 2:56 am, Andy Champ <no....@nospam.com> wrote:
> andrew.smith....@gmail.com wrote:
> > I m Not a Beginner but i don't know anything about it.
> > i search its archive but all are showing "PlaySound" Function with the
> > "windows.h" header and i m user of "g++"
> > its not working there. so what should i use for it.
> > Boz of i have to play a music with the code of C++.
> > if u know then Tell Me How?
> > Thanks

>
> PlaySound will do the trick - or you could link to the media player
> control if you want to do anything more clever. either way, you should
> ask on one of the microsoft.public groups, rather than here.
>
> Andy


again i m telling that i have "arch linux" and "g++" complier
 
Reply With Quote
 
Markus Moll
Guest
Posts: n/a
 
      05-08-2008
Hi

wrote:

> again i m telling that i have "arch linux" and "g++" complier


You have not told us before. Anyway, you might want to have a look at libSDL
(http://www.libsdl.org/)

Markus

 
Reply With Quote
 
Default User
Guest
Posts: n/a
 
      05-08-2008
wrote:


> again i m telling that i have "arch linux" and "g++" complier


And if that matters, you're probably in the wrong group.

<http://www.parashift.com/c++-faq-lite/how-to-post.html>





Brian
 
Reply With Quote
 
James Kanze
Guest
Posts: n/a
 
      05-09-2008
On May 7, 10:00 pm, Paavo Helde <nob...@ebi.ee> wrote:
> andrew.smith....@gmail.com wrote in news:6a5edae1-7698-4d95-98fa-
> 2440d5f9b...@p39g2000prm.googlegroups.com:
> > On May 7, 8:02 pm, Daniel Pitts

> [...]
> > I m Not a Beginner but i don't know anything about it.
> > i search its archive but all are showing "PlaySound" Function with the
> > "windows.h" header and i m user of "g++"
> > its not working there. so what should i use for it.


> g++ works also in Windows and presumably is able to include
> <windows.h> (if you have downloaded and installed the Windows
> SDK first of course).


> If you are not on Windows you have to find other means. On
> Linux a simple bash script should be enough for such things,
> no need for C++.


In general, if the goal is just to play some background music,
and no real interaction is involved, the best solution is likely
to be to figure out the system dependent command line request to
do it, and invoke that via the system() function. On most
systems, system() will return something which can later be
converted into a command line request to kill the process, if
that's needed as well. (On the systems I'm familiar with,
system returns the process id, and something like:

std:stringstream cmd ;
cmd << "kill " << systemReturnValue ;
system( cmd.str().c_str() ) ;

can be used to stop the process.)

--
James Kanze (GABI Software) email:
Conseils en informatique orientée objet/
Beratung in objektorientierter Datenverarbeitung
9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
To play or not to play bhuckle@bigpond.net.au DVD Video 1 08-01-2007 07:18 AM
PLAY MORE VIDEO GAMES WITH GOTTA PLAY abhi Digital Photography 1 05-21-2007 11:40 AM
Click to Play Black Jack Online. Top Search Results For Play splin32red VOIP 0 09-16-2006 07:01 PM
Datagrid Hyperlink field to play file system wave file help. =?Utf-8?B?TW9ycmlzIE5ldW1hbg==?= ASP .Net 9 09-11-2006 09:51 PM
Mozilla could not play sound file attached to BlueMountain Card Art Hough Firefox 1 11-07-2003 11:41 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57