Current Page:
NeXtMidas Training
Primitives
Open, Process, Close
process()
|
|
- The
process() method.
- Should process a single set of data.
- Generally only one "transfer length" of data is processed on each call to
process() .
- This method will be called again, and again, and again until
it returns
FINISH .
- Should return one of the following:
NORMAL |
Normal operation, data was processed. |
NOOP |
Nothing to process, wait for next frame. |
FINISH |
Done processing, go to close() . |
- It is important to return
NOOP if nothing was done
(usually waiting for piped data).
NOOP tells NeXtMidas to pause before
calling process() again.
- The pause delay defaults to 0.0125 seconds, but can be changed by via the
setPollTime(..) method or via the /POLL= switch.
- This prevents
process() from "spinning" and
using up a lot of CPU while waiting.
X-Midas Users Take Note: |
The process method is called many times. This is because NeXtMidas
abstracts most of the process loop away from the individual primitive. By abstracting
most of the process loop, the primitive can run in many modes (piped, not piped, run from
X-Midas, run by a processing engine, etc.) without alteration.
|
Don't Make This Mistake: |
One of the most common mistakes is returning NORMAL from process()
when nothing has been done. This will cause the process loop to spin and use up all of the
CPU time.
|
|
|
|