|
TracktionEngine
|
Runs a list of render jobs strictly one at a time, in order. More...
#include <tracktion_RenderQueue.h>
Classes | |
| class | Job |
| A single job in the queue, obtained from addJob()/addJobs()/getJobs(). More... | |
Public Types | |
| using | JobPtr = std::shared_ptr< Job > |
Public Member Functions | |
| RenderQueue ()=default | |
| ~RenderQueue () | |
| Destructor. | |
| JobPtr | addJob (PlannedRenderJob) |
| Adds a job to the queue, returning its handle. | |
| void | addJobs (std::vector< PlannedRenderJob >) |
| Adds a list of jobs to the queue. | |
| void | start () |
| Starts running the queued jobs in order. | |
| void | cancelAll () |
| Cancels the active job and all pending jobs. | |
| const std::vector< JobPtr > & | getJobs () const |
| Returns the jobs in the queue, in execution order. | |
| bool | hasStarted () const |
| bool | hasFinished () const |
| Returns true once every job has completed, failed or been cancelled. | |
| float | getTotalProgress () const |
| Returns the overall progress of the queue, 0 to 1. | |
Public Attributes | |
| std::function< void(Job &)> | onJobStarted |
| Called on the message thread as each job starts. | |
| std::function< void(Job &)> | onJobFinished |
| Called on the message thread as each job finishes. | |
| std::function< void()> | onFinished |
| Called on the message thread once all jobs have finished. | |
Runs a list of render jobs strictly one at a time, in order.
Add jobs (usually from expandRenderSpecification()), keeping hold of the returned Job handles, attach any callbacks, then call start(). Each job renders on its own background thread via EditRenderer; the next job only starts once the previous one has finished. More jobs can be appended while the queue is running - call start() again after adding them in case the earlier jobs have already finished. All methods and callbacks are message-thread only.
Deleting the queue cancels any remaining jobs. Job handles remain valid after the queue has been deleted.
| using engine::RenderQueue::JobPtr = std::shared_ptr<Job> |
|
default |
| engine::RenderQueue::~RenderQueue | ( | ) |
Destructor.
Cancels any active and pending jobs.
| JobPtr engine::RenderQueue::addJob | ( | PlannedRenderJob | ) |
Adds a job to the queue, returning its handle.
Jobs may be appended at any time, including while the queue is running - call start() again afterwards in case the earlier jobs have already finished.
| void engine::RenderQueue::addJobs | ( | std::vector< PlannedRenderJob > | ) |
Adds a list of jobs to the queue.
| void engine::RenderQueue::start | ( | ) |
Starts running the queued jobs in order.
Safe to call again after appending jobs to a running or finished queue: a no-op while a job is active, otherwise it picks up the next pending job. onFinished fires each time the queue runs out of pending jobs.
| void engine::RenderQueue::cancelAll | ( | ) |
Cancels the active job and all pending jobs.
| const std::vector< JobPtr > & engine::RenderQueue::getJobs | ( | ) | const |
Returns the jobs in the queue, in execution order.
| bool engine::RenderQueue::hasStarted | ( | ) | const |
| bool engine::RenderQueue::hasFinished | ( | ) | const |
Returns true once every job has completed, failed or been cancelled.
| float engine::RenderQueue::getTotalProgress | ( | ) | const |
Returns the overall progress of the queue, 0 to 1.
| std::function<void (Job&)> engine::RenderQueue::onJobStarted |
Called on the message thread as each job starts.
| std::function<void (Job&)> engine::RenderQueue::onJobFinished |
Called on the message thread as each job finishes.
| std::function<void()> engine::RenderQueue::onFinished |
Called on the message thread once all jobs have finished.