473,714 Members | 3,350 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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:\0 1-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 5479
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
15433
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 the parameters and i have all the right headerfiles in there, but it won't work. it says that i must declare SND_FILENAME ,
2
1685
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 my project as a resource (steps please) How do I call PlaySound once that I have the wav file as part of the resource.
10
2476
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 plays a sound file. One of the options I found in a nice description of PlaySound says that there are a couple of other choices. 1) The sound can be in the registry and actually controlled/selected by the end user.
9
11840
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) until the user clicks a button to acknowledge the situation. To keep things simple, lets assume there is only one monitor. If I use the old sndPlaySound function, with the code:
1
1798
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 can make it do is display an alert. If anyone can help with this I would really appreciate it. Chris
3
10638
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 Windows, and they play fine outside of my app. This code works, but has the random "scratching" problem: private static void PlayResource(string audioRes) { // Get the resource into a stream
0
1047
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' occurred in Application.exe Additional information: Object reference not set to an instance of an object” When I debug, it prompt an error at the if statement, when mouse move over to Str, it's nothing. My codes as follow :
0
1261
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. I have a button that when clicked triggers an event that makes each picturebox visible one at a time and plays a wav file associated with the image in the picturebox. I have put an example of the code below: //picturebox1 is already visible on...
7
5546
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 generally works find but I have trouble when the ball is hitting corners of the box. That is particularly annoying to check especially when levels are very different of each other. This is the function where I check collision with boxes. public...
0
8808
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
8712
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9316
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...
1
9077
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9023
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7954
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
6638
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
4466
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...
3
2113
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.