Page 1 of 1

Access to keyboard key presses

Posted: 29 Jul 2010, 09:53
by tmile77
I'm having trouble to get access to reliable key presses of the keyboard (up and down keys in my case). Method that I'm using right now is to run application modul with "--LogKeyboard=1" and to read out the values of the "KeyDown" state at the beggining of my implementation of the ApplicationBase::Process function. Problem is that not all of the key-presses are received, so I need to press the key a bunch of times until it's received by the framework.

Is there a better way to do this?

Posted: 29 Jul 2010, 10:31
by mellinger
When you just read the value of the "KeyDown" state this way:

Code: Select all

int keyDown = State( "KeyDown" );
you will not catch all keypresses. Rather, you need to consider the state's value for each sample in the block:

Code: Select all

int sampleBlockSize = Parameter( "SampleBlockSize" );
for( int i = 0; i < sampleBlockSize; ++i )
{
  int keyDown = State( "KeyDown" )( i );
  ...
}
HTH,
Juergen

Posted: 30 Jul 2010, 09:19
by tmile77
Fixed. Works great now. Thanks.