Browse files

Only update inlet buffer refs when a dsp connection is added (or remo…

…ved) to a dsp object. Inform the dsp object that a connection has changed no matter what kind of connection is added (or removed).
  • Loading branch information...
1 parent 1ee58cc commit 581842706ddbc024ad89c92aff6bfc9c83a39f18 @mhroth committed Mar 25, 2012
Showing with 10 additions and 20 deletions.
  1. +6 −2 src/DspObject.cpp
  2. +0 −4 src/MessageMultiply.cpp
  3. +2 −1 src/MessageMultiply.h
  4. +0 −11 src/PdContext.cpp
  5. +2 −2 src/PdContext.h
View
8 src/DspObject.cpp
@@ -138,21 +138,25 @@ void DspObject::addConnectionFromObjectToInlet(MessageObject *messageObject, int
// get pointer to inletIndex-th element of dspBufferRefListAtInlet
vector<float *> *dspBufferRefList = &(*(dspBufferRefListAtInlet.begin() + inletIndex));
dspBufferRefList->push_back(dspObject->getDspBufferRefAtOutlet(outletIndex));
+
+ updateInletBufferRefs(inletIndex);
}
- updateInletBufferRefs(inletIndex);
+ onInletConnectionUpdate();
}
void DspObject::removeConnectionFromObjectToInlet(MessageObject *messageObject, int outletIndex, int inletIndex) {
if (messageObject->getConnectionType(outletIndex) == DSP) {
list<ObjectLetPair> *incomingConnections = &incomingDspConnections[inletIndex];
ObjectLetPair objectLetPair = make_pair(messageObject, outletIndex);
incomingConnections->remove(objectLetPair); // does this work?
+
+ updateInletBufferRefs(inletIndex);
} else {
MessageObject::removeConnectionFromObjectToInlet(messageObject, outletIndex, inletIndex);
}
- updateInletBufferRefs(inletIndex);
+ onInletConnectionUpdate();
}
void DspObject::updateInletBufferRefs(unsigned int inletIndex) {
View
4 src/MessageMultiply.cpp
@@ -34,10 +34,6 @@ MessageMultiply::~MessageMultiply() {
// nothing to do
}
-const char *MessageMultiply::getObjectLabel() {
- return "*";
-}
-
void MessageMultiply::processMessage(int inletIndex, PdMessage *message) {
switch (inletIndex) {
case 0: {
View
3 src/MessageMultiply.h
@@ -33,7 +33,8 @@ class MessageMultiply : public MessageObject {
MessageMultiply(PdMessage *initMessage, PdGraph *graph);
~MessageMultiply();
- static const char *getObjectLabel();
+ static const char *getObjectLabel() { return "*"; }
+ string toString() { return string(getObjectLabel()); }
private:
void processMessage(int inletIndex, PdMessage *message);
View
11 src/PdContext.cpp
@@ -218,17 +218,6 @@ MessageObject *PdContext::newObject(const char *objectLabel, PdMessage *initMess
}
-#pragma mark - Lock/Unlock Context
-
-void PdContext::lock() {
- pthread_mutex_lock(&contextLock);
-}
-
-void PdContext::unlock() {
- pthread_mutex_unlock(&contextLock);
-}
-
-
#pragma mark - PrintStd/PrintErr
void PdContext::printErr(char *msg) {
View
4 src/PdContext.h
@@ -68,8 +68,8 @@ class PdContext {
void process(float *inputBuffers, float *outputBuffers);
- void lock();
- void unlock();
+ void lock() { pthread_mutex_lock(&contextLock); }
+ void unlock() { pthread_mutex_unlock(&contextLock); }
/** Globally register a remote message receiver (e.g. [send] or [notein]). */
void registerRemoteMessageReceiver(RemoteMessageReceiver *receiver);

0 comments on commit 5818427

Please sign in to comment.