A thread to control the psycho display from an external controller. More...
#include <Psycho/DisplayController.H>
Public Member Functions | |
DisplayController () | |
c'tor | |
virtual | ~DisplayController () |
d'tor | |
void | setDisplay (nub::soft_ref< PsychoDisplay > display) |
set the display from the main calling programs display | |
void | setBuffer (rutz::shared_ptr< SharedBuffer< RexData * > > buffer) |
set the buffer to be shared with StimListener | |
void | setEventLog (nub::soft_ref< EventLog > log) |
set the log file | |
void | pushEvent (const std::string &msg, const bool &uselinfo=false) |
push an event to the log, if uselinfo is true also display it to the screen | |
void | pause (bool pausestate) |
halt the display controller's run loop | |
void | setBackground (const GenericFrame &gf, const int framenumber) |
set the current background | |
virtual void | start () |
start the componenet and do any pre-display stuff. | |
virtual void | stop () |
clean up and stop | |
virtual void | run () |
the actual work of the thread is here | |
virtual const char * | jobType () const |
job name | |
virtual int | priority () const |
return priority, 0 is highest |
A thread to control the psycho display from an external controller.
This class is to be used by a StimController to to control the SDL display. Display commands are read through a shared buffer. Calling programs should no longer try to handle display themselves, but merely call the setBackground() to 'inject' the calling programs image into the DisplayController thread. The image will be rendered on the next display cycle in the background of the DisplayControllers current drawing instructions.
Definition at line 62 of file DisplayController.H.
DisplayController::DisplayController | ( | ) |
c'tor
Definition at line 39 of file DisplayController.C.
DisplayController::~DisplayController | ( | ) | [virtual] |
d'tor
Definition at line 49 of file DisplayController.C.
const char * DisplayController::jobType | ( | ) | const [virtual] |
void DisplayController::pause | ( | bool | pausestate | ) |
halt the display controller's run loop
Definition at line 82 of file DisplayController.C.
References PosixSemaphore::post().
Referenced by stop().
int DisplayController::priority | ( | ) | const [virtual] |
return priority, 0 is highest
Reimplemented from JobServer::Job.
Definition at line 186 of file DisplayController.C.
void DisplayController::pushEvent | ( | const std::string & | msg, | |
const bool & | uselinfo = false | |||
) |
push an event to the log, if uselinfo is true also display it to the screen
Definition at line 72 of file DisplayController.C.
void DisplayController::run | ( | ) | [virtual] |
the actual work of the thread is here
once we have the data look up the function in our map, calling it
delete the data as we are done with it
Implements JobServer::Job.
Definition at line 149 of file DisplayController.C.
References PosixSemaphore::wait().
void DisplayController::setBackground | ( | const GenericFrame & | gf, | |
const int | framenumber | |||
) |
set the current background
Definition at line 93 of file DisplayController.C.
References GenericFrame::asVideo(), VideoFrame::deepCopyOf(), GenericFrame::getHeight(), GenericFrame::getWidth(), GenericFrame::nativeType(), and SDLdisplay::NEXT_VSYNC.
void DisplayController::setBuffer | ( | rutz::shared_ptr< SharedBuffer< RexData * > > | buffer | ) |
set the buffer to be shared with StimListener
Definition at line 60 of file DisplayController.C.
void DisplayController::setDisplay | ( | nub::soft_ref< PsychoDisplay > | display | ) |
set the display from the main calling programs display
Definition at line 54 of file DisplayController.C.
void DisplayController::setEventLog | ( | nub::soft_ref< EventLog > | log | ) |
set the log file
Definition at line 66 of file DisplayController.C.
void DisplayController::start | ( | ) | [virtual] |
start the componenet and do any pre-display stuff.
Definition at line 128 of file DisplayController.C.
References rutz::shared_ptr< T >::is_valid().
void DisplayController::stop | ( | ) | [virtual] |