Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
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 Go to previous message
_Seven_ is currently offline  _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
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: va_list problem
Next Topic: article "Reading C type declarations" for C++ newbies or ignorants like me ;)
Goto Forum:
  


Current Time: Thu Apr 25 08:13:01 CEST 2024

Total time taken to generate the page: 0.04599 seconds