コード例 #1
0
void ControlPanelComponent::sliderValueChanged (Slider* sliderThatWasMoved)
{
    //[UsersliderValueChanged_Pre]
    //[/UsersliderValueChanged_Pre]

    if (sliderThatWasMoved == thresholdSlider)
    {
        //[UserSliderCode_thresholdSlider] -- add your slider handling code here..
        sendActionMessage("clusterParamsChanged");
        //[/UserSliderCode_thresholdSlider]
    }
    else if (sliderThatWasMoved == stickynessSlider)
    {
        //[UserSliderCode_stickynessSlider] -- add your slider handling code here..
        sendActionMessage("clusterParamsChanged");
        //[/UserSliderCode_stickynessSlider]
    }
    else if (sliderThatWasMoved == widthSlider)
    {
        //[UserSliderCode_widthSlider] -- add your slider handling code here..
        widthMinLabel->setText(String(widthSlider->getMinValue()*100) + "%", dontSendNotification);
        widthMaxLabel->setText(String(widthSlider->getMaxValue()*100) + "%", dontSendNotification);
        sendActionMessage("clusterParamsChanged");
        //[/UserSliderCode_widthSlider]
    }

    //[UsersliderValueChanged_Post]
    //[/UsersliderValueChanged_Post]
}
コード例 #2
0
ファイル: FileReader.cpp プロジェクト: ahermosm/GUI
bool FileReader::setFile(String fullpath)
{
    File file(fullpath);

    String ext = file.getFileExtension();

    if (!ext.compareIgnoreCase(".kwd"))
    {
        input = new KWIKFileSource();
    }
    else
    {
        sendActionMessage("File type not supported");
        return false;
    }

    if (!input->OpenFile(file))
    {
        input = nullptr;
        sendActionMessage("Invalid file");
        return false;
    }

    if (input->getNumRecords() <= 0)
    {
        input = nullptr;
        sendActionMessage("Empty file. Inoring open operation");
        return false;
    }
    static_cast<FileReaderEditor*>(getEditor())->populateRecordings(input);
    setActiveRecording(0);
    
    return true;
}
コード例 #3
0
ファイル: FPGAOutput.cpp プロジェクト: SireniaLizbeth/GUI
void FPGAOutput::timerCallback()
{
    //dataThread->setOutputLow();

    if (!continuousStim)
    {
        sendActionMessage("LO");

        isEnabled = true;
        stopTimer();

    }
    else
    {

        if (isEnabled)
        {
            sendActionMessage("HI");
            isEnabled = false;
        }
        else
        {
            sendActionMessage("LO");
            isEnabled = true;
        }


    }

}
コード例 #4
0
ファイル: HomeMenu.cpp プロジェクト: projekt-matara/halfstak
void HomeMenu::actionListenerCallback(const String& message)
{
    // Communicates with GraphDocumentComponent
    
    if (message == "Tell Home Menu to switch to lab") {
        sendActionMessage("Switch app mode to lab");
    }
    else if (message == "Tell Home Menu to switch to bank"){
        sendActionMessage("Switch app mode to bank");
    }
    else if (message == "Tell Home Menu to switch to stage"){
        sendActionMessage("Switch app mode to stage");
    }
}
コード例 #5
0
ファイル: CtrlrManager.cpp プロジェクト: gareth8118/ctrlr
void CtrlrManager::saveStateToDisk()
{
	if (JUCEApplication::isStandaloneApp())
	{
		sendActionMessage ("save");
	}
}
コード例 #6
0
	void update_tx()
	{
		if (m_device)
		{
			sendActionMessage("update tx");
		}
	}
コード例 #7
0
void FilterEditor::labelTextChanged(Label* label)
{
    FilterNode* fn = (FilterNode*) getProcessor();

    Value val = label->getTextValue();
    double requestedValue = double(val.getValue());

    if (requestedValue < 0.01 || requestedValue > 10000)
    {
        sendActionMessage("Value out of range.");

        if (label == highCutValue)
        {
            label->setText(lastHighCutString, dontSendNotification);
        }
        else
        {
            label->setText(lastLowCutString, dontSendNotification);
        }

        return;
    }

    Array<int> chans = getActiveChannels();

    // This needs to change, since there's not enough feedback about whether
    // or not individual channel settings were altered:

    for (int n = 0; n < chans.size(); n++)
    {

        if (label == highCutValue)
        {
            double minVal = fn->getLowCutValueForChannel(n);

            if (requestedValue > minVal)
            {
                fn->setCurrentChannel(n);
                fn->setParameter(1, requestedValue);
            }

            lastHighCutString = label->getText();

        }
        else
        {
            double maxVal = fn->getHighCutValueForChannel(n);

            if (requestedValue < maxVal)
            {
                fn->setCurrentChannel(n);
                fn->setParameter(0, requestedValue);
            }

            lastLowCutString = label->getText();
        }

    }

}
コード例 #8
0
ファイル: ProcessorGraph.cpp プロジェクト: aacuevas/GUI
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;
    }

}
コード例 #9
0
ファイル: ArduinoOutput.cpp プロジェクト: ahermosm/GUI
void ArduinoOutput::setDevice(String devName)
{

    if (!acquisitionIsActive)
    {

        Time timer;

        arduino.connect(devName.toStdString());

        if (arduino.isArduinoReady())
        {

            uint32 currentTime = timer.getMillisecondCounter();

            arduino.sendProtocolVersionRequest();
            timer.waitForMillisecondCounter(currentTime + 2000);
            arduino.update();
            arduino.sendFirmwareVersionRequest();

            timer.waitForMillisecondCounter(currentTime + 4000);
            arduino.update();

            std::cout << "firmata v" << arduino.getMajorFirmwareVersion()
                      << "." << arduino.getMinorFirmwareVersion() << std::endl;

        }

        if (arduino.isInitialized())
        {

            std::cout << "Arduino is initialized." << std::endl;
            arduino.sendDigitalPinMode(outputChannel, ARD_OUTPUT);
            sendActionMessage("Arduino initialized at" + devName);
            deviceSelected = true;
        }
        else
        {
            std::cout << "Arduino is NOT initialized." << std::endl;
            sendActionMessage("Arduino could not be initialized at" + devName);
        }
    } else {
        sendActionMessage("Cannot change device while acquisition is active.");
    }


}
コード例 #10
0
ファイル: SidebarPanel.cpp プロジェクト: gsenna/cabbage
//--------------------------------------------------------------------
void SidebarPanel::mouseDrag(const MouseEvent& event)
{
    if(canResize)
    {
        this->setSize(event.getPosition().getX(), this->getHeight());
        sendActionMessage("SidebarWidth:"+String(event.getPosition().getX()));
    }
}
コード例 #11
0
void TargetFileComponent::actionListenerCallback(const juce::String &message){

    if(message == "audioPositionUpdateWhilePlaying"){
        playAudio();
    }
    else{
        sendActionMessage(message);
    }
//    DBG(message);
}
コード例 #12
0
bool UIComponent::perform (const InvocationInfo& info)
{

	switch (info.commandID)
	{
	case openConfiguration:
	{
		sendActionMessage(getEditorViewport()->loadState());
		break;
	}
	case saveConfiguration:
	{
		sendActionMessage(getEditorViewport()->saveState());
		break;
	}
	case clearSignalChain:
		getEditorViewport()->clearSignalChain();
		break;

	case showHelp:
		std::cout << "SHOW ME SOME HELP!" << std::endl;
		break;

	case toggleProcessorList:
		processorList->toggleState();
		break;

	case toggleFileInfo:
		controlPanel->toggleState();
		break;

	case toggleSignalChain:
		editorViewportButton->toggleState();
		break;
		
	default:
		break;

	}

	return true;

}
コード例 #13
0
// speaker setup changed by another app
void WdmChMapComponent::update_speaker()
{
	if (m_bus)
	{
		m_speaker = m_bus->speaker();
		m_update |= updt_speaker;
		triggerAsyncUpdate();
		sendActionMessage("speaker config changed");
	}
}
コード例 #14
0
void MidiPedalCallback::handleIncomingMidiMessage (MidiInput *source, const MidiMessage &message)
{
    if (message.isController()) {
        int x = message.getControllerNumber();
        bool button_check = is_item_in_list(x, button_check_list);
        if (button_check == true) {
            buttonPressed = x;
            sendActionMessage("To audio_midi from midiPedalCallback: grab buttonPressed");
        }
    }
}
コード例 #15
0
ファイル: FileReader.cpp プロジェクト: ahermosm/GUI
bool FileReader::isReady()
{
    if (input == nullptr)
    {
        sendActionMessage("No file selected in File Reader.");
        return false;
    }
    else
    {
        return true;
    }
}
コード例 #16
0
ファイル: FPGAOutput.cpp プロジェクト: SireniaLizbeth/GUI
void FPGAOutput::handleEvent(int eventType, MidiMessage& event, int sampleNum)
{
    if (eventType == TTL && isEnabled)
    {

        const uint8* dataptr = event.getRawData();

        // int eventNodeId = *(dataptr+1);
        int eventId = *(dataptr+2);
        int eventChannel = *(dataptr+3);

        // std::cout << "FPGA output received event: " << eventNodeId << " " << eventId << " " << eventChannel << std::endl;

        if (eventId == 1 && eventChannel == TTLchannel) // channel 3 only at the moment
        {
            sendActionMessage("HI");
            isEnabled = false;

            if (!continuousStim)
                startTimer(5); // pulse width
            // else
            //    startTimer(25); // pulse width

        }
        else if (eventId == 0 && eventChannel == TTLchannel)  // && eventChannel == TTLchannel)
        {
            if (continuousStim)
            {
                /// this isn't working
                sendActionMessage("LO");
                isEnabled = true;
                //   stopTimer();
            }
        }


    }

}
コード例 #17
0
void FWProgressBackgroundThread::run()
{
	if (m_device_ref)
	{
		try
		{
			switch (m_operation)
			{
				case tcat::dice::FL_OP_DELETE_IMAGE:
					m_device_ref->firmware_delete(std::string(m_sector.toUTF8()));
					break;
				case tcat::dice::FL_OP_CREATE_IMAGE:
					if (m_requires_entrypoint)
						m_device_ref->firmware_create(std::string(m_sector.toUTF8()), m_size);
					else
						m_device_ref->firmware_create(std::string(m_sector.toUTF8()), m_size, 0, 0);
					break;
				case tcat::dice::FL_OP_UPLOAD:
					m_device_ref->firmware_upload(std::string(m_file.toUTF8()), std::string(m_sector.toUTF8())); // use 8-bit checksum
					sendActionMessage("fw upload success");
					break;
				case tcat::dice::FL_OP_READ_MEMORY:
					m_device_ref->firmware_download(std::string(m_file.toUTF8()));
					break;
				
				default:
					break;
			}
		}
		catch (tcat::dice::xptn_device_firmware)
		{
			AlertWindow::showMessageBox (AlertWindow::NoIcon,
				"File Upload",
				"\n\nFirmware upload checksum failed.\nThe device firmware will not be changed.\n\nPlease try again and contact the device\nmanufacturer if the problem persists.");
		}
		catch (tcat::dice::xptn_internal exception)
		{
			AlertWindow::showMessageBox (AlertWindow::NoIcon,
				"File Upload",
				"\n\nDevice communications error.\nThe device firmware will not be changed.\n\nPlease try again and contact the device\nmanufacturer if the problem persists.");
		}
		catch (...)
		{
			AlertWindow::showMessageBox (AlertWindow::NoIcon,
				"File Upload",
				"\n\nError.\n\nThe device firmware will not be changed.\n\nPlease try again and contact the device\nmanufacturer if the problem persists.");
		}
	}
}    
コード例 #18
0
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;
    }

}
コード例 #19
0
void TargetFileComponent::buttonClicked (Button* buttonThatWasClicked)
{
    //[UserbuttonClicked_Pre]
    //[/UserbuttonClicked_Pre]

    if (buttonThatWasClicked == playButton)
    {
        //[UserButtonCode_playButton] -- add your button handler code here..
        playAudio();
        //[/UserButtonCode_playButton]
    }
    else if (buttonThatWasClicked == stopButton)
    {
        //[UserButtonCode_stopButton] -- add your button handler code here..
        stopAudio();
        //[/UserButtonCode_stopButton]
    }
    else if (buttonThatWasClicked == loadFileButton)
    {
        //[UserButtonCode_loadFileButton] -- add your button handler code here..
        FileChooser myChooser ("Please select the file you want to load...");
        if (myChooser.browseForFileToOpen())
        {
            audioTransport.setSource(nullptr); // this fixes memory issue with loading new file

            File selectedFile = myChooser.getResult();
            currentFile->setFile(selectedFile);

            container->setFile(selectedFile);

            audioTransport.setSource(currentFile->getSource());

            isPlayable = true;
            setPlayable(true);
            sendActionMessage("setTargetFile");

        }
        //[/UserButtonCode_loadFileButton]
    }

    //[UserbuttonClicked_Post]
    //[/UserbuttonClicked_Post]
}
コード例 #20
0
void PluginWrapper::processBlock (AudioSampleBuffer& buffer, MidiBuffer& midiMessages)
{
    //this processBlock merely processes a loaded VST.
    if(!isBypassed)
    {
        vstInstance->processBlock(buffer,midiMessages);
    }

    if(isMuted)
        buffer.clear();



    rmsLeft = buffer.getRMSLevel(0, 0, buffer.getNumSamples());
    rmsRight = buffer.getRMSLevel(1, 0, buffer.getNumSamples());


    if(updateCounter==0)
        sendActionMessage("rmsValues "+String(rmsLeft)+" "+String(rmsRight));

    updateCounter++;
    if(updateCounter>5)
        updateCounter=0;
}
コード例 #21
0
void ControlPanelComponent::buttonClicked (Button* buttonThatWasClicked)
{
    //[UserbuttonClicked_Pre]
    //[/UserbuttonClicked_Pre]

    if (buttonThatWasClicked == calcSimButton)
    {
        //[UserButtonCode_calcSimButton] -- add your button handler code here..
        sendActionMessage("calculateSimilarity");
        //[/UserButtonCode_calcSimButton]
    }
    else if (buttonThatWasClicked == rmsFeatureToggle)
    {
        //[UserButtonCode_rmsFeatureToggle] -- add your button handler code here..
        //[/UserButtonCode_rmsFeatureToggle]
    }
    else if (buttonThatWasClicked == scFeatureToggle)
    {
        //[UserButtonCode_scFeatureToggle] -- add your button handler code here..
        //[/UserButtonCode_scFeatureToggle]
    }
    else if (buttonThatWasClicked == mfccFeatureToggle)
    {
        //[UserButtonCode_mfccFeatureToggle] -- add your button handler code here..
        //[/UserButtonCode_mfccFeatureToggle]
    }
    else if (buttonThatWasClicked == zcrFeatureToggle)
    {
        //[UserButtonCode_zcrFeatureToggle] -- add your button handler code here..
        //[/UserButtonCode_zcrFeatureToggle]
    }
    else if (buttonThatWasClicked == invertRegionsToggle)
    {
        //[UserButtonCode_invertRegionsToggle] -- add your button handler code here..
        sendActionMessage("clusterParamsChanged");
        //[/UserButtonCode_invertRegionsToggle]
    }
    else if (buttonThatWasClicked == exportSeparateButton)
    {
        //[UserButtonCode_exportSeparateButton] -- add your button handler code here..
        sendActionMessage("exportAudio");
        //[/UserButtonCode_exportSeparateButton]
    }
    else if (buttonThatWasClicked == saveSingleFileToggleButton)
    {
        //[UserButtonCode_saveSingleFileToggleButton] -- add your button handler code here..
        //[/UserButtonCode_saveSingleFileToggleButton]
    }
    else if (buttonThatWasClicked == searchButton)
    {
        //[UserButtonCode_searchButton] -- add your button handler code here..
        sendActionMessage("search");
        //[/UserButtonCode_searchButton]
    }
    else if (buttonThatWasClicked == widthFilterSearchToggle)
    {
        //[UserButtonCode_widthFilterSearchToggle] -- add your button handler code here..
        //[/UserButtonCode_widthFilterSearchToggle]
    }
    else if (buttonThatWasClicked == exportTxtButton)
    {
        //[UserButtonCode_exportTxtButton] -- add your button handler code here..
        sendActionMessage("exportCsv");
        //[/UserButtonCode_exportTxtButton]
    }

    //[UserbuttonClicked_Post]
    //[/UserbuttonClicked_Post]
}
コード例 #22
0
ファイル: ProcessorGraph.cpp プロジェクト: aacuevas/GUI
GenericProcessor* ProcessorGraph::createProcessorFromDescription(String& description)
{
    int splitPoint = description.indexOf("/");
    String processorType = description.substring(0,splitPoint);
    String subProcessorType = description.substring(splitPoint+1);

    std::cout << processorType << "::" << subProcessorType << std::endl;

    GenericProcessor* processor = 0;

    if (processorType.equalsIgnoreCase("Sources"))
    {

        if (subProcessorType.equalsIgnoreCase("RHA2000-EVAL") ||
            // subProcessorType.equalsIgnoreCase("File Reader") ||
            subProcessorType.equalsIgnoreCase("Custom FPGA") ||
            subProcessorType.equalsIgnoreCase("Rhythm FPGA"))
        {

            // if (subProcessorType.equalsIgnoreCase("Intan Demo Board") &&
            // 	!processorWithSameNameExists(subProcessorType)) {
            // 	std::cout << "Only one Intan Demo Board is allowed at a time."
            // 			  << std::endl;
            // } else {
            std::cout << "Creating a new data source." << std::endl;
            processor = new SourceNode(subProcessorType);

            //}

        }
        else if (subProcessorType.equalsIgnoreCase("Signal Generator"))
        {
            processor = new SignalGenerator();
            std::cout << "Creating a new signal generator." << std::endl;
        }
        else if (subProcessorType.equalsIgnoreCase("Event Generator"))
        {
            processor = new EventNode();
            std::cout << "Creating a new event node." << std::endl;
        }
        else if (subProcessorType.equalsIgnoreCase("File Reader"))
        {
            processor = new FileReader();
            std::cout << "Creating a new file reader." << std::endl;
        }


        sendActionMessage("New source node created.");


    }
    else if (processorType.equalsIgnoreCase("Filters"))
    {

        if (subProcessorType.equalsIgnoreCase("Bandpass Filter"))
        {

            std::cout << "Creating a new filter." << std::endl;
            processor = new FilterNode();

        }
        else if (subProcessorType.equalsIgnoreCase("Resampler"))
        {
            std::cout << "Creating a new resampler." << std::endl;
            processor = new ResamplingNode();

        }
        else if (subProcessorType.equalsIgnoreCase("Spike Detector"))
        {
            std::cout << "Creating a new spike detector." << std::endl;
            processor = new SpikeDetector();
        }
        else if (subProcessorType.equalsIgnoreCase("Event Detector"))
        {
            std::cout << "Creating a new event detector." << std::endl;
            processor = new EventDetector();
        }
        else if (subProcessorType.equalsIgnoreCase("Phase Detector"))
        {
            std::cout << "Creating a new phase detector." << std::endl;
            processor = new PhaseDetector();
        }
        else if (subProcessorType.equalsIgnoreCase("Digital Ref"))
        {
            std::cout << "Creating a new digital reference." << std::endl;
            processor = new ReferenceNode();
        }
        else if (subProcessorType.equalsIgnoreCase("Channel Map"))
        {
            std::cout << "Creating a new channel mapping node." << std::endl;
            processor = new ChannelMappingNode();
        }

        sendActionMessage("New filter node created.");

    }
    else if (processorType.equalsIgnoreCase("Utilities"))
    {

        if (subProcessorType.equalsIgnoreCase("Splitter"))
        {

            std::cout << "Creating a new splitter." << std::endl;
            processor = new Splitter();

            sendActionMessage("New splitter created.");

        }
        else if (subProcessorType.equalsIgnoreCase("Merger"))
        {

            std::cout << "Creating a new merger." << std::endl;
            processor = new Merger();

            sendActionMessage("New merger created.");

        }
        else if (subProcessorType.equalsIgnoreCase("Record Control"))
        {

            std::cout << "Creating a new record controller." << std::endl;
            processor = new RecordControl();

            sendActionMessage("New record controller created.");

        }

    }
    else if (processorType.equalsIgnoreCase("Sinks"))
    {

        if (subProcessorType.equalsIgnoreCase("LFP Viewer"))
        {
            std::cout << "Creating an LfpDisplayNode." << std::endl;
            processor = new LfpDisplayNode();

            // std::cout << "Graph data viewport: " << UI->getDataViewport() << std::endl;
            // processor->setDataViewport(getDataViewport());
            //processor->setUIComponent(UI);
        }
        else if (subProcessorType.equalsIgnoreCase("LFP Trig. Avg."))
        {
            std::cout << "Creating an LfpTrigAvgNode." << std::endl;
            processor = new LfpTriggeredAverageNode();
        }                   
        
        else if (subProcessorType.equalsIgnoreCase("Spike Viewer"))
        {
            std::cout << "Creating a SpikeDisplayNode." << std::endl;
            processor = new SpikeDisplayNode();
        }
        else if (subProcessorType.equalsIgnoreCase("WiFi Output"))
        {
            std::cout << "Creating a WiFi node." << std::endl;
            processor = new WiFiOutput();
        }
        else if (subProcessorType.equalsIgnoreCase("Arduino Output"))
        {
            std::cout << "Creating an Arduino node." << std::endl;
            processor = new ArduinoOutput();
        }
        else if (subProcessorType.equalsIgnoreCase("FPGA Output"))
        {
            std::cout << "Creating an FPGA output node." << std::endl;
            processor = new FPGAOutput();
        }
        else if (subProcessorType.equalsIgnoreCase("Pulse Pal"))
        {
            std::cout << "Creating a Pulse Pal output node." << std::endl;
            processor = new PulsePalOutput();
        }

        sendActionMessage("New sink created.");
    }

    return processor;
}
コード例 #23
0
ファイル: UIComponent.cpp プロジェクト: LabPF/plugin-GUI
bool UIComponent::perform(const InvocationInfo& info)
{

	switch (info.commandID)
	{
		case openConfiguration:
			{
				FileChooser fc("Choose a file to load...",
						CoreServices::getDefaultUserSaveDirectory(),
						"*",
						true);

				if (fc.browseForFileToOpen())
				{
					currentConfigFile = fc.getResult();
					sendActionMessage(getEditorViewport()->loadState(currentConfigFile));
				}
				else
				{
					sendActionMessage("No configuration selected.");
				}

				break;
			}
		case saveConfiguration:
			{

				if (currentConfigFile.exists())
				{
					sendActionMessage(getEditorViewport()->saveState(currentConfigFile));
				}
				else
				{
					FileChooser fc("Choose the file name...",
							CoreServices::getDefaultUserSaveDirectory(),
							"*",
							true);

					if (fc.browseForFileToSave(true))
					{
						currentConfigFile = fc.getResult();
						std::cout << currentConfigFile.getFileName() << std::endl;
						sendActionMessage(getEditorViewport()->saveState(currentConfigFile));
					}
					else
					{
						sendActionMessage("No file chosen.");
					}
				}

				break;
			}

		case saveConfigurationAs:
			{

				FileChooser fc("Choose the file name...",
						CoreServices::getDefaultUserSaveDirectory(),
						"*",
						true);

				if (fc.browseForFileToSave(true))
				{
					currentConfigFile = fc.getResult();
					std::cout << currentConfigFile.getFileName() << std::endl;
					sendActionMessage(getEditorViewport()->saveState(currentConfigFile));
				}
				else
				{
					sendActionMessage("No file chosen.");
				}

				break;
			}

		case reloadOnStartup:
			{
				mainWindow->shouldReloadOnStartup = !mainWindow->shouldReloadOnStartup;

			}
			break;

		case clearSignalChain:
			{
				getEditorViewport()->clearSignalChain();
				break;
			}

		case showHelp:
			{
				URL url = URL("https://open-ephys.atlassian.net/wiki/display/OEW/Open+Ephys+GUI");
				url.launchInDefaultBrowser();
				break;
			}

		case toggleProcessorList:
			processorList->toggleState();
			break;

		case toggleFileInfo:
			controlPanel->toggleState();
			break;

		case toggleSignalChain:
			editorViewportButton->toggleState();
			break;

		case resizeWindow:
			mainWindow->centreWithSize(800, 600);
			break;

		default:
			break;

	}

	return true;

}
コード例 #24
0
GenericProcessor* ProcessorGraph::createProcessorFromDescription(String& description)
{
    int splitPoint = description.indexOf("/");
    String processorType = description.substring(0,splitPoint);
    String subProcessorType = description.substring(splitPoint+1);

    std::cout << processorType << "::" << subProcessorType << std::endl;

    GenericProcessor* processor = 0;

    if (processorType.equalsIgnoreCase("Sources"))
    {

        if (subProcessorType.equalsIgnoreCase("RHA2000-EVAL") ||
            // subProcessorType.equalsIgnoreCase("File Reader") ||
            subProcessorType.equalsIgnoreCase("Custom FPGA") ||
            subProcessorType.equalsIgnoreCase("eCube") || // Added by Michael Borisov
            subProcessorType.equalsIgnoreCase("Rhythm FPGA"))
        {

            // if (subProcessorType.equalsIgnoreCase("Intan Demo Board") &&
            // 	!processorWithSameNameExists(subProcessorType)) {
            // 	std::cout << "Only one Intan Demo Board is allowed at a time."
            // 			  << std::endl;
            // } else {
            std::cout << "Creating a new data source." << std::endl;
            processor = new SourceNode(subProcessorType);

            //}

        }
        else if (subProcessorType.equalsIgnoreCase("Signal Generator"))
        {
            processor = new SignalGenerator();
            std::cout << "Creating a new signal generator." << std::endl;
        }
        else if (subProcessorType.equalsIgnoreCase("Event Generator"))
        {
            processor = new EventNode();
            std::cout << "Creating a new event node." << std::endl;
        }
        else if (subProcessorType.equalsIgnoreCase("File Reader"))
        {
            processor = new FileReader();
            std::cout << "Creating a new file reader." << std::endl;
        }
        else if (subProcessorType.equalsIgnoreCase("Serial Port"))
        {
            processor = new SerialInput();
            std::cout << "Creating a new serial port input." << std::endl;
		}
		else if (subProcessorType.equalsIgnoreCase("Network Events"))
		{
			processor = new NetworkEvents(zmqcontext);
			std::cout << "Creating a new signal generator." << std::endl;
		}



        sendActionMessage("New source node created.");


    }
    else if (processorType.equalsIgnoreCase("Filters"))
    {

        if (subProcessorType.equalsIgnoreCase("Bandpass Filter"))
        {

            std::cout << "Creating a new filter." << std::endl;
            processor = new FilterNode();

        }
        else if (subProcessorType.equalsIgnoreCase("Spike Detector"))
        {
            std::cout << "Creating a new spike detector." << std::endl;
            processor = new SpikeDetector();
        }
        else if (subProcessorType.equalsIgnoreCase("Spike Sorter"))
        {
            std::cout << "Creating a new spike sorter." << std::endl;
            processor = new SpikeSorter();
        }
        else if (subProcessorType.equalsIgnoreCase("Event Detector"))
        {
            std::cout << "Creating a new event detector." << std::endl;
            processor = new EventDetector();
        }
        else if (subProcessorType.equalsIgnoreCase("Phase Detector"))
        {
            std::cout << "Creating a new phase detector." << std::endl;
            processor = new PhaseDetector();
        }
        else if (subProcessorType.equalsIgnoreCase("Channel Map"))
        {
            std::cout << "Creating a new channel mapping node." << std::endl;
            processor = new ChannelMappingNode();
        }

        sendActionMessage("New filter node created.");

    }
    else if (processorType.equalsIgnoreCase("Utilities"))
    {

        if (subProcessorType.equalsIgnoreCase("Splitter"))
        {

            std::cout << "Creating a new splitter." << std::endl;
            processor = new Splitter();

            sendActionMessage("New splitter created.");

        }
        else if (subProcessorType.equalsIgnoreCase("Merger"))
        {

            std::cout << "Creating a new merger." << std::endl;
            processor = new Merger();

            sendActionMessage("New merger created.");

        }
        else if (subProcessorType.equalsIgnoreCase("Record Control"))
        {

            std::cout << "Creating a new record controller." << std::endl;
            processor = new RecordControl();

            sendActionMessage("New record controller created.");

        }

    }
    else if (processorType.equalsIgnoreCase("Sinks"))
    {

        if (subProcessorType.equalsIgnoreCase("LFP Viewer"))
        {
            std::cout << "Creating an LfpDisplayNode." << std::endl;
            processor = new LfpDisplayNode();
        }

        else if (subProcessorType.equalsIgnoreCase("Spike Viewer"))
        {
            std::cout << "Creating a SpikeDisplayNode." << std::endl;
            processor = new SpikeDisplayNode();
        }

        else if (subProcessorType.equalsIgnoreCase("WiFi Output"))
        {
            std::cout << "Creating a WiFi node." << std::endl;
            processor = new WiFiOutput();
        }
        else if (subProcessorType.equalsIgnoreCase("Arduino Output"))
        {
            std::cout << "Creating an Arduino node." << std::endl;
            processor = new ArduinoOutput();
        }
        else if (subProcessorType.equalsIgnoreCase("FPGA Output"))
        {
            std::cout << "Creating an FPGA output node." << std::endl;
            processor = new FPGAOutput();
        }
        else if (subProcessorType.equalsIgnoreCase("Pulse Pal"))
        {
            std::cout << "Creating a Pulse Pal output node." << std::endl;
            processor = new PulsePalOutput();
		}
		else if (subProcessorType.equalsIgnoreCase("PSTH"))
		{
			std::cout << "Creating a PSTH output node." << std::endl;
			processor = new PeriStimulusTimeHistogramNode();
		}

        sendActionMessage("New sink created.");
    }

    return processor;
}
コード例 #25
0
ファイル: CodeWindow.cpp プロジェクト: brantc/cabbage
bool CodeWindow::perform (const InvocationInfo& info)
{
	Logger::writeToLog(String(info.commandID));
	//---------------------------------------------------------------------------------------------
	if(info.commandID==CommandIDs::fileNew)
		{		
			String tempFile = File::getSpecialLocation(File::userHomeDirectory).getFullPathName()+"/liveCodeSession.csd";
			Logger::writeToLog(tempFile);
			csdFile = tempFile;
			csoundDoc.replaceAllContent(csdFile.loadFileAsString());			
			toggleTextWindows();
		}
	else if(info.commandID==CommandIDs::fileSave)
		{
			Logger::writeToLog("fileSaved");
			sendActionMessage("fileSaved");
		}
	else if(info.commandID==CommandIDs::fileSaveAs)
		{
			Logger::writeToLog("fileSaveAs");
			sendActionMessage("fileSaveAs");
		}
	else if(info.commandID==CommandIDs::fileOpen)
		{			
			Logger::writeToLog("fileOpen");
			sendActionMessage("fileOpen");
		}
	else if(info.commandID==CommandIDs::AudioSettings)
		{			
			sendActionMessage("audioSettings");
		}
	else if(info.commandID==CommandIDs::fileQuit)
		{			
		JUCEApplication::getInstance()->systemRequestedQuit();	
		}
		
	else if(info.commandID==CommandIDs::editUndo)
		{			
			textEditor->undo();
		}
		
	else if(info.commandID==CommandIDs::fileKeyboardShorts)
		{				
			DialogWindow::LaunchOptions o;
			o.content.setOwned(new ShortcutsPanel());
			o.dialogTitle                   = TRANS("Keyboard Shortcuts");
			o.dialogBackgroundColour        = Colours::black;
			o.resizable                     = false;
			o.useNativeTitleBar				= false;
			o.escapeKeyTriggersCloseButton  = true;
			//o.content->setLookAndFeel(&this->getLookAndFeel());
			o.launchAsync();			
		}
		
	else if(info.commandID==CommandIDs::editCut)
		{			
			textEditor->cutToClipboard();
		}
	else if(info.commandID==CommandIDs::editCopy)
		{			
			textEditor->copyToClipboard();
		}
	else if(info.commandID==CommandIDs::editPaste)
		{			
			textEditor->pasteFromClipboard();
		}

	else if(info.commandID==CommandIDs::editRedo)
		{			
			textEditor->redo();
		}
	else if(info.commandID==CommandIDs::editToggleText)
		{			
		toggleTextWindows();
		}
		
	else if(info.commandID==CommandIDs::editZoomIn)
		{			
			setFontSize("in");
		}
	else if(info.commandID==CommandIDs::editZoomOut)
		{			
			setFontSize("out");
		}
	else if(info.commandID==CommandIDs::whiteBackground)
		{			
		setEditorColourScheme("white");
		}

	else if(info.commandID==CommandIDs::blackBackground)
		{			
		setEditorColourScheme("dark");
		}

	else if(info.commandID==CommandIDs::insertRecentEvent)
		{
			
		}
	else if(info.commandID==CommandIDs::insertFromRepo)
		{			
		popupDisplay->setVisible(false);
		CodeWindow::insertFromRepo();
		}

	else if(info.commandID==CommandIDs::openPythonEditor)
		{	
		/*if(pythonEditor==nullptr){
			pythonEditor = new PythonEditor("Python Editor");
			//pythonEditor->textEditor->setLookAndFeel(lookAndFeel);
			//pythonEditor->setLookAndFeel(lookAndFeel);
			pythonEditor->addActionListener(this);
			pythonEditor->setAlwaysOnTop(true);
			pythonEditor->setVisible(true);
			pythonEditor->textEditor->setColour(CodeEditorComponent::backgroundColourId, Colour::fromRGB(40, 40, 40));
		}
		
		pythonEditor->toFront(true);
		cabbageTimer->startTimedEvent(1, "pythonFocus");
		//pythonEditor->textEditor->highlightLine("oscil 1");
		
		 */
		}	
		
	else if(info.commandID==CommandIDs::addFromRepo)
		{	
		textEditor->addToRepository();
		}	

	else if(info.commandID==CommandIDs::viewCsoundHelp)
		{
		toggleManuals("Csound");
		}
	
	else if(info.commandID==CommandIDs::viewCabbageHelp)
		{
		toggleManuals("Cabbage");
		}
				
return true;
}
コード例 #26
0
bool UIComponent::perform(const InvocationInfo& info)
{

    switch (info.commandID)
    {
        case openConfiguration:
            {
                FileChooser fc("Choose a file to load...",
                               File::getCurrentWorkingDirectory(),
                               "*.xml",
                               true);

                if (fc.browseForFileToOpen())
                {
                    File currentFile = fc.getResult();
                    sendActionMessage(getEditorViewport()->loadState(currentFile));
                }
                else
                {
                    sendActionMessage("No configuration selected.");
                }

                break;
            }
        case saveConfiguration:
            {

                FileChooser fc("Choose the file to save...",
                               File::getCurrentWorkingDirectory(),
                               "*",
                               true);

                if (fc.browseForFileToSave(true))
                {
                    File currentFile = fc.getResult();
                    std::cout << currentFile.getFileName() << std::endl;
                    sendActionMessage(getEditorViewport()->saveState(currentFile));
                }
                else
                {
                    sendActionMessage("No file chosen.");
                }

                break;
            }
        case clearSignalChain:
            getEditorViewport()->clearSignalChain();
            break;

        case showHelp:
            std::cout << "SHOW ME SOME HELP!" << std::endl;
            break;

        case toggleProcessorList:
            processorList->toggleState();
            break;

        case toggleFileInfo:
            controlPanel->toggleState();
            break;

        case toggleSignalChain:
            editorViewportButton->toggleState();
            break;

        default:
            break;

    }

    return true;

}
コード例 #27
0
ファイル: SpikeDetectorEditor.cpp プロジェクト: AGenews/GUI
void SpikeDetectorEditor::buttonEvent(Button* button)
{


    if (electrodeButtons.contains((ElectrodeButton*) button))
    {

        if (electrodeEditorButtons[0]->getToggleState()) // EDIT is active
        {
            ElectrodeButton* eb = (ElectrodeButton*) button;
            int electrodeNum = eb->getChannelNum()-1;

           // std::cout << "Channel number: " << electrodeNum << std::endl;
            Array<int> a;
            a.add(electrodeNum);
            channelSelector->setActiveChannels(a);

            SpikeDetector* processor = (SpikeDetector*) getProcessor();

            thresholdSlider->setActive(true);
            thresholdSlider->setValue(processor->getChannelThreshold(electrodeList->getSelectedItemIndex(),
                                                                     electrodeButtons.indexOf((ElectrodeButton*) button)));
        }
        else
        {

            SpikeDetector* processor = (SpikeDetector*) getProcessor();

            ElectrodeButton* eb = (ElectrodeButton*) button;
            int electrodeNum = electrodeList->getSelectedItemIndex();
            int channelNum = electrodeButtons.indexOf(eb);

            processor->setChannelActive(electrodeNum,
                                        channelNum,
                                        button->getToggleState());

            std::cout << "Disabling channel " << channelNum <<
                      " of electrode " << electrodeNum << std::endl;

        }


    }


    int num = numElectrodes->getText().getIntValue();

    if (button == upButton)
    {
        numElectrodes->setText(String(++num), sendNotification);

        return;

    }
    else if (button == downButton)
    {

        if (num > 1)
            numElectrodes->setText(String(--num), sendNotification);

        return;

    }
    else if (button == plusButton)
    {
        // std::cout << "Plus button pressed!" << std::endl;
        if (acquisitionIsActive)
        {
            sendActionMessage("Stop acquisition before adding electrodes.");
            return;
        }

        int type = electrodeTypes->getSelectedId();
       // std::cout << type << std::endl;
        int nChans;

        switch (type)
        {
            case 1:
                nChans = 1;
                break;
            case 2:
                nChans = 2;
                break;
            case 3:
                nChans = 4;
                break;
            default:
                nChans = 1;
        }

        for (int n = 0; n < num; n++)
        {
            if (!addElectrode(nChans))
            {
                sendActionMessage("Not enough channels to add electrode.");
            }
        }

        electrodeEditorButtons[1]->setToggleState(false, false);

        getEditorViewport()->makeEditorVisible(this, true, true);
        return;

    }
    else if (button == electrodeEditorButtons[0])   // EDIT
    {

        Array<int> activeChannels;

        for (int i = 0; i < electrodeButtons.size(); i++)
        {
            if (button->getToggleState())
            {
                electrodeButtons[i]->setToggleState(false, false);
                electrodeButtons[i]->setRadioGroupId(299);
                channelSelector->activateButtons();
                channelSelector->setRadioStatus(true);
            }
            else
            {
                electrodeButtons[i]->setToggleState(true, false);
                electrodeButtons[i]->setRadioGroupId(0);
                channelSelector->inactivateButtons();
                channelSelector->setRadioStatus(false);
                activeChannels.add(electrodeButtons[i]->getChannelNum()-1);
            }
        }


        if (!button->getToggleState())
        {
            thresholdSlider->setActive(false);

            // This will be -1 with nothing selected
            int selectedItemIndex = electrodeList->getSelectedItemIndex();
            if (selectedItemIndex != -1)
            {
                drawElectrodeButtons(selectedItemIndex);
            }
            else
            {
                electrodeButtons.clear();
            }
        }

        //   channelSelector->setActiveChannels(activeChannels);

        return;

    }
    else if (button == electrodeEditorButtons[1])   // MONITOR
    {

        Button* audioMonitorButton = electrodeEditorButtons[1];

        channelSelector->clearAudio();

        SpikeDetector* processor = (SpikeDetector*) getProcessor();

        Array<Electrode*> electrodes = processor->getElectrodes();

        for (int i = 0; i < electrodes.size(); i++)
        {
            Electrode* e = electrodes[i];
            e->isMonitored = false;
        }

        Electrode* e = processor->getActiveElectrode();

        if (e != nullptr)
        {

            e->isMonitored = audioMonitorButton->getToggleState();

            for (int i = 0; i < e->numChannels; i++)
            {
                std::cout << "Channel " << e->channels[i] << std::endl;
                int channelNum = e->channels[i];
                channelSelector->setAudioStatus(channelNum, audioMonitorButton->getToggleState());

            }
        } else {
            audioMonitorButton->setToggleState(false, false);
        }

        return;
    }
    else if (button == electrodeEditorButtons[2])   // DELETE
    {
        if (acquisitionIsActive)
        {
            sendActionMessage("Stop acquisition before deleting electrodes.");
            return;
        }
    
        removeElectrode(electrodeList->getSelectedItemIndex());

        getEditorViewport()->makeEditorVisible(this, true, true);

        return;
    }



}
コード例 #28
0
void SpikeDetectorEditor::buttonEvent(Button* button)
{

    if (electrodeEditorButtons[0]->getToggleState()) // EDIT is active
    {

        std::cout << "Editing active." << std::endl;

        if (electrodeButtons.contains((ElectrodeButton*) button))
        {
            ElectrodeButton* eb = (ElectrodeButton*) button;
            int electrodeNum = eb->getChannelNum()-1;

            std::cout << "Channel number: " << electrodeNum << std::endl;
            Array<int> a;
            a.add(electrodeNum);
            channelSelector->setActiveChannels(a);

            SpikeDetector* processor = (SpikeDetector*) getProcessor();

            thresholdSlider->setActive(true);
            thresholdSlider->setValue(processor->getChannelThreshold(electrodeList->getSelectedItemIndex(),
                                                                     electrodeButtons.indexOf((ElectrodeButton*) button)));
        }
    }

    int num = numElectrodes->getText().getIntValue();

    if (button == upButton)
    {
        numElectrodes->setText(String(++num), true);

        return;

    }
    else if (button == downButton)
    {

        if (num > 1)
            numElectrodes->setText(String(--num), true);

        return;

    }
    else if (button == plusButton)
    {
        // std::cout << "Plus button pressed!" << std::endl;

        int type = electrodeTypes->getSelectedId();
        std::cout << type << std::endl;
        int nChans;

        switch (type)
        {
            case 1:
                nChans = 1;
                break;
            case 2:
                nChans = 2;
                break;
            case 3:
                nChans = 4;
                break;
            default:
                nChans = 1;
        }

        for (int n = 0; n < num; n++)
        {
            if (!addElectrode(nChans))
            {
                sendActionMessage("Not enough channels to add electrode.");
            }
        }

        refreshElectrodeList();

        if (electrodeList->getNumItems() > 0)
        {
            electrodeList->setSelectedId(electrodeList->getNumItems(), true);
            electrodeList->setText(electrodeList->getItemText(electrodeList->getNumItems()-1));
            lastId = electrodeList->getNumItems();
            electrodeList->setEditableText(true);

            drawElectrodeButtons(electrodeList->getNumItems()-1);
        }

        getEditorViewport()->makeEditorVisible(this, true, true);
        return;

    }
    else if (button == electrodeEditorButtons[0])   // EDIT
    {

        Array<int> activeChannels;

        for (int i = 0; i < electrodeButtons.size(); i++)
        {
            if (button->getToggleState())
            {
                electrodeButtons[i]->setToggleState(false, false);
                electrodeButtons[i]->setRadioGroupId(299);
                channelSelector->activateButtons();
                channelSelector->setRadioStatus(true);
            }
            else
            {
                electrodeButtons[i]->setToggleState(true, false);
                electrodeButtons[i]->setRadioGroupId(0);
                channelSelector->inactivateButtons();
                channelSelector->setRadioStatus(false);
                activeChannels.add(electrodeButtons[i]->getChannelNum()-1);
            }
        }


        if (!button->getToggleState())
        {
            thresholdSlider->setActive(false);

            // This will be -1 with nothing selected
            int selectedItemIndex = electrodeList->getSelectedItemIndex();
            if (selectedItemIndex != -1)
            {
                drawElectrodeButtons(selectedItemIndex);
            }
            else
            {
                electrodeButtons.clear();
            }
        }

        //   channelSelector->setActiveChannels(activeChannels);

        return;

    }
    else if (button == electrodeEditorButtons[1])   // MONITOR
    {
        return;
    }
    else if (button == electrodeEditorButtons[2])   // DELETE
    {

        removeElectrode(electrodeList->getSelectedItemIndex());

        getEditorViewport()->makeEditorVisible(this, true, true);

        return;
    }



}