コード例 #1
0
void ProcessorGraph::updatePointers()
{
    getAudioNode()->setUIComponent(getUIComponent());
    getAudioNode()->updateBufferSize();
    getRecordNode()->setUIComponent(getUIComponent());
    getMessageCenter()->setUIComponent(getUIComponent());
}
コード例 #2
0
void ProcessorGraph::connectProcessorToAudioAndRecordNodes(GenericProcessor* source)
{

    if (source == nullptr)
        return;

    getRecordNode()->registerProcessor(source);

    for (int chan = 0; chan < source->getNumOutputs(); chan++)
    {

        getAudioNode()->addInputChannel(source, chan);

        // THIS IS A HACK TO MAKE SURE AUDIO NODE KNOWS WHAT THE SAMPLE RATE SHOULD BE
        // IT CAN CAUSE PROBLEMS IF THE SAMPLE RATE VARIES ACROSS PROCESSORS

		//TODO: See if this causes problems with the newer architectures
        //getAudioNode()->settings.sampleRate = source->getSampleRate();

        addConnection(source->getNodeId(),                   // sourceNodeID
                      chan,                                  // sourceNodeChannelIndex
                      AUDIO_NODE_ID,                         // destNodeID
                      getAudioNode()->getNextChannel(true)); // destNodeChannelIndex

        getRecordNode()->addInputChannel(source, chan);

        addConnection(source->getNodeId(),                    // sourceNodeID
                      chan,                                   // sourceNodeChannelIndex
                      RECORD_NODE_ID,                         // destNodeID
                      getRecordNode()->getNextChannel(true)); // destNodeChannelIndex

    }

    // connect event channel
    addConnection(source->getNodeId(),    // sourceNodeID
                  midiChannelIndex,       // sourceNodeChannelIndex
                  RECORD_NODE_ID,         // destNodeID
                  midiChannelIndex);      // destNodeChannelIndex

    // connect event channel
    addConnection(source->getNodeId(),    // sourceNodeID
                  midiChannelIndex,       // sourceNodeChannelIndex
                  AUDIO_NODE_ID,          // destNodeID
                  midiChannelIndex);      // destNodeChannelIndex


    getRecordNode()->addInputChannel(source, midiChannelIndex);

}
コード例 #3
0
ファイル: ProcessorGraph.cpp プロジェクト: aacuevas/GUI
void ProcessorGraph::updateConnections(Array<SignalChainTabButton*, CriticalSection> tabs)
{
    clearConnections(); // clear processor graph

    std::cout << "Updating connections:" << std::endl;

    Array<GenericProcessor*> splitters;

    for (int n = 0; n < tabs.size(); n++)
    {
        std::cout << "Signal chain " << n << std::endl;

        GenericEditor* sourceEditor = (GenericEditor*) tabs[n]->getEditor();
        GenericProcessor* source = (GenericProcessor*) sourceEditor->getProcessor();

        while (source != 0)// && destEditor->isEnabled())
        {
            std::cout << "Source node: " << source->getName() << ", ";
            GenericProcessor* dest = (GenericProcessor*) source->getDestNode();

            if (dest != 0)
            {
                std::cout << "Dest node: " << dest->getName() << std::endl;
                if (dest->isMerger()) // move it forward by one
                {
                    dest = dest->getDestNode();
                }
                else if (dest->isSplitter())
                {
                    if (!dest->wasConnected)
                        splitters.add(dest);

                    dest = dest->getDestNode();
                }

            }
            else
            {
                std::cout << "no dest node." << std::endl;
            }

            if (source->enabledState())
            {

                // add the connections to audio and record nodes if necessary
                if (!(source->isSink() ||
                      source->isSplitter() || source->isMerger() || source->isUtility()) && !(source->wasConnected))
                {
                    std::cout << "   Connecting to audio and record nodes." << std::endl;

                    //source->setStartChannel(getAudioNode()->getNextChannel(false));


                    for (int chan = 0; chan < source->getNumOutputs(); chan++)
                    {

                        getAudioNode()->addInputChannel(source, chan);

                        // std::cout << "Connecting to audio channel: " <<
                        // 	      getAudioNode()->getNextChannel(false) << std::endl;

                        //getAudioNode()->enableCurrentChannel(source->audioStatus(chan));

                        addConnection(source->getNodeId(), 		   // sourceNodeID
                                      chan, 						           // sourceNodeChannelIndex
                                      AUDIO_NODE_ID, 					       // destNodeID
                                      getAudioNode()->getNextChannel(true)); // destNodeChannelIndex
                        // add 2 to account for 2 output channels


                        //std::cout << getAudioNode()->getNextChannel(false) << " ";

                        getRecordNode()->addInputChannel(source, chan);

                        // std::cout << "Connecting to record channel: " <<
                        // 	      getRecordNode()->getNextChannel(false) << std::endl;


                        addConnection(source->getNodeId(),          // sourceNodeID
                                      chan,                                   // sourceNodeChannelIndex
                                      RECORD_NODE_ID, 					    // destNodeID
                                      getRecordNode()->getNextChannel(true)); // destNodeChannelIndex

                    }

                    // connect event channel
                    addConnection(source->getNodeId(), 				// sourceNodeID
                                  midiChannelIndex, 							// sourceNodeChannelIndex
                                  RECORD_NODE_ID, 							// destNodeID
                                  midiChannelIndex);							// destNodeChannelIndex

                    // connect event channel
                    addConnection(source->getNodeId(), 				// sourceNodeID
                                  midiChannelIndex, 							// sourceNodeChannelIndex
                                  AUDIO_NODE_ID, 							// destNodeID
                                  midiChannelIndex);							// destNodeChannelIndex


                    getRecordNode()->addInputChannel(source, midiChannelIndex);

                }

                std::cout << std::endl;

                if (dest != 0)
                {

                    if (dest->enabledState())
                        std::cout << "     OK." << std::endl;
                    else
                        std::cout << "     Not OK." << std::endl;

                    if (dest->enabledState())
                    {

                        std::cout << "     Connecting " << source->getName() << " channel ";

                        for (int chan = 0; chan < source->getNumOutputs(); chan++)
                        {
                            std::cout << chan << " ";

                            addConnection(source->getNodeId(), // sourceNodeID
                                          chan, // sourceNodeChannelIndex
                                          dest->getNodeId(), // destNodeID
                                          dest->getNextChannel(true)); // destNodeChannelIndex
                        }

                        std::cout << " to " << dest->getName() << std::endl;

                        std::cout << "     Connecting " << source->getName() <<
                                  " event channel to " <<
                                  dest->getName() << std::endl;

                        // connect event channel
                        addConnection(source->getNodeId(), // sourceNodeID
                                      midiChannelIndex, // sourceNodeChannelIndex
                                      dest->getNodeId(), // destNodeID
                                      midiChannelIndex); // destNodeChannelIndex

                    }

                }
            }

            source->wasConnected = true;
            source = dest; // switch source and dest

            if (source == 0 && splitters.size() > 0)
            {
                dest = splitters.getFirst(); // dest is now the splitter
                splitters.remove(0); // take it out of the
                dest->switchIO(); // switch to the other destination
                dest->wasConnected = true; // don't want to re-add splitter
                source = dest->getSourceNode(); // splitter is now source
            }

        } // end while source != 0
    } // end "tabs" for loop
} // end method
コード例 #4
0
ファイル: ProcessorGraph.cpp プロジェクト: ArmandNM/GUI
void ProcessorGraph::updatePointers()
{
    getAudioNode()->updateBufferSize();
}
コード例 #5
0
bool ProcessorGraph::enableProcessors()
{

    updateConnections(AccessClass::getEditorViewport()->requestSignalChain());

    std::cout << "Enabling processors..." << std::endl;

    bool allClear;

    if (getNumNodes() < 5)
    {
        AccessClass::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.");
                AccessClass::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->enableProcessor();
        }
    }

    AccessClass::getEditorViewport()->signalChainCanBeEdited(false);

	//Update special channels indexes, at the end
	//To change, as many other things, when the probe system is implemented
	getRecordNode()->updateRecordChannelIndexes();
	getAudioNode()->updateRecordChannelIndexes();

    //	sendActionMessage("Acquisition started.");
	m_startSoftTimestamp = Time::getHighResolutionTicks();
	if (m_timestampWindow)
		m_timestampWindow->setAcquisitionState(true);
    return true;
}