[sample_bin, quit] = drawFunc_movieLine(window, resp_input_vec, draw_args, trial_bin, sample_bin)
DRAWFUNC_MOVIELINE is an advanced draw_func that illustrates both movie playback using easyScale as well as how one draw_func can be embedded within another one. Here, a movie is displayed, along with a line plot in the bottom-right showing the recent response input history. When an event takes place (input threshold exceeded based on recent responses), then the movie is temporarily disabled and static is played back to the user. For purposes of illustration, the input is simply the mouse cursor, but in our lab we use this with a motion sensor attached to a headband to train the user to keep still.
The current draw_func takes the standard form required by easyScale. The parameters supplied to this function via easyScale are as follows: window: token for the window where the bar plot should be drawn. resp_input_vec: timeseries object with recent history of input (with arbitrary dimensionality of [n m], where n is any number of samples and m is any number of dimensions. The samples n(1) to n(end) will be drawn left to right on the line plot. draw_args: parameters set by the calling experiment used to control the behaviour of this draw_func and that of the line plot. Args 1-10 are as documented in linePlotDrawFunc. Argument 11 is as follows: 11: noise player: an audioplayer object is needed to play and control the static noise in this function. Because each call to this draw_func consists of only a single frame, the audiorecorder is handled at a higher level, by the experiment script. trial_bin: the trial_bin is a cell array containing trial-specific information. DRAWFUNC_MOVIELINE uses the following element positions: 1: movie_data: the result of an OpenMovie call to screen. 2: movie_title: a string to be drawn that labels the current movie. 3: movie_subtitle: a string to be drawn below the title. 4: motion_thresh: the value that, when exceeded by resp_input_vec input values, triggers static playback. 5: penalty_time: the amount of time for static to play after threshold has been breached. 6: plot_on: a boolean that, when true, displays a line plot showing the recent input to be shown at bottom-right; when false, this is hidden. sample_bin: the sample_bin is a two-element cell array containing sample-specific information. By convention, the first element is written to by input_funcs and the second written to by draw_funcs. DRAWFUNC_MOVIELINE writes information about the currently playing movie as well as its dimensions to the second element. DRAWFUNC_MOVIELINE returns sample_bin and quit parameters to easyScale. The quit parameter is important to observe, as it communicates information to higher-level functions about when the movie has finished playing - failing to observe this signal may cause the experiment to crash.
For example usage of DRAWFUNC_MOVIELINE, please see demoEasyScale_movie.