threading SoundOut/Wait and TextDisplay objects

Paul Groot pfc.groot at gmail.com
Tue Jul 26 20:51:10 UTC 2011


Hi Becky,

I also don't think E-Basic has build-in support for running separate
threads. The only way I could achieve this was by creating a separate
DLL in C++ and call it from inline script. (I needed it for
controlling infusions pumps, which were used for fluid delivery during
an fMRI experiment). However, code in a separate DLL cannot make use
of E-Prime functions, so that really limits its use.  I think David
already suggested the easiest workaround: just create your own event
loop and handle all events (responses, timeouts) within this loop. I
think you already figured out how to manage sound objects and
responses. Drawing text or images on the display is also not very
difficult. You could invoke 'low level' functions by using the Canvas
object, or you could (re)draw existing E-Objects by invoking the Draw
method. Catching the respones of the keyboard will probably the
trickiest part...

cheers
Paul

2011/7/25 David McFarlane <mcfarla9 at msu.edu>:
> Becky,
>
> Stock reminder:  1) I do not work for PST.  2) PST's trained staff takes any
> and all questions at http://support.pstnet.com/e%2Dprime/support/login.asp ,
> and they strive to respond to all requests in 24-48 hours -- this is pretty
> much their substitute for proper documentation, so make full use of it.  3)
> If you do get an answer from PST Web Support, please extend the courtesy of
> posting their reply back here for the sake of others.
>
> That said, here is my take...
>
> Offhand, I do not think that E-Prime natively supports multiple "threads"
> such as you would like for this task, but I hope somebody else chimes in and
> tells me that I am wrong.
>
> Again offhand, I think you could accomplish your end by implementing your
> own "event loop" directly in E-Basic code.  Do a search on that term to see
> where I have mentioned this before, although I don't think I have ever gone
> into much detail.  Wikipedia might have a better discussion of the topic in
> general.  In your case your event loop would handle both timeout for your
> TextDisplay, and responses.
>
> -- David McFarlane, Professional Faultfinder
>
>
>> Can anyone tell me how to set up multiple threads in E-Prime?  I need
>> separate threads for running SoundOut/Wait objects and a TextDisplay
>> object.  I'm creating a task which presents a continous loop of the
>> following:
>>
>> -SoundOut1
>> -Wait1
>> -SoundOut2
>> -Wait2
>>
>> The subject adjusts the timing of Wait1 and Wait2 using key responses,
>> and the loop (trial) ends when the subject presses Enter.  I'm using
>> InLine scripts after each sound/wait object to check for any response
>> and adjust the next wait timing accordingly.
>>
>> The problem is that I'm also presenting a TextDisplay with background/
>> default text, and I want to change this text display (to provide
>> visual feedback) for 200 ms after a response, then have theTextDisplay
>> return to the default text.  I can change the TextDisplay after any
>> response, but if I tell E-Prime to wait 200ms, then change the text
>> again, it introduces a 200ms delay in my contionous audio/wait loop.
>> The timing delay problem is resolved if I just set the TextDisplay
>> object to "clear after = No", but then the response feedback display
>> text is held on screen until the next response, which is
>> problematic.
>>
>> Any thoughts and suggestions are much appreciated!
>>
>> Becky
>>
>> p.s. Apologies if this has been addressed in E-Prime support/forums
>> already - I've searched for related topics but couldn't find a
>> solution.
>
> --
> You received this message because you are subscribed to the Google Groups
> "E-Prime" group.
> To post to this group, send email to e-prime at googlegroups.com.
> To unsubscribe from this group, send email to
> e-prime+unsubscribe at googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/e-prime?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups "E-Prime" group.
To post to this group, send email to e-prime at googlegroups.com.
To unsubscribe from this group, send email to e-prime+unsubscribe at googlegroups.com.
For more options, visit this group at http://groups.google.com/group/e-prime?hl=en.



More information about the Eprime mailing list