TTObjectNotifications

#summary Creating a system where we can listen to objects.

When a TTBlue object is deleted, then it is simply gone. Poof.
If some other code tries to call a method in that object then we crash. Poof.

What we need to add is notifications. Currently we have dynamically bound messages vis sendMessage() and attributes vie setAttributeValue(). These are for communicating things inside of an object. For communicating outside of the object we will need to add something like sendNotification().

How should this work?

It seems that TTObject should have a method like: subscribeNotification(TTSymbol& name) Which adds a function pointer to a list. This implies that we also need an unsubscribeNotification(). Then when the object calls sendNotification(), it looks in the list for anything subscribed to this particular symbol for the object and calls the function(s) it finds.

Do this will allow client code to know that a TTObject has disappeared. This is very important.

In the particular context I’m in, Jamoma, I wonder if this is actually going to be good enough to solve the current FunctionLib? crash I’m working on. I need to think about it after some sleep… The problem with this FunctionLib? crash is that there are things going on in multiple threads…