473,748 Members | 2,294 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

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
Jun 27 '08 #1
10 7066
an************* *@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/>
Jun 27 '08 #2
On May 7, 8:02 pm, Daniel Pitts
<newsgroup.spam fil...@virtuali nfinity.netwrot e:
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
Jun 27 '08 #3
an************* *@gmail.com wrote:
On May 7, 8:02 pm, Daniel Pitts
<newsgroup.spam fil...@virtuali nfinity.netwrot e:
>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/>
Jun 27 '08 #4
an************* *@gmail.com wrote in news:6a5edae1-7698-4d95-98fa-
24**********@p3 9g2000prm.googl egroups.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++.
hth
Paavo
Jun 27 '08 #5
an************* *@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.publi c groups, rather than here.

Andy
Jun 27 '08 #6
On May 8, 2:56 am, Andy Champ <no....@nospam. comwrote:
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.publi c groups, rather than here.

Andy
again i m telling that i have "arch linux" and "g++" complier
Jun 27 '08 #7
Hi

an************* *@gmail.com 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

Jun 27 '08 #8
an************* *@gmail.com 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.c om/c++-faq-lite/how-to-post.html>

Brian
Jun 27 '08 #9
an************* *@gmail.com wrote:
>
again i m telling that i have "arch linux" and "g++" complier
Actually, at the time I wrote that, you had only said

"i search its archive but all are showing "PlaySound" Function with the
"windows.h" header"

Which sounds pretty much like Windoze. I can't help you on Linux.

Andy
Jun 27 '08 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
3232
by: vikram | last post by:
in a stereo type of wave file i want to know what is this left & right info in a wave file??? how do i read the left & right info from a .wav file to a buffer..
9
5608
by: Morris Neuman | last post by:
Im working with VS 2005 and trying to use a Hyperlink field in a datagrid to play a wave file that is not located in the website folders but is in a plain folder on the same machine, windows 2003 server, WMP 10.0 . If I type the full path in an IE address field it plays the file in WMP When I test my Web page ( running the debugger in VS.) The datagrid has a column called "MsgFile" with the full path to the wave file e.g....
0
1005
by: ryan186 | last post by:
I need to write in java to get a wave file from the internet chunk by chunk, given the IP address, but i have no idea how to write, can some body give me a hand? Thank you
0
2025
by: Simrat Kaur Sandhu | last post by:
hello friends can anybody tell me how to read data from a wave file.. i have writen code as ... class file { private: FILE *fp; char id; char *sound_buffer; //four bytes to hold 'RIFF' long int size; //32 bit value to hold file size
2
2160
by: Lint Radley | last post by:
Hello Everyone, I've seen online many examples online using a DLLImport of WinMM.dll to a WAVE file in C#/.NET. I haven't seen any methods in the .NET Framework - does it not exist, or am I missing something? Thanks so much, Lint Radley
2
19410
by: homevista | last post by:
Our goal here: We want the PC to call a designated phone number when something happens, and report it in easy-to-understand spoken audio snippets which are saved in the form of pre-recorded wave files. PART I: Find out about your modem's capability. Most modems can be classified with these characteristics: Data/fax Data/fax/voice Data/fax/voice/speakerphone
1
14927
by: homevista | last post by:
Part II: Wave file - How to read to a buffer Wave (or Wav) is the standard format for storing audio data on the PC. As software developers, we are interested in the internal structure of the file so that we can open and read data correctly before transmitting it over the phone line. Fortunately, there are plenty of good articles on the internet addressing the wave file format. Here is one of them:...
6
29149
by: homevista | last post by:
PART III: Putting things together In part I we examined the modem to verify that it supported voice. If so, we took a note about the voice data format that we would use. In the second part, we prepared a wave file and implemented a piece of code in C# to be used by HomeZIX to read the wave file into a buffer. Now, it’s time to put things together to send out that buffer as an audio stream over the phone line to a designated phone number. ...
3
581
by: andrew.smith.cpp | last post by:
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
0
8983
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9528
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8235
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6792
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4592
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4863
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3298
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2774
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2206
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.