473,402 Members | 2,061 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,402 software developers and data experts.

wait function and sound

I am in a cpp class, but i am messing around the program on my own, and I am looking for some commands. or at least a place that i can go to find commands that i want.

There are 2 questions that I currently have. When i started with coding (way back on QBASIC) there were 2 commands that it seems like should be somewhat universal. one was a wait function. IE, in a loop function a command that makes the program wait for time N before it continues.

The other is a sound function. not the beep function, but where you could play freaquency x for time y. Is there a command like that for cpp?

thanks in advance.
Sep 23 '07 #1
3 3256
for(i=0;i<=3000;i+=100)
{
sound(i);//producing sound with the frequency of i
sleep(3)// wait for 3 seconds... u can also use the delay functions// delay(300) means, it'll wait for 300 milliseconds
}
Jul 11 '08 #2
arnaudk
424 256MB
sound(i);//producing sound with the frequency of i
sleep(3)// wait for 3 seconds... u can also use the delay functions// delay(300) means, it'll wait for 300 milliseconds
Now in which library are these functions defined, because they're not part of the standard library... ?

You could write wait functions using the ctime library. Sounds are more OS specific, I think that in windows there is a Beep() function defined in the windows API.
Jul 12 '08 #3
oler1s
671 Expert 512MB
I am in a cpp class, but i am messing around the program on my own, and I am looking for some commands. or at least a place that i can go to find commands that i want.
You have shell commands. You do not have C++ "commands".

there were 2 commands that it seems like should be somewhat universal
You are mistaken, then.

The simplest "wait" functionality is to use a busy loop. But if you want to pause a program's functionality, almost always a busy loop is undesirable. It depends on the system to do this, but look for "sleep" and see how to implement it on your operating system.

The other is a sound function. not the beep function, but where you could play freaquency x for time y.
Beeping is simpler, but if you want actual input through the sound card, etc. that's more involved. Again, OS specific. So look it up for your respective platform.
Jul 12 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Rasmus Grøndahl Olsen | last post by:
I have tried to write a wait function but it seems like it will not brake the while loop. I tried two different solutions. Can anyone tell me what I am doing wrong, and come with another...
6
by: SP | last post by:
Hi, I want to add wait cursor code whenever page is post back. Page may be post back on my user control's or on change of dropdown or on click of any button on page. so is there any common...
4
by: PJ6 | last post by:
This is the only solution I've found to get a wait cursor document-wide: function Busy() { if (document.all) for (var i=0;i < document.all.length; i++) document.all(i).style.cursor = 'wait'; }...
12
by: Perecli Manole | last post by:
I am having some strange thread synchronization problems that require me to better understand the intricacies of Monitor.Wait/Pulse. I have 3 threads. Thread 1 does a Monitor.Wait in a SyncLock...
3
by: Adam Clauss | last post by:
Documentation states that a call to Wait releases the lock, and will not return until the lock is reacquired. How do exceptions figure into this? Are they considered a form of "return"? ...
14
by: stephen.durkin | last post by:
I've gathered that javascript doesn't have a handy wait() function, so I made the following function makeDelay() to make use of PHP's sleep(), which then does the waiting, and responds with...
3
by: nullstring | last post by:
Hallo Leute, gerade sitze ich vor dem problem, das ich eine Klasse schreiben muss dir mir ne Wav datei vom mikro aufnimmt und wieder abspielt. Mein Problem ist nun, das mir meine...
4
by: MrDeej | last post by:
Hello guys! I am trying to use trevors wait function on my odbc database for a countdown function. But this function is not stable as it sometimes dosent actually wait before launching next line...
3
by: nathanwb | last post by:
I have the following php code, at the top I am pulling a piece of data from a query and I echo the results with no problem, I am using Ajax with this page as well and further down the page when I...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
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,...
0
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...
0
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,...
0
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...
0
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,...
0
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...

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.