Getting around simultaneous repeat loops
Posted: Fri Oct 03, 2008 3:25 am
Hi,
I am trying to find an alternative to running simultaneous repeat loops (which is what I want to do, but isn't possible.)
The program displays images and plays audio files for an experiment.
The images are displayed according to certain timing (random within restrictions)- this is currently working within a repeat loop.
The problem is that a set number of tones need to occur randomly throughout the duration of the program, without affecting the presentation of the images. I currently have this set up as another repeat loop which checks every 1s whether a tone should be played, but I cannot have the two repeat loops operating at once.
eg:
repeat until all tones are played
check if a tone needs to be played now
if yes, play tone, end if
wait for 1 second with messages
end repeat
Any comments or suggestions on logic to get around this would be appreciated. thanks.
I am trying to find an alternative to running simultaneous repeat loops (which is what I want to do, but isn't possible.)
The program displays images and plays audio files for an experiment.
The images are displayed according to certain timing (random within restrictions)- this is currently working within a repeat loop.
The problem is that a set number of tones need to occur randomly throughout the duration of the program, without affecting the presentation of the images. I currently have this set up as another repeat loop which checks every 1s whether a tone should be played, but I cannot have the two repeat loops operating at once.
eg:
repeat until all tones are played
check if a tone needs to be played now
if yes, play tone, end if
wait for 1 second with messages
end repeat
Any comments or suggestions on logic to get around this would be appreciated. thanks.