# Executing functions while playing movies

**URL:** <https://psychtoolbox.discourse.group/t/executing-functions-while-playing-movies/1080>\
**Category:** Uncategorized\
**Created:** [May 29, 2002, 11:10pm UTC](https://psychtoolbox.discourse.group/t/executing-functions-while-playing-movies/1080 "2002-05-29T23:10:11Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Allen\_Ingling](https://avatars.discourse-cdn.com/v4/letter/a/a183cd/32.png) [@Allen\_Ingling](https://psychtoolbox.discourse.group/u/Allen_Ingling)\
**Post date:** [May 29, 2002, 11:10pm UTC](https://psychtoolbox.discourse.group/t/executing-functions-while-playing-movies/1080/1 "2002-05-29T23:10:11Z")

</div>

I am a new MatLab programmer attempting to write a   
psychophysical test program. During this test, I have included   
animations to acknowledge user response. I initially used the   
SCREEN functions for animation and have started exploring the   
use of QT movies as another option.   
  
Aside from providing feedback, I was hoping to use the   
animation as a pause in the program where I could execute a   
very time demanding function that, if put elsewhere, slows the   
trial process significantly. However, neither the SCREEN nor QT   
animation options seem to provide this background execution.  
  
Ideally I want the animation to proceed in the same way that the   
SND function does, returning immediately to allow for the   
continuation of the program while the sound is still being played.   
If this is possible in any format I would greatly apprecitate the   
assistance,  
  
Thanks in advance,  
  
Craig Chapman

---

<div class="post-metadata">

**Author:** ![denispelli](https://avatars.discourse-cdn.com/v4/letter/d/cdc98d/32.png) [@denispelli](https://psychtoolbox.discourse.group/u/denispelli)\
**Post date:** [May 30, 2002, 1:23am UTC](https://psychtoolbox.discourse.group/t/executing-functions-while-playing-movies/1080/2 "2002-05-30T01:23:54Z")

</div>

> \>I am a new MatLab programmer attempting to write a  
> \>psychophysical test program. During this test, I have included  
> \>animations to acknowledge user response. I initially used the  
> \>SCREEN functions for animation and have started exploring the  
> \>use of QT movies as another option.  
> \>  
> \>Aside from providing feedback, I was hoping to use the  
> \>animation as a pause in the program where I could execute a  
> \>very time demanding function that, if put elsewhere, slows the  
> \>trial process significantly. However, neither the SCREEN nor QT  
> \>animation options seem to provide this background execution.  
> \>  
> \>Ideally I want the animation to proceed in the same way that the  
> \>SND function does, returning immediately to allow for the  
> \>continuation of the program while the sound is still being played.   
> \>If this is possible in any format I would greatly apprecitate the  
> \>assistance,  
> \>  
> \>Thanks in advance,  
> \>  
> \>Craig Chapman

dear craig  
  
everything you say is right. and the wishes you express are shared by   
others. Matlab doesn't do multitasking, so the SCREEN functions   
cannot be spawned off as a background process. it's possible that   
Quicktime can be set up as a background process, and that someone   
could enhance QT.mex (renamed Showtime.mex in forthcoming release) to   
do so.  
  
what you can do, of course, is to write a program that does two   
things at once by cleverly interleaving the tasks.  
  
best  
  
denis  
  
p.s.  
as you say, SND is an autonomous background process. this is possible   
because Apple wrote this capability into their Sound Manager, and it   
still took a large effort on our part to implement. Backgrounding is   
cool, but hard. In theory this is what unix (including Mac OS X) is   
supposed to make easy, but i don't know how much we'll benefit from   
within Matlab.
