void ProcessorGraph::updatePointers() { getAudioNode()->setUIComponent(getUIComponent()); getAudioNode()->updateBufferSize(); getRecordNode()->setUIComponent(getUIComponent()); getMessageCenter()->setUIComponent(getUIComponent()); }
bool ProcessorGraph::enableProcessors() { updateConnections(getEditorViewport()->requestSignalChain()); std::cout << "Enabling processors..." << std::endl; bool allClear; if (getNumNodes() < 5) { getUIComponent()->disableCallbacks(); return false; } for (int i = 0; i < getNumNodes(); i++) { Node* node = getNode(i); if (node->nodeId != OUTPUT_NODE_ID) { GenericProcessor* p = (GenericProcessor*) node->getProcessor(); allClear = p->isReady(); if (!allClear) { std::cout << p->getName() << " said it's not OK." << std::endl; // sendActionMessage("Could not initialize acquisition."); getUIComponent()->disableCallbacks(); return false; } } } for (int i = 0; i < getNumNodes(); i++) { Node* node = getNode(i); if (node->nodeId != OUTPUT_NODE_ID) { GenericProcessor* p = (GenericProcessor*) node->getProcessor(); p->enableEditor(); p->enable(); } } getEditorViewport()->signalChainCanBeEdited(false); // sendActionMessage("Acquisition started."); return true; }
void ProcessorList::mouseDown(const MouseEvent& e) { isDragging = false; Point<int> pos = e.getPosition(); int xcoord = pos.getX(); int ycoord = pos.getY(); //std::cout << xcoord << " " << ycoord << std::endl; ProcessorListItem* fli = getListItemForYPos(ycoord); if (fli != 0) { //std::cout << "Selecting: " << fli->getName() << std::endl; if (!fli->hasSubItems()){ clearSelectionState(); fli->setSelected(true); } } else { //std::cout << "No selection." << std::endl; } if (fli != 0) { if (xcoord < getWidth() - getScrollBarWidth()) { fli->reverseOpenState(); } if (fli == baseItem) { if (fli->isOpen()) { getUIComponent()->childComponentChanged(); } else { getUIComponent()->childComponentChanged(); //setBounds(0,0,225,itemHeight + 2*yBuffer); totalHeight = itemHeight + 2*yBuffer; } } } mouseDownInCanvas(e); repaint(); }
void* ProcessorGraph::createNewProcessor(String& description)//, // GenericProcessor* source, // GenericProcessor* dest) { GenericProcessor* processor = createProcessorFromDescription(description); int id = currentNodeId++; if (processor != 0) { processor->setNodeId(id); // identifier within processor graph std::cout << " Adding node to graph with ID number " << id << std::endl; processor->setUIComponent(getUIComponent()); // give access to important pointers addNode(processor,id); // have to add it so it can be deleted by the graph return processor->createEditor(); } else { sendActionMessage("Not a valid processor type."); return 0; } }
void ProcessorList::toggleState() { ProcessorListItem* fli = getListItemForYPos(0); fli->reverseOpenState(); getUIComponent()->childComponentChanged(); repaint(); }
void ControlPanel::toggleState() { open = !open; cpb->toggleState(); getUIComponent()->childComponentChanged(); }
void ControlPanel::openState(bool os) { open = os; cpb->setState(os); getUIComponent()->childComponentChanged(); }
void AudioEditor::buttonClicked(Button* button) { if (button == muteButton) { if (muteButton->getToggleState()) { lastValue = volumeSlider->getValue(); getAudioProcessor()->setParameter(1,0.0f); std::cout << "Mute on." << std::endl; } else { getAudioProcessor()->setParameter(1,lastValue); std::cout << "Mute off." << std::endl; } } else if (button == audioWindowButton) { if (audioWindowButton->getToggleState()) { if (acw == 0) { // AudioComponent* audioComponent = getAudioComponent(); // audioComponent->restartDevice(); // if (audioComponent != 0) { acw = new AudioConfigurationWindow(getAudioComponent()->deviceManager, (Button*) audioWindowButton); acw->setUIComponent(getUIComponent()); //} } getAudioComponent()->restartDevice(); acw->setVisible(true); } else { acw->setVisible(false); //deleteAndZero(acw); getAudioComponent()->stopDevice(); } } }
void* ProcessorGraph::createNewProcessor(String& description, int id)//, { GenericProcessor* processor = 0; try // Try/catch block added by Michael Borisov { processor = createProcessorFromDescription(description); } catch (std::exception& e) { NativeMessageBox::showMessageBoxAsync(AlertWindow::WarningIcon, "OpenEphys", e.what()); } // int id = currentNodeId++; if (processor != 0) { processor->setNodeId(id); // identifier within processor graph std::cout << " Adding node to graph with ID number " << id << std::endl; std::cout << std::endl; std::cout << std::endl; processor->setUIComponent(getUIComponent()); // give access to important pointers addNode(processor,id); // have to add it so it can be deleted by the graph if (processor->isSource()) { // by default, all source nodes record automatically processor->setAllChannelsToRecord(); } return processor->createEditor(); } else { sendActionMessage("Not a valid processor type."); return 0; } }
AudioProcessorEditor* DisplayNode::createEditor() { Visualizer* visualizer = new Visualizer(this, viewport, dataViewport); GenericProcessor* source = (GenericProcessor*) getSourceNode(); visualizer->setBuffers(source->getContinuousBuffer(),source->getEventBuffer()); visualizer->setUIComponent(getUIComponent()); visualizer->setConfiguration(config); setEditor(visualizer); std::cout << "Creating visualizer." << std::endl; return visualizer; }
void ProcessorList::mouseDownInCanvas(const MouseEvent& e) { isDragging = false; Point<int> pos = e.getPosition(); int xcoord = pos.getX(); int ycoord = pos.getY(); //std::cout << xcoord << " " << ycoord << std::endl; ProcessorListItem* fli = getListItemForYPos(ycoord); if (fli != 0) { //std::cout << "Selecting: " << fli->getName() << std::endl; if (!fli->hasSubItems()){ clearSelectionState(); fli->setSelected(true); } } else { //std::cout << "No selection." << std::endl; } if (fli != 0) { if (xcoord < getWidth() - getScrollBarWidth()) { if (e.mods.isRightButtonDown() || e.mods.isCtrlDown()) { if (fli->getName().equalsIgnoreCase("Sources")) { currentColor = SOURCE_COLOR; } else if (fli->getName().equalsIgnoreCase("Filters")) { currentColor = FILTER_COLOR; } else if (fli->getName().equalsIgnoreCase("Utilities")) { currentColor = UTILITY_COLOR; } else if (fli->getName().equalsIgnoreCase("Sinks")) { currentColor = SINK_COLOR; } else { return; } int options; options += (0 << 0); // showAlpha options += (0 << 1); // showColorAtTop options += (0 << 2); // showSliders options += (1 << 3); // showColourSpace ColourSelector colourSelector(options); colourSelector.setName ("background"); colourSelector.setCurrentColour (findColour (currentColor)); colourSelector.addChangeListener (this); colourSelector.addChangeListener (getProcessorGraph()); colourSelector.setColour (ColourSelector::backgroundColourId, Colours::transparentBlack); colourSelector.setSize (300, 275); CallOutBox callOut (colourSelector, *fli, 0);//*this, 0); callOut.setTopLeftPosition (e.getScreenX(), e.getScreenY()); callOut.setArrowSize(0.0f); callOut.runModalLoop(); } else { fli->reverseOpenState(); } } if (fli == baseItem) { if (fli->isOpen()) { getUIComponent()->childComponentChanged(); } else { getUIComponent()->childComponentChanged(); totalHeight = itemHeight + 2*yBuffer; } } } repaint(); }