473,326 Members | 2,108 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

need help with the PlaySound Function

I am tyring to write a small menu program that will display the lyrics of a
song, and then play the song. I was told that you have to convert the mp3
to wav, did that.

The 2 function calls under each case is included in another header file that
I created. I have the <mmsystem.h> included in the main cpp file. The
functions under the PlaySound function works correctly, but it is not
playing the wav file.
void main()
{
char choice;

do
{
choice = showMenu(28,10);
switch(choice)
{
case '1': PlaySound("c:\01-thir13teen-pms", NULL, SND_FILENAME |
SND_ASYNC);
typeoNegative();
setcolor(0x0017);
break;
case '2': ozzyshot();
setcolor(0x0021);
break;
case '3': pinkfloyd();
setcolor(0x00e0);
break;
case '4': blackSabbath();
setcolor(0x047);
break;
}
}while(choice != '0');

}
Jul 19 '05 #1
1 5447
Ben Bateman wrote:
I am tyring to write a small menu program that will display the lyrics of a
song, and then play the song. I was told that you have to convert the mp3
to wav, did that.
C++ does not have facilities for playing songs, nor does it have
anything to say about mp3 or wav.

The 2 function calls under each case is included in another header file that
I created. I have the <mmsystem.h>
Not a standard C++ header.
included in the main cpp file. The
functions under the PlaySound function works correctly, but it is not
playing the wav file.
PlaySound is not a standard C++ function.


void main()


In C++, main returns int.

<snip remaining non-standard code>

I don't see a C++ question in your message. If you have a question about
C++, please ask it. If you want to post code demonstrating a problem, we
encourage that, but please leave out any and all non-standard functions,
constructs, etc.

If you *don't* have a C++ question, then please find a more appropriate
newsgroup.

Also, please read the Welcome message which is posted at least twice a
week (I believe it was posted today) with the text "Welcome to
comp.lang.c++. Read this before posting" in the subject line.

-Kevin
--
My email address is valid, but changes periodically.
To contact me please use the address from a recent posting.

Jul 19 '05 #2

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

Similar topics

19
by: bballmitch | last post by:
Why won't the following code work? char soundfile2 = "C:/Windows/Media/pinky and the brain.wav"; PlaySound(soundfile2,NULL,SND_FILENAME|SND_SYNC|SND_ASYNC); getchar(); i put libwinmm.a in...
2
by: Joe Thompson | last post by:
Hi, I am trying to use PlaySound in a VC++.net Windows app (VS 2003). I can use it to play a file but now I want to play it from a resource. I have two questions: How do I add a wav file to...
10
by: Ot | last post by:
I found information on PlaySound. I implemented it in my program and it works just dandy. The only little problem is that I have to package the ..wav files and send them along since PlaySound...
9
by: Andy | last post by:
Hi, I have an application that has several forms. Each form acts as a monitor of a gateway system. If the gateway appears to be dead, the application should play a .wav file (not resource)...
1
by: chris962 | last post by:
I have very basic knowledge of Javascript and am trying to get a web page to play one of two different sound files based on whether the user has correctly guessed a number. At the moment, all I...
3
by: Jared | last post by:
I'm using the first code sample below to play WAV files stored as embedded resources. For some reason I *occasionally* get scratching and crackling. I'm using a couple WAVs that ship with...
0
by: Chia Lee Lee | last post by:
Hi... I have a problem when i try to insert a sound file (.wav) to my project but system prompt me an error message as follow: “An unhandled exception of type 'System.NullReferenceException'...
0
by: Mike | last post by:
I am a novice writing a simple program in Visual C++ Express and am having an issue. I basically have several picture boxes of the same size on top of each other with only one visible at a time. ...
7
by: Humakt | last post by:
This is 2D game where there are breakable boxes in the middle two bats on both sides and one or more balls breaking the boxes. Kind of like a mixup of pong and breakout. Collision detection...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.