AsyncFlipTest: Bugfix for OS/X with flat panels.

Used to skip 2nd part due to nominal framerate
reported by OS as zero on flat panels. Fixed.



git-svn-id: https://psychtoolbox-3.googlecode.com/svn/trunk@2492 f5efbe48-b203-0410-9429-fc5e098e5a54
PlayMoviesDemoOSX: Refinements.



git-svn-id: https://psychtoolbox-3.googlecode.com/svn/trunk@2493 f5efbe48-b203-0410-9429-fc5e098e5a54
Make GetMouseWheel and GetMouseIndices sort-of work on Windows.

At least we can enumerate mice and keyboards now
with the updated PsychHID driver, although still
not access them -- that is a system limitation of
the Microsoft OS.



git-svn-id: https://psychtoolbox-3.googlecode.com/svn/trunk@2494 f5efbe48-b203-0410-9429-fc5e098e5a54
PsychHID/Windows: Rebuilt against latest HIDAPI.

Now can enumerate HID mice and keyboards etc.



git-svn-id: https://psychtoolbox-3.googlecode.com/svn/trunk@2495 f5efbe48-b203-0410-9429-fc5e098e5a54
Screen: Cleanup of priority setup code.

- Remove dead code from async open path of 'OpenMovie'.
- Unify thread priority setup code of async flipper thread /
  frame sequential stereo thread between all OSes. Indeed,
  OS/X does not need different treatment.

-> Tested on OS/X and Windows. All threading and priority
   changes are so far "well received", also no known regressions
   in the QT movie playback path for OS/X or Windows.



git-svn-id: https://psychtoolbox-3.googlecode.com/svn/trunk@2496 f5efbe48-b203-0410-9429-fc5e098e5a54
Screen for Windows Octave + Matlab R2007a rebuilt.

No known regressions in the Windows pathways.



git-svn-id: https://psychtoolbox-3.googlecode.com/svn/trunk@2497 f5efbe48-b203-0410-9429-fc5e098e5a54
Screen: Lower sched priority for background movie load to 1 on Windows.

A level of 2 as on the other os'es is just too much.

-> Screen for R2007a an Windows rebuilt, Octave pending.



git-svn-id: https://psychtoolbox-3.googlecode.com/svn/trunk@2498 f5efbe48-b203-0410-9429-fc5e098e5a54
PsychHID: Handle mouse, gamepad, joystick and other button devices as well.

* The KbCheck, KbTriggerWait and KbQueueXXX functions can treat any HID
  device which has keys or buttons as if it were some sort of keyboard.

  This allows, e.g., to use KbQueueCheck on a mouse, timestamping and all
  the bling, to treat it as a mini-keyboard or response-box if timing
  precision is not super-critical.

-> Implemented in core code and OS/X specific part, help texts updated.
-> PsychHID for OS/X Intel Octave & Matlab rebuilt & tested.

* KeyboardLatencyTest: Documentation cleanup, more flexible, take advantage
  of the above new functionality.



git-svn-id: https://psychtoolbox-3.googlecode.com/svn/trunk@2499 f5efbe48-b203-0410-9429-fc5e098e5a54
PsychHID Linux/Windows: Make timestamps for KbTriggerWait more precise.

Instead of just taking a GetSecs() timestamp when finding the first
key pressed, check all pressed keys and return the timestamp of the
key that was really pressed first, ie., the minimum over all timestamps.

-> Recompile pending.
-> Additional dead-code removal in Windows code.



git-svn-id: https://psychtoolbox-3.googlecode.com/svn/trunk@2500 f5efbe48-b203-0410-9429-fc5e098e5a54
New demo: Background recording of timestamped triggers over serial port

ReceivingTriggerFromSerialPortDemo() is just a stripped down and
adapted version of RecordingDataFromSerialPortDemo, modified for
simple reception and timestamping of 1 Byte triggers over serial
port -- a common task for fMRI, TMS, MEG, EEG people.



git-svn-id: https://psychtoolbox-3.googlecode.com/svn/trunk@2501 f5efbe48-b203-0410-9429-fc5e098e5a54
OS/X: Improvements to setup of realtime-scheduling.

On OS/X, the realtime scheduling setup code was largely rewritten
to use native Mach calls to control scheduling of OS/X threads,
instead of using the standard Posix pthread-functions.

Reason: The "think different" company thought different here as
well, and didn't implement Posix threads the way any other sane
os vendor would implement their scheduling.

Anyway, our setup code was suboptimal, now it is presumably
more optimal. We'll see...

* PsychSetThreadPriority() rewritten to use Mach setup:

  Priorityclass 0: Normal scheduling at default timesharing prio.

  Priorityclass 1: High priority scheduling, where the 'tweakPriority'
  parameter controls the number of msecs in each 10 msec timeslice
  that a thread wants to run -- and promises not too exceed. Runtime
  is provided within a 10 msec timeslice and the thread can get
  preempted multiple times during that time.

  Priorityclass 2: Like 1, but the thread can not be interrupted,
  once it starts executing its quantum. Start of execution can
  be delayed by the scheduler up to 1 msec if it see's fit.

  Priorityclass 10: Like 1, but execution must happen with lowest
  possible latency.

  The comments in the code show typical use-cases and settings for
  the different priority classes.

* PsychSetRealtime() routine for display refresh calibration,
  async Screen() flipperthread / frame-seq stereo thread,
  background movie loading thread in Screen optimized for
  setup with new scheduling. Works.

* IOPort: Background reader thread adapted to new strategy.

* PsychHID: KbQueue thread adapted to take advantage.

=> Screen, PsychHID, IOPort for OS/X IntelMac Octave & Matlab
   rebuilt and tested.



git-svn-id: https://psychtoolbox-3.googlecode.com/svn/trunk@2502 f5efbe48-b203-0410-9429-fc5e098e5a54
PsychHID/Windows: Add "Keyboard" support for mouse and joystick.

Works. Screen and PsychHID for Octave and R2007a on Windows
rebuilt and tested with keyboard, mouse and joystick.



git-svn-id: https://psychtoolbox-3.googlecode.com/svn/trunk@2503 f5efbe48-b203-0410-9429-fc5e098e5a54
Screen, IOPort, PsychHID for OSX PowerPC rebuilt.



git-svn-id: https://psychtoolbox-3.googlecode.com/svn/trunk@2504 f5efbe48-b203-0410-9429-fc5e098e5a54
Fixed alphabetization.  Added T_ground and a note that we don't know what this is.

git-svn-id: https://psychtoolbox-3.googlecode.com/svn/trunk@2505 f5efbe48-b203-0410-9429-fc5e098e5a54
EyelinkInit: Make help text consistent with actual behaviour.

git-svn-id: https://psychtoolbox-3.googlecode.com/svn/trunk@2506 f5efbe48-b203-0410-9429-fc5e098e5a54
Screen/Linux: Fix +1 offset of mouse buttons in GetMouse.

For some weird reason, mouse button 1 mapped to position 2,
2 to 3, and so on. Tested on Ubuntu 10.10, 11.10 with 2 different
mice and one Joystick.

-> Apply corrective offset to fix this.

git-svn-id: https://psychtoolbox-3.googlecode.com/svn/trunk@2507 f5efbe48-b203-0410-9429-fc5e098e5a54
PsychHID/Linux: Add support for KbCheck/KbQueueCheck/KbTriggerWait on non-keyboards.

Support query of mouse-, joystick-, gamepad-, ... buttons as if they
were keys on a keyboard. This is the Linux specific implementation.

Improve error handling as well + some code cleanup.

Tested on Ubuntu 11.10. Ubuntu 10.10 does not allow multi-mouse
queries or multi-keyboard queries btw.

git-svn-id: https://psychtoolbox-3.googlecode.com/svn/trunk@2508 f5efbe48-b203-0410-9429-fc5e098e5a54
PsychPortAudio: Use RunMode 1 by default, instead of RunMode zero.

This means that when playback/capture is "stopped", we don't
actually stop it, but keep the hardware and engine running in
a logically stopped state, where it just outputs zero samples
on playback, and does not store captured data in recording mode.

This can reduce startup latency at a slightly increased cpu
load. In the past we used runmode 0 and usercode had to opt-in,
now we use runmode 1 and usercode has to opt-out.

Rationale: The increase in cpu load is minimal (a fraction of a
percent), but timing precision gain can be high, and most users
would not opt-into this useful setting, because they don't read
manuals.

git-svn-id: https://psychtoolbox-3.googlecode.com/svn/trunk@2509 f5efbe48-b203-0410-9429-fc5e098e5a54
Linux: Only use mutexes with priority inheritance.

PsychInitMutex() now creates all mutex locks with the
priority inheritance protocol enabled. This protects
against priority inversion when multiple realtime threads
compete for a contended lock.

I think at least post 2007 Linux distributions should
support this afaik. At least 2010 distros do support it,
that is recent enough for our purpose.

git-svn-id: https://psychtoolbox-3.googlecode.com/svn/trunk@2510 f5efbe48-b203-0410-9429-fc5e098e5a54
Linux: All relevant mex files for 32-Bit Octave & Matlab on Linux rebuilt.

git-svn-id: https://psychtoolbox-3.googlecode.com/svn/trunk@2511 f5efbe48-b203-0410-9429-fc5e098e5a54