![]() |
cello
JUCE ValueTrees for Humans
|
Permits thread-safe Object updates by using the juce::ValueTreeSynchroniser class to generate small binary patches that are used to pass updates from one copy of a ValueTree to another, each in separate threads. This sync is only performed in one direction, so you will need a pair of these objects to perform bidirectional syncs. More...
#include <cello_sync.h>
Public Member Functions | |
Sync (Object &producer, Object &consumer, juce::Thread *thread, SyncController *controller=nullptr) | |
Construct a new Sync object. | |
Sync (const Sync &)=delete | |
Sync & | operator= (const Sync &)=delete |
![]() | |
UpdateQueue (Object &consumer, juce::Thread *thread) | |
UpdateQueue (const UpdateQueue &)=delete | |
UpdateQueue & | operator= (const UpdateQueue &)=delete |
UpdateQueue (UpdateQueue &&)=delete | |
UpdateQueue & | operator= (UpdateQueue &&)=delete |
int | getPendingUpdateCount () const |
void | performAllUpdates () |
Execute each of the updates that are ready. | |
void | performNextUpdate () |
Pop the next event from the queue and apply the change to the destination value tree. | |
bool | isDestinationThread (juce::Thread *thread) const |
Check if the given thread is the destination thread for this update queue. | |
Additional Inherited Members | |
![]() | |
void | pushUpdate (juce::MemoryBlock &&update) |
Permits thread-safe Object updates by using the juce::ValueTreeSynchroniser class to generate small binary patches that are used to pass updates from one copy of a ValueTree to another, each in separate threads. This sync is only performed in one direction, so you will need a pair of these objects to perform bidirectional syncs.
Take care to not generate infinite update loops.
cello::Sync::Sync | ( | Object & | producer, |
Object & | consumer, | ||
juce::Thread * | thread, | ||
SyncController * | controller = nullptr ) |
Construct a new Sync object.
producer | cello::Object that will be sending updates |
consumer | cello::Object that will be kept in sync with the producer |
thread | non-owning pointer to the Thread on which the consumer will be updated. If the consumer object is to be updated on the message thread, pass a nullptr for this arg. |
controller | pointer to the (optional) SyncController that will be used when we are performing a bidirectional sync. |