Solved

Beep Question

Posted on 2000-04-07
6
223 Views
Last Modified: 2010-04-10
I'm using VC++6 on NT4.  I'm aware of the Beep(freq,dur), but I want to extend the usage of this feature.  I would like to create a chord (possibly 3 notes at once) out of it, but am unable to do so.  Any suggestions?

Sorry, also...  another thing I want to ask is: How do I put a "rest" in the middle of a song?
0
Comment
Question by:jumanji
  • 3
  • 2
6 Comments
 
LVL 22

Expert Comment

by:nietod
ID: 2695912
Not with beep(), you could try PlaySound() or the various waveXXXX functions to try to do this.

0
 

Author Comment

by:jumanji
ID: 2696777
What are the variables that I need to put in for PlaySound()?
0
 
LVL 22

Expert Comment

by:nietod
ID: 2696828
Its all documented in the VC help.   You need a pointer to a string that specifes the sound (iether a resource ID or a sound file name), the module handle for the module with the sound resource, and soem flags that indicate if the name provided is a resource ID or a file name, plus other options.)
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:jumanji
ID: 2696843
Could you post a code?
0
 
LVL 23

Accepted Solution

by:
chensu earned 100 total points
ID: 2696856
#include <mmsystem.h>

::PlaySound(_T("c:\\windows\\media\\chord.wav"), NULL, SND_ASYNC | SND_FILENAME);

Make sure the c:\windows\media\chord.wav file exists. And you need to link with winmm.lib (Menu Project/Settings..., Link tab, Objects/library modules).
0
 

Author Comment

by:jumanji
ID: 2697005
Thnx!  I got it working perfectly!
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Which IDE to use to begin C++ training? 5 70
c++ getting the first 10 characters of a char* string 11 104
Least Squares Curve Fitting 4 114
C++ mouse_event mouse look 7 110
Errors will happen. It is a fact of life for the programmer. How and when errors are detected have a great impact on quality and cost of a product. It is better to detect errors at compile time, when possible and practical. Errors that make their wa…
  Included as part of the C++ Standard Template Library (STL) is a collection of generic containers. Each of these containers serves a different purpose and has different pros and cons. It is often difficult to decide which container to use and …
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.

685 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question