Additions:
===[[KbQueueCreate]]===
==[[Psychtoolbox]] › [[PsychBasic]]==
KbQueueCreate([deviceNumber, keyList])
The routines KbQueueCreate, KbQueueStart, KbQueueStop, KbQueueCheck
KbQueueWait, KbQueueFlush and KbQueueRelease provide replacments for
KbCheck and KbWait, providing the following advantages:
1) Brief key presses that would be missed by KbCheck or KbWait
are reliably detected
2) The times of key presses are recorded more accurately
3) The times of key releases are also recorded
=== Limitations: ===
1) If a key is pressed multiple times before KbQueueCheck is called,
only the times of the first and last presses and releases of that
key can be recovered (this has no effect on other keys)
2) If many keys are pressed very quickly in succession, it is at least
theoretically possible for the queue to fill more quickly than
it can be emptied, losing key events temporarily while filled to
capacity. The queue holds up to thirty events, and events are
constantly being removed from the queue and processed, so this is
unlikely to be a problem in actual use.
Only a single device can be monitored at any given time. The deviceNumber can
be specified only in the call to KbQueueCreate. The other routines then
relate to that specified device. If deviceNumber is not specified, the first
device is the default (like KbCheck). If KbQueueCreate has not been called
first, the other routines will generate an error message. Likewise, if
KbQueueRelease has been called more recently than KbQueueCreate, the other
routines will generate error messages.
It is acceptable to call KbQueueCreate at any time (e.g., to switch to a new
device or to change the list of queued keys) without calling KbQueueRelease.
KbQueueCreate([deviceNumber][, keyList])
Creates the queue for the specified (or default) device number
If the device number is less than zero, the default device is used.
keyList is an optional 256-length vector of doubles (not logicals)
with each element corresponding to a particular key (use KbName
to map between keys and their positions). If the double value
corresponding to a particular key is zero, events for that key
are not added to the queue and will not be reported.
No events are delivered to the queue until KbQueueStart or
KbQueueWait is called.
KbQueueCreate can be called again at any time. The function can also
treat other HID devices with buttons or keys as if they are
keyboards. E.g., it can also record button state of a mouse, a
joystick or a gamepad.
KbQueueStart()
Starts delivering keyboard events from the specified device to the
queue.
KbQueueStop()
Stops delivery of new keyboard events from the specified device to
the queue.
Data regarding events already queued is not cleared and can be
recovered by KbQueueCheck
[pressed, firstPress, firstRelease, lastPress, lastRelease]=
KbQueueCheck()
Obtains data about keypresses on the specified device since the
most recent call to this routine, KbQueueStart, KbQueuWait
Clears all scored events, but unscored events that are still being
processsed may remain in the queue
pressed: a boolean indicating whether a key has been pressed
firstPress: an array indicating the time that each key was first
pressed since the most recent call to KbQueueCheck or KbQueueStart
firstRelease: an array indicating the time that each key was first
released since the most recent call to KbQueueCheck or KbQueueStart
lastPress: an array indicating the most recent time that each key was
pressed since the most recent call to KbQueueCheck or KbQueueStart
lastRelease: an array indicating the most recent time that each key
was released since the most recent call to KbQueueCheck or
KbQueueStart
For firstPress, firstRelease, lastPress and lastRelease, a time value
of zero indicates that no event for the corresponding key was
detected since the most recent call to KbQueueCheck or KbQueueStart
To identify specific keys, use KbName (e.g., KbName(firstPress)) to
generate a list of the keys for which the events occurred
For compatibility with KbCheck, any key codes stored in
ptb_kbcheck_disabledKeys (see "help DisableKeysForKbCheck"), will
not caused pressed to return as true and will be zeroed out in the
returned arrays. However, a better alternative is to specify a
keyList arguement to KbQueueCreate.
secs=KbQueueWait()
Waits for any key to be pressed and returns the time of the press
KbQueueFlush should be called immediately prior to this function
(unless the queue has just been created and started) to clear any
prior events.
Note that this command will not respond to any keys that were
inactivated by using the keyList argument to KbQueueCreate.
Since KbQueueWait is implemented as a looping call to
KbQueueCheck, it will not respond to any key codes stored in
the global variable ptb_kbcheck_disabledKeys
(see "help DisableKeysForKbCheck")
KbQueueFlush()
Removes all unprocessed events from the queue and zeros out any
already scored events.
KbQueueRelease()
Releases queue-associated resources; once called, KbQueueCreate
must be invoked before using any of the other routines
This routine is called automatically at clean-up (e.g., when
'clear mex' is invoked and can be omitted expense of keeping
memory allocated and an additional thread running unnecesarily
Note that any keyboard typing used to invoke KbQueue commands will be
recorded. This would include the release of the carriage return used
to execute KbQueueStart and the keys pressed and released to invoke
KbQueueCheck
----
See also: KbQueueCreate, KbQueueStart, KbQueueStop, KbQueueCheck,
KbQueueWait, KbQueueFlush, KbQueueRelease
""
<div class="code_header" style="text-align:right;">
<span style="float:left;">Path </span> <span class="counter">Retrieve current version of KbQueueCreate.m from berliOS: <a href=
"http://svn.berlios.de/svnroot/repos/osxptb/beta/Psychtoolbox/PsychBasic/KbQueueCreate.m">beta</a> | view WebSVN <a href=
"http://svn.berlios.de/wsvn/osxptb/trunk/Psychtoolbox/PsychBasic/KbQueueCreate.m?op=log">changelog</a> of trunk branch</span>
</div>
<div class="code">
<code>Psychtoolbox/PsychBasic/KbQueueCreate.m</code>
</div>
""
Deletions:
""<div class="subfct" id="PsychHID">""===[[KbQueueCreate PsychHID('KbQueueCreate')]]===
==[[Psychtoolbox]] › [[PsychHID]].{mex*,dll} subfunction==
%%(matlab;Usage)PsychHID('KbQueueCreate', [deviceNumber], [keyFlags])%%
Creates a queue for events generated by an input device (keyboard, keypad,
mouse, ...).
By default the first keyboard device (the one with the lowest device number) is
used. If no keyboard is found, the first keypad device is used, followed by
other devices, e.g., mice. Optionally, the deviceNumber of any keyboard or HID
device may be specified.
On OS/X only one input device queue is allowed at a time.
On MS-Windows XP and later, it is currently not possible to enumerate different
keyboards and mice separately. Therefore the 'deviceNumber' argument is mostly
useless for keyboards and mice. Usually you can only check the system keyboard
or mouse.
<<=====See also:=====
KbQueueStart, KbQueueStop, KbQueueCheck, KbQueueFlush, KbQueueRelease<<""</div>""
Additions:
Creates a queue for events generated by an input device (keyboard, keypad,
mouse, ...).
used. If no keyboard is found, the first keypad device is used, followed by
other devices, e.g., mice. Optionally, the deviceNumber of any keyboard or HID
device may be specified.
On OS/X only one input device queue is allowed at a time.
On MS-Windows XP and later, it is currently not possible to enumerate different
keyboards and mice separately. Therefore the 'deviceNumber' argument is mostly
useless for keyboards and mice. Usually you can only check the system keyboard
or mouse.
Deletions:
Creates a queue for keyboard or keypad events generated by a device.
scanned. If no keyboard is found, the first keypad device is scanned.
Optionally, the device number of any keyboard or keypad may be specified.
On Linux you can have multiple parallel keyboard queues - one per keyboard
device. On OS/X only one queue is allowed at a time.
On Linux and OS/X, handling of keyboard queues is very efficient. On MS-Windows,
the keyboard queue might be a bit less efficient. On MS-Windows XP and later, to
our knowledge it is not possible to enumerate different keyboards separately.
Therefore the 'deviceNumber' argument is mostly useless and usually you can only
check the default keyboard.
Additions:
""<div class="subfct" id="PsychHID">""===[[KbQueueCreate PsychHID('KbQueueCreate')]]===
==[[Psychtoolbox]] › [[PsychHID]].{mex*,dll} subfunction==
%%(matlab;Usage)PsychHID('KbQueueCreate', [deviceNumber], [keyFlags])%%
Creates a queue for keyboard or keypad events generated by a device.
By default the first keyboard device (the one with the lowest device number) is
scanned. If no keyboard is found, the first keypad device is scanned.
Optionally, the device number of any keyboard or keypad may be specified.
On Linux you can have multiple parallel keyboard queues - one per keyboard
device. On OS/X only one queue is allowed at a time.
On Linux and OS/X, handling of keyboard queues is very efficient. On MS-Windows,
the keyboard queue might be a bit less efficient. On MS-Windows XP and later, to
our knowledge it is not possible to enumerate different keyboards separately.
Therefore the 'deviceNumber' argument is mostly useless and usually you can only
check the default keyboard.
<<=====See also:=====
KbQueueStart, KbQueueStop, KbQueueCheck, KbQueueFlush, KbQueueRelease<<""</div>""
Deletions:
===[[KbQueueCreate]]===
==[[Psychtoolbox]] › [[PsychBasic]]==
KbQueueCreate([deviceNumber, keyList])
The routines KbQueueCreate, KbQueueStart, KbQueueStop, KbQueueCheck
KbQueueWait, KbQueueFlush and KbQueueRelease provide replacments for
KbCheck and KbWait, providing the following advantages:
1) Brief key presses that would be missed by KbCheck or KbWait
are reliably detected
2) The times of key presses are recorded more accurately
3) The times of key releases are also recorded
=== Limitations: ===
1) If a key is pressed multiple times before KbQueueCheck is called,
only the times of the first and last presses and releases of that
key can be recovered (this has no effect on other keys)
2) If many keys are pressed very quickly in succession, it is at least
theoretically possible for the queue to fill more quickly than
it can be emptied, losing key events temporarily while filled to
capacity. The queue holds up to thirty events, and events are
constantly being removed from the queue and processed, so this is
unlikely to be a problem in actual use.
Only a single device can be monitored at any given time. The deviceNumber can
be specified only in the call to KbQueueCreate. The other routines then
relate to that specified device. If deviceNumber is not specified, the first
device is the default (like KbCheck). If KbQueueCreate has not been called
first, the other routines will generate an error message. Likewise, if
KbQueueRelease has been called more recently than KbQueueCreate, the other
routines will generate error messages.
It is acceptable to call KbQueueCreate at any time (e.g., to switch to a new
device or to change the list of queued keys) without calling KbQueueRelease.
KbQueueCreate([deviceNumber][, keyList])
Creates the queue for the specified (or default) device number
If the device number is less than zero, the default device is used.
keyList is an optional 256-length vector of doubles (not logicals)
with each element corresponding to a particular key (use KbName
to map between keys and their positions). If the double value
corresponding to a particular key is zero, events for that key
are not added to the queue and will not be reported.
No events are delivered to the queue until KbQueueStart or
KbQueueWait is called.
KbQueueCreate can be called again at any time
KbQueueStart()
Starts delivering keyboard events from the specified device to the
queue.
KbQueueStop()
Stops delivery of new keyboard events from the specified device to
the queue.
Data regarding events already queued is not cleared and can be
recovered by KbQueueCheck
[pressed, firstPress, firstRelease, lastPress, lastRelease]=
KbQueueCheck()
Obtains data about keypresses on the specified device since the
most recent call to this routine, KbQueueStart, KbQueuWait
Clears all scored events, but unscored events that are still being
processsed may remain in the queue
pressed: a boolean indicating whether a key has been pressed
firstPress: an array indicating the time that each key was first
pressed since the most recent call to KbQueueCheck or KbQueueStart
firstRelease: an array indicating the time that each key was first
released since the most recent call to KbQueueCheck or KbQueueStart
lastPress: an array indicating the most recent time that each key was
pressed since the most recent call to KbQueueCheck or KbQueueStart
lastRelease: an array indicating the most recent time that each key
was released since the most recent call to KbQueueCheck or
KbQueueStart
For firstPress, firstRelease, lastPress and lastRelease, a time value
of zero indicates that no event for the corresponding key was
detected since the most recent call to KbQueueCheck or KbQueueStart
To identify specific keys, use KbName (e.g., KbName(firstPress)) to
generate a list of the keys for which the events occurred
For compatibility with KbCheck, any key codes stored in
ptb_kbcheck_disabledKeys (see "help DisableKeysForKbCheck"), will
not caused pressed to return as true and will be zeroed out in the
returned arrays. However, a better alternative is to specify a
keyList arguement to KbQueueCreate.
secs=KbQueueWait()
Waits for any key to be pressed and returns the time of the press
KbQueueFlush should be called immediately prior to this function
(unless the queue has just been created and started) to clear any
prior events.
Note that this command will not respond to any keys that were
inactivated by using the keyList argument to KbQueueCreate.
Since KbQueueWait is implemented as a looping call to
KbQueueCheck, it will not respond to any key codes stored in
the global variable ptb_kbcheck_disabledKeys
(see "help DisableKeysForKbCheck")
KbQueueFlush()
Removes all unprocessed events from the queue and zeros out any
already scored events.
KbQueueRelease()
Releases queue-associated resources; once called, KbQueueCreate
must be invoked before using any of the other routines
This routine is called automatically at clean-up (e.g., when
'clear mex' is invoked and can be omitted expense of keeping
memory allocated and an additional thread running unnecesarily
Note that any keyboard typing used to invoke KbQueue commands will be
recorded. This would include the release of the carriage return used
to execute KbQueueStart and the keys pressed and released to invoke
KbQueueCheck
----
See also: KbQueueCreate, KbQueueStart, KbQueueStop, KbQueueCheck,
KbQueueWait, KbQueueFlush, KbQueueRelease
""
<div class="code_header" style="text-align:right;">
<span style="float:left;">Path </span> <span class="counter">Retrieve current version of KbQueueCreate.m from berliOS: <a href=
"http://svn.berlios.de/svnroot/repos/osxptb/beta/Psychtoolbox/PsychBasic/KbQueueCreate.m">beta</a> | view WebSVN <a href=
"http://svn.berlios.de/wsvn/osxptb/trunk/Psychtoolbox/PsychBasic/KbQueueCreate.m?op=log">changelog</a> of trunk branch</span>
</div>
<div class="code">
<code>Psychtoolbox/PsychBasic/KbQueueCreate.m</code>
</div>
""
Additions:
===[[KbQueueCreate]]===
==[[Psychtoolbox]] › [[PsychBasic]]==
KbQueueCreate([deviceNumber, keyList])
The routines KbQueueCreate, KbQueueStart, KbQueueStop, KbQueueCheck
KbQueueWait, KbQueueFlush and KbQueueRelease provide replacments for
KbCheck and KbWait, providing the following advantages:
1) Brief key presses that would be missed by KbCheck or KbWait
are reliably detected
2) The times of key presses are recorded more accurately
3) The times of key releases are also recorded
=== Limitations: ===
1) If a key is pressed multiple times before KbQueueCheck is called,
only the times of the first and last presses and releases of that
key can be recovered (this has no effect on other keys)
2) If many keys are pressed very quickly in succession, it is at least
theoretically possible for the queue to fill more quickly than
it can be emptied, losing key events temporarily while filled to
capacity. The queue holds up to thirty events, and events are
constantly being removed from the queue and processed, so this is
unlikely to be a problem in actual use.
Only a single device can be monitored at any given time. The deviceNumber can
be specified only in the call to KbQueueCreate. The other routines then
relate to that specified device. If deviceNumber is not specified, the first
device is the default (like KbCheck). If KbQueueCreate has not been called
first, the other routines will generate an error message. Likewise, if
KbQueueRelease has been called more recently than KbQueueCreate, the other
routines will generate error messages.
It is acceptable to call KbQueueCreate at any time (e.g., to switch to a new
device or to change the list of queued keys) without calling KbQueueRelease.
KbQueueCreate([deviceNumber][, keyList])
Creates the queue for the specified (or default) device number
If the device number is less than zero, the default device is used.
keyList is an optional 256-length vector of doubles (not logicals)
with each element corresponding to a particular key (use KbName
to map between keys and their positions). If the double value
corresponding to a particular key is zero, events for that key
are not added to the queue and will not be reported.
No events are delivered to the queue until KbQueueStart or
KbQueueWait is called.
KbQueueCreate can be called again at any time
KbQueueStart()
Starts delivering keyboard events from the specified device to the
queue.
KbQueueStop()
Stops delivery of new keyboard events from the specified device to
the queue.
Data regarding events already queued is not cleared and can be
recovered by KbQueueCheck
[pressed, firstPress, firstRelease, lastPress, lastRelease]=
KbQueueCheck()
Obtains data about keypresses on the specified device since the
most recent call to this routine, KbQueueStart, KbQueuWait
Clears all scored events, but unscored events that are still being
processsed may remain in the queue
pressed: a boolean indicating whether a key has been pressed
firstPress: an array indicating the time that each key was first
pressed since the most recent call to KbQueueCheck or KbQueueStart
firstRelease: an array indicating the time that each key was first
released since the most recent call to KbQueueCheck or KbQueueStart
lastPress: an array indicating the most recent time that each key was
pressed since the most recent call to KbQueueCheck or KbQueueStart
lastRelease: an array indicating the most recent time that each key
was released since the most recent call to KbQueueCheck or
KbQueueStart
For firstPress, firstRelease, lastPress and lastRelease, a time value
of zero indicates that no event for the corresponding key was
detected since the most recent call to KbQueueCheck or KbQueueStart
To identify specific keys, use KbName (e.g., KbName(firstPress)) to
generate a list of the keys for which the events occurred
For compatibility with KbCheck, any key codes stored in
ptb_kbcheck_disabledKeys (see "help DisableKeysForKbCheck"), will
not caused pressed to return as true and will be zeroed out in the
returned arrays. However, a better alternative is to specify a
keyList arguement to KbQueueCreate.
secs=KbQueueWait()
Waits for any key to be pressed and returns the time of the press
KbQueueFlush should be called immediately prior to this function
(unless the queue has just been created and started) to clear any
prior events.
Note that this command will not respond to any keys that were
inactivated by using the keyList argument to KbQueueCreate.
Since KbQueueWait is implemented as a looping call to
KbQueueCheck, it will not respond to any key codes stored in
the global variable ptb_kbcheck_disabledKeys
(see "help DisableKeysForKbCheck")
KbQueueFlush()
Removes all unprocessed events from the queue and zeros out any
already scored events.
KbQueueRelease()
Releases queue-associated resources; once called, KbQueueCreate
must be invoked before using any of the other routines
This routine is called automatically at clean-up (e.g., when
'clear mex' is invoked and can be omitted expense of keeping
memory allocated and an additional thread running unnecesarily
Note that any keyboard typing used to invoke KbQueue commands will be
recorded. This would include the release of the carriage return used
to execute KbQueueStart and the keys pressed and released to invoke
KbQueueCheck
----
See also: KbQueueCreate, KbQueueStart, KbQueueStop, KbQueueCheck,
KbQueueWait, KbQueueFlush, KbQueueRelease
""
<div class="code_header" style="text-align:right;">
<span style="float:left;">Path </span> <span class="counter">Retrieve current version of KbQueueCreate.m from berliOS: <a href=
"http://svn.berlios.de/svnroot/repos/osxptb/beta/Psychtoolbox/PsychBasic/KbQueueCreate.m">beta</a> | view WebSVN <a href=
"http://svn.berlios.de/wsvn/osxptb/trunk/Psychtoolbox/PsychBasic/KbQueueCreate.m?op=log">changelog</a> of trunk branch</span>
</div>
<div class="code">
<code>Psychtoolbox/PsychBasic/KbQueueCreate.m</code>
</div>
""
Deletions:
""<div class="subfct" id="PsychHID">""===[[KbQueueCreate PsychHID('KbQueueCreate')]]===
==[[Psychtoolbox]] › [[PsychHID]].{mex*,dll} subfunction==
%%(matlab;Usage)PsychHID('KbQueueCreate', [deviceNumber], [keyFlags])%%
Creates a queue for keyboard or keypad events generated by a device.
By default the first keyboard device (the one with the lowest device number) is
scanned. If no keyboard is found, the first keypad device is scanned.
Optionally, the device number of any keyboard or keypad may be specified.
On Linux you can have multiple parallel keyboard queues - one per keyboard
device. On OS/X and Windows only one queue is allowed at a time.
On Linux and OS/X handling of keyboard queues is efficient. On MS-Windows, the
keyboard queue is implemented by periodic polling of the keyboard state with a
frequency of approximately 500 Hz. This is a brute-force approach which can lead
to unreliable stimulus presentation timing and keyboard timestamping unless you
have a fast (multi-core) machine. It will also draw significant amounts of
electrical power. Therefore use this feature sparingly on MS-Windows and
consider a different operating system.
On MS-Windows, the 'deviceNumber' argument is ignored and the default keyboard
is checked.
<<=====See also:=====
KbQueueStart, KbQueueStop, KbQueueCheck, KbQueueFlush, KbQueueRelease<<""</div>""
Additions:
""<div class="subfct" id="PsychHID">""===[[KbQueueCreate PsychHID('KbQueueCreate')]]===
==[[Psychtoolbox]] › [[PsychHID]].{mex*,dll} subfunction==
%%(matlab;Usage)PsychHID('KbQueueCreate', [deviceNumber], [keyFlags])%%
Creates a queue for keyboard or keypad events generated by a device.
By default the first keyboard device (the one with the lowest device number) is
scanned. If no keyboard is found, the first keypad device is scanned.
Optionally, the device number of any keyboard or keypad may be specified.
On Linux you can have multiple parallel keyboard queues - one per keyboard
device. On OS/X and Windows only one queue is allowed at a time.
On Linux and OS/X handling of keyboard queues is efficient. On MS-Windows, the
keyboard queue is implemented by periodic polling of the keyboard state with a
frequency of approximately 500 Hz. This is a brute-force approach which can lead
to unreliable stimulus presentation timing and keyboard timestamping unless you
have a fast (multi-core) machine. It will also draw significant amounts of
electrical power. Therefore use this feature sparingly on MS-Windows and
consider a different operating system.
On MS-Windows, the 'deviceNumber' argument is ignored and the default keyboard
is checked.
<<=====See also:=====
KbQueueStart, KbQueueStop, KbQueueCheck, KbQueueFlush, KbQueueRelease<<""</div>""
Deletions:
===[[KbQueueCreate]]===
==[[Psychtoolbox]] › [[PsychBasic]]==
KbQueueCreate([deviceNumber, keyList])
The routines KbQueueCreate, KbQueueStart, KbQueueStop, KbQueueCheck
KbQueueWait, KbQueueFlush and KbQueueRelease provide replacments for
KbCheck and KbWait, providing the following advantages:
1) Brief key presses that would be missed by KbCheck or KbWait
are reliably detected
2) The times of key presses are recorded more accurately
3) The times of key releases are also recorded
=== Limitations: ===
1) If a key is pressed multiple times before KbQueueCheck is called,
only the times of the first and last presses and releases of that
key can be recovered (this has no effect on other keys)
2) If many keys are pressed very quickly in succession, it is at least
theoretically possible for the queue to fill more quickly than
it can be emptied, losing key events temporarily while filled to
capacity. The queue holds up to thirty events, and events are
constantly being removed from the queue and processed, so this is
unlikely to be a problem in actual use.
Only a single device can be monitored at any given time. The deviceNumber can
be specified only in the call to KbQueueCreate. The other routines then
relate to that specified device. If deviceNumber is not specified, the first
device is the default (like KbCheck). If KbQueueCreate has not been called
first, the other routines will generate an error message. Likewise, if
KbQueueRelease has been called more recently than KbQueueCreate, the other
routines will generate error messages.
It is acceptable to call KbQueueCreate at any time (e.g., to switch to a new
device or to change the list of queued keys) without calling KbQueueRelease.
KbQueueCreate([deviceNumber][, keyList])
Creates the queue for the specified (or default) device number
If the device number is less than zero, the default device is used.
keyList is an optional 256-length vector of doubles (not logicals)
with each element corresponding to a particular key (use KbName
to map between keys and their positions). If the double value
corresponding to a particular key is zero, events for that key
are not added to the queue and will not be reported.
No events are delivered to the queue until KbQueueStart or
KbQueueWait is called.
KbQueueCreate can be called again at any time
KbQueueStart()
Starts delivering keyboard events from the specified device to the
queue.
KbQueueStop()
Stops delivery of new keyboard events from the specified device to
the queue.
Data regarding events already queued is not cleared and can be
recovered by KbQueueCheck
[pressed, firstPress, firstRelease, lastPress, lastRelease]=
KbQueueCheck()
Obtains data about keypresses on the specified device since the
most recent call to this routine, KbQueueStart, KbQueuWait
Clears all scored events, but unscored events that are still being
processsed may remain in the queue
pressed: a boolean indicating whether a key has been pressed
firstPress: an array indicating the time that each key was first
pressed since the most recent call to KbQueueCheck or KbQueueStart
firstRelease: an array indicating the time that each key was first
released since the most recent call to KbQueueCheck or KbQueueStart
lastPress: an array indicating the most recent time that each key was
pressed since the most recent call to KbQueueCheck or KbQueueStart
lastRelease: an array indicating the most recent time that each key
was released since the most recent call to KbQueueCheck or
KbQueueStart
For firstPress, firstRelease, lastPress and lastRelease, a time value
of zero indicates that no event for the corresponding key was
detected since the most recent call to KbQueueCheck or KbQueueStart
To identify specific keys, use KbName (e.g., KbName(firstPress)) to
generate a list of the keys for which the events occurred
For compatibility with KbCheck, any key codes stored in
ptb_kbcheck_disabledKeys (see "help DisableKeysForKbCheck"), will
not caused pressed to return as true and will be zeroed out in the
returned arrays. However, a better alternative is to specify a
keyList arguement to KbQueueCreate.
secs=KbQueueWait()
Waits for any key to be pressed and returns the time of the press
KbQueueFlush should be called immediately prior to this function
(unless the queue has just been created and started) to clear any
prior events.
Note that this command will not respond to any keys that were
inactivated by using the keyList argument to KbQueueCreate.
Since KbQueueWait is implemented as a looping call to
KbQueueCheck, it will not respond to any key codes stored in
the global variable ptb_kbcheck_disabledKeys
(see "help DisableKeysForKbCheck")
KbQueueFlush()
Removes all unprocessed events from the queue and zeros out any
already scored events.
KbQueueRelease()
Releases queue-associated resources; once called, KbQueueCreate
must be invoked before using any of the other routines
This routine is called automatically at clean-up (e.g., when
'clear mex' is invoked and can be omitted expense of keeping
memory allocated and an additional thread running unnecesarily
Note that any keyboard typing used to invoke KbQueue commands will be
recorded. This would include the release of the carriage return used
to execute KbQueueStart and the keys pressed and released to invoke
KbQueueCheck
----
See also: KbQueueCreate, KbQueueStart, KbQueueStop, KbQueueCheck,
KbQueueWait, KbQueueFlush, KbQueueRelease
""
<div class="code_header" style="text-align:right;">
<span style="float:left;">Path </span> <span class="counter">Retrieve current version of KbQueueCreate.m from berliOS: <a href=
"http://svn.berlios.de/svnroot/repos/osxptb/beta/Psychtoolbox/PsychBasic/KbQueueCreate.m">beta</a> | view WebSVN <a href=
"http://svn.berlios.de/wsvn/osxptb/trunk/Psychtoolbox/PsychBasic/KbQueueCreate.m?op=log">changelog</a> of trunk branch</span>
</div>
<div class="code">
<code>Psychtoolbox/PsychBasic/KbQueueCreate.m</code>
</div>
""
Deletions:
Requires Mac OS X 10.3 or later
Additions:
"http://svn.berlios.de/svnroot/repos/osxptb/beta/Psychtoolbox/PsychBasic/KbQueueCreate.m">beta</a> | view WebSVN <a href=
"http://svn.berlios.de/wsvn/osxptb/trunk/Psychtoolbox/PsychBasic/KbQueueCreate.m?op=log">changelog</a> of trunk branch</span>
Deletions:
"http://svn.berlios.de/svnroot/repos/osxptb/beta/Psychtoolbox/PsychBasic/KbQueueCreate.m">beta</a> | view in <a href=
"http://svn.berlios.de/wsvn/osxptb/beta/Psychtoolbox/PsychBasic/KbQueueCreate.m?view=markup">WebSVN with changelog</a></span>
Additions:
"http://svn.berlios.de/wsvn/osxptb/beta/Psychtoolbox/PsychBasic/KbQueueCreate.m?view=markup">WebSVN with changelog</a></span>
Deletions:
"http://svn.berlios.de/viewcvs/osxptb/beta/Psychtoolbox/PsychBasic/KbQueueCreate.m?view=markup">WebSVN with changelog</a></span>
Additions:
are reliably detected
only the times of the first and last presses and releases of that
key can be recovered (this has no effect on other keys)
theoretically possible for the queue to fill more quickly than
it can be emptied, losing key events temporarily while filled to
capacity. The queue holds up to thirty events, and events are
constantly being removed from the queue and processed, so this is
unlikely to be a problem in actual use.
KbQueueCreate([deviceNumber][, keyList])
If the device number is less than zero, the default device is used.
with each element corresponding to a particular key (use KbName
to map between keys and their positions). If the double value
corresponding to a particular key is zero, events for that key
are not added to the queue and will not be reported.
KbQueueWait is called.
queue.
the queue.
recovered by KbQueueCheck
most recent call to this routine, KbQueueStart, KbQueuWait
processsed may remain in the queue
pressed since the most recent call to KbQueueCheck or KbQueueStart
released since the most recent call to KbQueueCheck or KbQueueStart
pressed since the most recent call to KbQueueCheck or KbQueueStart
was released since the most recent call to KbQueueCheck or
KbQueueStart
ptb_kbcheck_disabledKeys (see "help DisableKeysForKbCheck"), will
must be invoked before using any of the other routines
'clear mex' is invoked and can be omitted expense of keeping
memory allocated and an additional thread running unnecesarily
KbQueueWait, KbQueueFlush, KbQueueRelease
Deletions:
are reliably detected
only the times of the first and last presses and releases of that
key can be recovered (this has no effect on other keys)
theoretically possible for the queue to fill more quickly than
it can be emptied, losing key events temporarily while filled to
capacity. The queue holds up to thirty events, and events are
constantly being removed from the queue and processed, so this is
unlikely to be a problem in actual use.
KbQueueCreate([deviceNumber, keyList])
If the device number is less than zero, the default device is used.
with each element corresponding to a particular key (use KbName
to map between keys and their positions). If the double value
corresponding to a particular key is zero, events for that key
are not added to the queue and will not be reported.
KbQueueWait is called.
queue.
the queue.
recovered by KbQueueCheck
most recent call to this routine, KbQueueStart, KbQueuWait
processsed may remain in the queue
pressed since the most recent call to KbQueueCheck or KbQueueStart
released since the most recent call to KbQueueCheck or KbQueueStart
pressed since the most recent call to KbQueueCheck or KbQueueStart
was released since the most recent call to KbQueueCheck or
KbQueueStart
ptb_kbcheck_disabledKeys (see "help DisableKeysForKbCheck"), will
must be invoked before using any of the other routines
'clear mex' is invoked and can be omitted expense of keeping
memory allocated and an additional thread running unnecesarily
KbQueueWait, KbQueueFlush, KbQueueRelease
Additions:
""
<div class="code_header" style="text-align:right;">
<span style="float:left;">Path </span> <span class="counter">Retrieve current version of KbQueueCreate.m from berliOS: <a href=
"http://svn.berlios.de/svnroot/repos/osxptb/beta/Psychtoolbox/PsychBasic/KbQueueCreate.m">beta</a> | view in <a href=
"http://svn.berlios.de/viewcvs/osxptb/beta/Psychtoolbox/PsychBasic/KbQueueCreate.m?view=markup">WebSVN with changelog</a></span>
</div>
<div class="code">
<code>Psychtoolbox/PsychBasic/KbQueueCreate.m</code>
</div>
""
Deletions:
%%(php;Path)Psychtoolbox/PsychBasic/KbQueueCreate.m%%
Additions:
==[[Psychtoolbox]] › [[PsychBasic]]==
are reliably detected
only the times of the first and last presses and releases of that
key can be recovered (this has no effect on other keys)
theoretically possible for the queue to fill more quickly than
it can be emptied, losing key events temporarily while filled to
capacity. The queue holds up to thirty events, and events are
constantly being removed from the queue and processed, so this is
unlikely to be a problem in actual use.
If the device number is less than zero, the default device is used.
with each element corresponding to a particular key (use KbName
to map between keys and their positions). If the double value
corresponding to a particular key is zero, events for that key
are not added to the queue and will not be reported.
KbQueueWait is called.
queue.
the queue.
recovered by KbQueueCheck
most recent call to this routine, KbQueueStart, KbQueuWait
processsed may remain in the queue
pressed since the most recent call to KbQueueCheck or KbQueueStart
released since the most recent call to KbQueueCheck or KbQueueStart
pressed since the most recent call to KbQueueCheck or KbQueueStart
was released since the most recent call to KbQueueCheck or
KbQueueStart
ptb_kbcheck_disabledKeys (see "help DisableKeysForKbCheck"), will
must be invoked before using any of the other routines
'clear mex' is invoked and can be omitted expense of keeping
memory allocated and an additional thread running unnecesarily
KbQueueWait, KbQueueFlush, KbQueueRelease
Deletions:
==[[Psychtoolbox]] › PsychBasic==
are reliably detected
only the times of the first and last presses and releases of that
key can be recovered (this has no effect on other keys)
theoretically possible for the queue to fill more quickly than
it can be emptied, losing key events temporarily while filled to
capacity. The queue holds up to thirty events, and events are
constantly being removed from the queue and processed, so this is
unlikely to be a problem in actual use.
If the device number is less than zero, the default device is used.
with each element corresponding to a particular key (use KbName
to map between keys and their positions). If the double value
corresponding to a particular key is zero, events for that key
are not added to the queue and will not be reported.
KbQueueWait is called.
queue.
the queue.
recovered by KbQueueCheck
most recent call to this routine, KbQueueStart, KbQueuWait
processsed may remain in the queue
pressed since the most recent call to KbQueueCheck or KbQueueStart
released since the most recent call to KbQueueCheck or KbQueueStart
pressed since the most recent call to KbQueueCheck or KbQueueStart
was released since the most recent call to KbQueueCheck or
KbQueueStart
ptb_kbcheck_disabledKeys (see "help DisableKeysForKbCheck"), will
must be invoked before using any of the other routines
'clear mex' is invoked and can be omitted expense of keeping
memory allocated and an additional thread running unnecesarily
KbQueueWait, KbQueueFlush, KbQueueRelease
Additions:
ptb_kbcheck_disabledKeys (see "help DisableKeysForKbCheck"), will
Deletions:
ptb_kbcheck_disabledKeys (see "help DisableKeysForKbCheck"), will
Additions:
==[[Psychtoolbox]] › PsychBasic==
Requires Mac OS X 10.3 or later
The routines KbQueueCreate, KbQueueStart, KbQueueStop, KbQueueCheck
KbQueueWait, KbQueueFlush and KbQueueRelease provide replacments for
KbCheck and KbWait, providing the following advantages:
1) Brief key presses that would be missed by KbCheck or KbWait
are reliably detected
2) The times of key presses are recorded more accurately
3) The times of key releases are also recorded
=== Limitations: ===
1) If a key is pressed multiple times before KbQueueCheck is called,
only the times of the first and last presses and releases of that
key can be recovered (this has no effect on other keys)
2) If many keys are pressed very quickly in succession, it is at least
theoretically possible for the queue to fill more quickly than
it can be emptied, losing key events temporarily while filled to
capacity. The queue holds up to thirty events, and events are
constantly being removed from the queue and processed, so this is
unlikely to be a problem in actual use.
Only a single device can be monitored at any given time. The deviceNumber can
be specified only in the call to KbQueueCreate. The other routines then
relate to that specified device. If deviceNumber is not specified, the first
device is the default (like KbCheck). If KbQueueCreate has not been called
first, the other routines will generate an error message. Likewise, if
KbQueueRelease has been called more recently than KbQueueCreate, the other
routines will generate error messages.
It is acceptable to call KbQueueCreate at any time (e.g., to switch to a new
device or to change the list of queued keys) without calling KbQueueRelease.
KbQueueCreate([deviceNumber, keyList])
Creates the queue for the specified (or default) device number
If the device number is less than zero, the default device is used.
keyList is an optional 256-length vector of doubles (not logicals)
with each element corresponding to a particular key (use KbName
to map between keys and their positions). If the double value
corresponding to a particular key is zero, events for that key
are not added to the queue and will not be reported.
No events are delivered to the queue until KbQueueStart or
KbQueueWait is called.
KbQueueCreate can be called again at any time
KbQueueStart()
Starts delivering keyboard events from the specified device to the
queue.
KbQueueStop()
Stops delivery of new keyboard events from the specified device to
the queue.
Data regarding events already queued is not cleared and can be
recovered by KbQueueCheck
[pressed, firstPress, firstRelease, lastPress, lastRelease]=
KbQueueCheck()
Obtains data about keypresses on the specified device since the
most recent call to this routine, KbQueueStart, KbQueuWait
Clears all scored events, but unscored events that are still being
processsed may remain in the queue
pressed: a boolean indicating whether a key has been pressed
firstPress: an array indicating the time that each key was first
pressed since the most recent call to KbQueueCheck or KbQueueStart
firstRelease: an array indicating the time that each key was first
released since the most recent call to KbQueueCheck or KbQueueStart
lastPress: an array indicating the most recent time that each key was
pressed since the most recent call to KbQueueCheck or KbQueueStart
lastRelease: an array indicating the most recent time that each key
was released since the most recent call to KbQueueCheck or
KbQueueStart
For firstPress, firstRelease, lastPress and lastRelease, a time value
of zero indicates that no event for the corresponding key was
detected since the most recent call to KbQueueCheck or KbQueueStart
To identify specific keys, use KbName (e.g., KbName(firstPress)) to
generate a list of the keys for which the events occurred
For compatibility with KbCheck, any key codes stored in
ptb_kbcheck_disabledKeys (see "help DisableKeysForKbCheck"), will
not caused pressed to return as true and will be zeroed out in the
returned arrays. However, a better alternative is to specify a
keyList arguement to KbQueueCreate.
secs=KbQueueWait()
Waits for any key to be pressed and returns the time of the press
KbQueueFlush should be called immediately prior to this function
(unless the queue has just been created and started) to clear any
prior events.
Note that this command will not respond to any keys that were
inactivated by using the keyList argument to KbQueueCreate.
Since KbQueueWait is implemented as a looping call to
KbQueueCheck, it will not respond to any key codes stored in
the global variable ptb_kbcheck_disabledKeys
(see "help DisableKeysForKbCheck")
KbQueueFlush()
Removes all unprocessed events from the queue and zeros out any
already scored events.
KbQueueRelease()
Releases queue-associated resources; once called, KbQueueCreate
must be invoked before using any of the other routines
This routine is called automatically at clean-up (e.g., when
'clear mex' is invoked and can be omitted expense of keeping
memory allocated and an additional thread running unnecesarily
Note that any keyboard typing used to invoke KbQueue commands will be
recorded. This would include the release of the carriage return used
to execute KbQueueStart and the keys pressed and released to invoke
KbQueueCheck
----
See also: KbQueueCreate, KbQueueStart, KbQueueStop, KbQueueCheck,
KbQueueWait, KbQueueFlush, KbQueueRelease
%%(php;Path)Psychtoolbox/PsychBasic/KbQueueCreate.m%%
Deletions:
==PtbReference › PsychBasic==
KbQueueCreate([deviceNumber, keyList])
Requires Mac OS X 10.3 or later
The routines KbQueueCreate, KbQueueStart, KbQueueStop, KbQueueCheck
KbQueueWait, KbQueueFlush and KbQueueRelease provide replacments for
KbCheck and KbWait, providing the following advantages:
1) Brief key presses that would be missed by KbCheck or KbWait
are reliably detected
2) The times of key presses are recorded more accurately
3) The times of key releases are also recorded
Limitations:
1) If a key is pressed multiple times before KbQueueCheck is called,
only the times of the first and last presses and releases of that
key can be recovered (this has no effect on other keys)
2) If many keys are pressed very quickly in succession, it is at least
theoretically possible for the queue to fill more quickly than
it can be emptied, losing key events temporarily while filled to
capacity. The queue holds up to thirty events, and events are
constantly being removed from the queue and processed, so this is
unlikely to be a problem in actual use.
Only a single device can be monitored at any given time. The deviceNumber can
be specified only in the call to KbQueueCreate. The other routines then
relate to that specified device. If deviceNumber is not specified, the first
device is the default (like KbCheck). If KbQueueCreate has not been called
first, the other routines will generate an error message. Likewise, if
KbQueueRelease has been called more recently than KbQueueCreate, the other
routines will generate error messages.
It is acceptable to call KbQueueCreate at any time (e.g., to switch to a new
device or to change the list of queued keys) without calling KbQueueRelease.
Creates the queue for the specified (or default) device number
If the device number is less than zero, the default device is used.
keyList is an optional 256-length vector of doubles (not logicals)
with each element corresponding to a particular key (use KbName
to map between keys and their positions). If the double value
corresponding to a particular key is zero, events for that key
are not added to the queue and will not be reported.
No events are delivered to the queue until KbQueueStart or
KbQueueWait is called.
KbQueueCreate can be called again at any time
KbQueueStart()
Starts delivering keyboard events from the specified device to the
queue.
KbQueueStop()
Stops delivery of new keyboard events from the specified device to
the queue.
Data regarding events already queued is not cleared and can be
recovered by KbQueueCheck
[pressed, firstPress, firstRelease, lastPress, lastRelease]=
KbQueueCheck()
Obtains data about keypresses on the specified device since the
most recent call to this routine, KbQueueStart, KbQueuWait
Clears all scored events, but unscored events that are still being
processsed may remain in the queue
pressed: a boolean indicating whether a key has been pressed
firstPress: an array indicating the time that each key was first
pressed since the most recent call to KbQueueCheck or KbQueueStart
firstRelease: an array indicating the time that each key was first
released since the most recent call to KbQueueCheck or KbQueueStart
lastPress: an array indicating the most recent time that each key was
pressed since the most recent call to KbQueueCheck or KbQueueStart
lastRelease: an array indicating the most recent time that each key
was released since the most recent call to KbQueueCheck or
KbQueueStart
For firstPress, firstRelease, lastPress and lastRelease, a time value
of zero indicates that no event for the corresponding key was
detected since the most recent call to KbQueueCheck or KbQueueStart
To identify specific keys, use KbName (e.g., KbName(firstPress)) to
generate a list of the keys for which the events occurred
For compatibility with KbCheck, any key codes stored in
ptb_kbcheck_disabledKeys (see "help DisableKeysForKbCheck"), will
not caused pressed to return as true and will be zeroed out in the
returned arrays. However, a better alternative is to specify a
keyList arguement to KbQueueCreate.
secs=KbQueueWait()
Waits for any key to be pressed and returns the time of the press
KbQueueFlush should be called immediately prior to this function
(unless the queue has just been created and started) to clear any
prior events.
Note that this command will not respond to any keys that were
inactivated by using the keyList argument to KbQueueCreate.
Since KbQueueWait is implemented as a looping call to
KbQueueCheck, it will not respond to any key codes stored in
the global variable ptb_kbcheck_disabledKeys
(see "help DisableKeysForKbCheck")
KbQueueFlush()
Removes all unprocessed events from the queue and zeros out any
already scored events.
KbQueueRelease()
Releases queue-associated resources; once called, KbQueueCreate
must be invoked before using any of the other routines
This routine is called automatically at clean-up (e.g., when
'clear mex' is invoked and can be omitted expense of keeping
memory allocated and an additional thread running unnecesarily
Note that any keyboard typing used to invoke KbQueue commands will be
recorded. This would include the release of the carriage return used
to execute KbQueueStart and the keys pressed and released to invoke
KbQueueCheck
_________________________________________________________________________
See also: KbQueueCreate, KbQueueStart, KbQueueStop, KbQueueCheck,
KbQueueWait, KbQueueFlush, KbQueueRelease
PsychBasic
Additions:
===[[KbQueueCreate]]===
==PtbReference › PsychBasic==
Deletions:
===PsychBasic===