void NodeComponent::update() { const AudioProcessorGraph::Node::Ptr f (audioEngine.getDoc().getNodeForId (nodeID)); if (f == nullptr) { delete this; return; } numIns = f->getProcessor()->getTotalNumInputChannels(); if (f->getProcessor()->acceptsMidi()) ++numIns; numOuts = f->getProcessor()->getTotalNumOutputChannels(); if (f->getProcessor()->producesMidi()) ++numOuts; FaustAudioPluginInstance* faustProc = dynamic_cast<FaustAudioPluginInstance*>(f->getProcessor()); if (faustProc) highlight = faustProc->getHighlight(); int w = 10; int h = 50; // Update width based on number of I/O w = jmax (w, PINS_LEFT_OFFSET + ((jmax (numIns, numOuts) + 1) * OFFSET_BETWEEN_PINS)); String name = f->getProcessor()->getName(); setName (name); if (numIns != numInputs || numOuts != numOutputs || editor == nullptr) { numInputs = numIns; numOutputs = numOuts; deleteAllChildren(); addAndMakeVisible(nodeName = new Label(name, name)); nodeName->setJustificationType(Justification::centred); nodeName->setInterceptsMouseClicks(false, false); nodeName->setFont(font); w = jmax (w, nodeName->getFont().getStringWidth(name) + 15); if(!InternalPluginFormat::isInternalFormat(name) && f->getProcessor()->getNumParameters() > 0) { int uiStatus = f->properties["uiStatus"]; if(uiStatus == kUIStatusEmbed) { addAndMakeVisible(editor = new PMixGenericAudioProcessorEditor (audioEngine, f->getProcessor(), f->nodeID)); w = jmax (w, editor->getWidth() + 20 ); if (editor->getContentHeight() > 300) { editor->setSize(editor->getWidth(), 100); } h += jmin (320, editor->getContentHeight() + 20); } } setSize (w, h); int i; for (i = 0; i < f->getProcessor()->getTotalNumInputChannels(); ++i) addAndMakeVisible (new PinComponent (audioEngine, nodeID, i, true)); if (f->getProcessor()->acceptsMidi()) addAndMakeVisible (new PinComponent (audioEngine, nodeID, PMixDocument::midiChannelNumber, true)); for (i = 0; i < f->getProcessor()->getTotalNumOutputChannels(); ++i) addAndMakeVisible (new PinComponent (audioEngine, nodeID, i, false)); if (f->getProcessor()->producesMidi()) addAndMakeVisible (new PinComponent (audioEngine, nodeID, PMixDocument::midiChannelNumber, false)); resized(); } { double x, y; audioEngine.getDoc().getNodePosition (nodeID, x, y); setCentreRelative ((float) x, (float) y); } if(faustProc != nullptr) { if(faustProc->getCompilerMessage() != String::empty) bubbleMessage(faustProc->getCompilerMessage()); } }