From 38fc689b603d235fb2c113ecdb9a4e916e12894f Mon Sep 17 00:00:00 2001 From: Martin Roth Date: Fri, 24 Feb 2012 01:27:04 +0100 Subject: [PATCH] PdContext usually only has one graph. Make a special case for processing it. --- src/PdContext.cpp | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/PdContext.cpp b/src/PdContext.cpp index 3ed2bc76..1e9f4deb 100644 --- a/src/PdContext.cpp +++ b/src/PdContext.cpp @@ -168,11 +168,17 @@ void PdContext::process(float *inputBuffers, float *outputBuffers) { object->sendMessage(outletIndex, message); message->freeMessage(); // free the message now that it has been sent and processed } - - int numGraphs = graphList.size(); - PdGraph **graph = (numGraphs > 0) ? &graphList.front() : NULL; - for (int i = 0; i < numGraphs; ++i) { - graph[i]->processDsp(); + + switch (graphList.size()) { + case 0: break; + case 1: graphList.front()->processDsp(); break; + default: { + int numGraphs = graphList.size(); + PdGraph **graph = &graphList.front(); + for (int i = 0; i < numGraphs; ++i) { + graph[i]->processDsp(); + } + } } blockStartTimestamp = nextBlockStartTimestamp;