Merge pull request #37 from Psychtoolbox-3/master

Resync with current master of official Psychtoolbox-3 repo.
Screen/OSX: Down allow closing of kPsychGUIWindows by user.

Disable the window close button, as clicking it would crash the
scripting environment at next access after window close.
-> Screen for Octave and Matlab on OSX rebuilt and tested.
Screen/Windows: Allow activation of GUI windows via mouse click.

kPsychGUIWindow's return MA_ACTIVATEANDEAT in response to mouse
activation events, as opposed to MA_NOACTIVATEANDEAT for other windows.

-> Clicking an inactive GUI window will activate it.
-> Also apply minor fix to DWM timestamping in the rare cases where it can
   be used and doesn't work, e.g., compositor active on a single display,
   single onscreen window setup (where it can be used), but inside a Windows-7
   VM, where it fails with invalid values on VirtualBox. We double-check timestamp
   for validity and return a failure code on invalid timestamp, so fallback path
   can be used.
-> Various dead code removal.

-> Screen for 32/64-Bit Matlab on Windows rebuilt and tested.

Fixes #156
Merge pull request #160 from kleinerm/master

Pull from kleinerm for PTB BETA RELEASE "Blue skies and empty brains" - SP3
* GUI window mode fixes for OSX and MS-Windows.
Screen/Windows: Change load order for gstreamer dll's.

When trying ot runtime LoadLibrary() GStreamer dll's, try GStreamer-SDK
dll's before the old OSSBuilds runtime dll's.
This is in preparation of switch to GStreamer SDK for 32-Bit Matlab on
Windows.
-> Screen for 32/64-Bit Matlab on Windows rebuilt and tested. Works as
expected.
iViewXComm: Add subfunction 'receivelast'.

Allows to fetch the most recent eyetracker data packet, e.g.,
if a queue of pending packets has built up, but we're interested
in live data.

See mesg #16300 and earlier for the reason. This solution is not
the greatest yet. Might be a good idea to switch the receive code
in this function to non-blocking operation (polling). Current blocking
operation can introduce a delay of ~0.5 msecs on Linux/OSX and ~1 msec
on Windows. This should be still ok'ish on Linux and OSX, but on Windows,
1 msec timeout will cause maximum sampling rate to drop below 1000 Hz,
which can be troublesome with the latest iView eyetrackers that can do
> 1000 Hz tracking.
Screen('WaitBlanking'): Small fix for PsychOSGetVBLTimeAndCount() fallback.

This path didn't update tvbl and time of last vbl, so returned wrong
'framesSincelastWait' return value and baseline.

Not crucial, as this function is seldomly used, and the specific
fallback path normally not executed in the first place.

-> No rebuild of mex files. Fold it into next regular Screen() rebuild.
Screen: NULL-out texture memory pointer received from GStreamer early.

NULL-out the reference to GStreamer owned and memory-managed video
memory buffer immediately after PsychCreateTexture() was used to create
an OpenGL texture from it. This is not really needed, as
PsychCreateTexture() does this already after texture creation if
clientstorage is not enabled, ie., always by default. We add this
explicit redundant NULL assignment as an annotation to the code, to
simplify correctness review of the code wrt. memory management somewhat.

-> Screen.mexw64 for 64-Bit Matlab on Windows rebuilt and tested.
Fix a few glitches in printout, mostly fixing case statement options.

Signed-off-by: David Brainard <brainard@psych.upenn.edu>
Comment clean up.

Signed-off-by: David Brainard <brainard@psych.upenn.edu>
Comment clean up.

Signed-off-by: David Brainard <brainard@psych.upenn.edu>
Renamed to match the transition of vset -> isetbio.

Signed-off-by: David Brainard <brainard@psych.upenn.edu>
Added comment about where isetbio lives on gitHub.

Signed-off-by: David Brainard <brainard@psych.upenn.edu>
Added many more checks for consistency in the routines that compute photoreceptor parameters.

It is now harder to do something stupid, such as specify a nomogram for absorbance and then pass absorbance directly, thus ignoring the nomogram that you specified.

And, the returned structure is more informative about what was computed and what was supplied.

I checked that none of these changes break test routines within the PTB.   But if you were cleverly overriding values set by DefaultPhotoreceptors, you may now need to explictly set some sources to 'None' or some values to the empty matrix.  The error messages should be moderately informative about how to go about this, and there are some examples of this being done in CIEConeFundamentalsTest (where such changes were made.)

Signed-off-by: David Brainard <brainard@psych.upenn.edu>
New demo for simple use of sound schedules: SimpleSoundScheduleDemo.
Tightening up cone fundamental generation code

Added options to DefaultPhotoreceptors that will produce the CIE (aka Stockman-Sharpe) 2 and 10 degree fundamentals.

Added a lot of comments about relation between various routines that do similar things.

Added check that FillInPhotoreceptors and ComputeRawConeFundamentals are consistent with one another, and added extra return args to ComputeCIEConeFundamentals and ComputeRawConeFundamentals to allow access to unnormalized quantal sensitivity functions.

Added other miscellaneous comments.

Signed-off-by: David Brainard <brainard@psych.upenn.edu>
Continuing to clean up and extend isomerization calcs.

Most of this effort is just checks and commenting.  It is possible that some of the checks will break calling code that was a little sloppy.  I believe I've fixed up all such cases within the PTB.

Added AbsorbtanceToAbsorbance, from the Stanford group.

The isomerization calcs now more cleanly incorporate the CIE standard cone fundamentals (that is, you can get them from DefaultPhotoreceptors).

Signed-off-by: David Brainard <brainard@psych.upenn.edu>
Added little utility to find color matching function peak wavelengths and values.

Used in PrintPhotoreceptors.

Signed-off-by: David Brainard <brainard@psych.upenn.edu>
Cleaned up PrintPhotoreceptors some, and little bit of small bug swatting in FillInPhotoreceptors and DefaultPhotoreceptors.

Verified that the main unit tests that use this stuff still run OK.
  IsomerizationsInEyeDemo
  IsomerizationsInDishDemo
  CIEConeFundamentalsTest
  FitConeFundamentalsTest

Signed-off-by: David Brainard <brainard@psych.upenn.edu>
Screen: Allow disabling of filter-caps during GStreamer video capture.

By default we set the colorcaps used on our appsink also as filter-caps
for the video source during videocapture. This has the purpose of
trying to force the video source to already output data in a format
suitable for consumption by us, thereby avoiding costly colorspace and
image format conversions.

With some cameras this can cause "negotiation failure" and thereby
failure to open the capture device. A new optionsl 'recordingflags'
value 4096 (2^12) allows to avoid setting filter-caps or their
camerabin2 equivalent, so that problematic capture devices can operate
at their preferred output image format and a colorspace conversion
takes place to convert to our required format. More inefficient, but at
least should work.

-> Screen for OSX and Windows rebuilt and tested a bit on OSX with
camerabin2.
-> Real test, e.g., with VRMagic cams under Windows by Marieke pending.