Wiki

Clone wiki

StimServer / StimFunctionSyntax

How to write a stimulus presentation function

Each stimulus of a given type is accessed by the server using a "Present..." function. A "Present..." function is responsible for generating (perhaps caching) and drawing a stimulus on the screen. The functions MUST have a consistent calling argument structure, as required for a stimulus structure.

A "Present..." function is called like so:

% Usage: [tLastPresentation, bBlewBlankTime, bBlewFrameRate] = ...
%           Present...(hWindow, vtBlankTime, tFrameDuration, ...
%                       <presentation params list>, ...
%                       <stimulus arguments list>);

For example, the function PresentOscillatingPlaidStimulus has the syntax

[tLastPresentation, bBlewBlankTime, bBlewFrameRate] = ...
            PresentOscillatingPlaidStimulus( hWindow, tBlankTime, tFrameDuration, ...
                                             tStimulusDuration, ...
                                             vfSizeDegrees, fCyclesPerDegree, fPixelsPerDegree,
                                             fAngle1Degrees, fAngle2Degrees, ...
                                             fBarWidthDegrees)

In this case, the <presentation params list> is only "tStimulusDuration". The <stimulus arguments list> consists of all the following arguments.

The conceptual difference between the two arguments lists is that <stimulus arguments> contains parameters that affect the generation of the stimulus; <presentation params> only affect the presentation itself, and are not required to generate the stimulus. These two types of parameters are separately specifiable and changable using the UDP communications command for presenting a stimulus. They are also separately specifiable in advance when configuring the stimuli for a session.

Updated