Home » Extra libraries, Code snippets, applications etc. » C++ language problems and code snippets » Detect when a key is pressed!
Detect when a key is pressed! [message #6942] |
Tue, 05 December 2006 15:23  |
_Seven_
Messages: 35 Registered: April 2006
|
Member |
|
|
Hi all! I'm doing a program that simulates a piano, doing beeps with diferent frequency depending of the key that is pressed. I have a table with the diferente notes and i do the follow code:
int aux;
int note[]={....}//contain the notes
while(aux!=57){ //create a cicle until aux different of 9, "9"==59
if(_conio_kbhit()){
aux=getch();
SetSound(note[aux-49]); //aux receive a number between 0-9
} //but it is in char. "1" is the
//number 49 char
}
this create a beep! but i want some function that when i press a key the beep is continuous and lasts until the key is not pressed.
I'm use gcc to compile. Thanks for your attention
|
|
|
Goto Forum:
Current Time: Sun Apr 27 00:15:37 CEST 2025
Total time taken to generate the page: 0.02946 seconds
|