From 9f95846c38069648247a9691621d3a8f2979c9f3 Mon Sep 17 00:00:00 2001 From: jsiegle <jsiegle@mit.edu> Date: Wed, 11 Apr 2012 16:11:41 -0400 Subject: [PATCH] Added ParameterEditor files --- Builds/Linux/Makefile | 6 + .../open-ephys.xcodeproj/project.pbxproj | 6 + Source/Processors/Editors/GenericEditor.cpp | 30 ++- Source/Processors/Editors/GenericEditor.h | 1 + Source/Processors/Editors/ParameterEditor.cpp | 231 ++++++++++++++++++ Source/Processors/Editors/ParameterEditor.h | 96 ++++++++ .../Editors/SignalGeneratorEditor.cpp | 8 +- Source/Processors/GenericProcessor.cpp | 30 ++- Source/Processors/GenericProcessor.h | 5 +- Source/Processors/Parameter.cpp | 2 +- Source/Processors/Parameter.h | 2 + Source/Processors/SignalGenerator.cpp | 11 +- open-ephys.jucer | 4 + 13 files changed, 410 insertions(+), 22 deletions(-) create mode 100644 Source/Processors/Editors/ParameterEditor.cpp create mode 100644 Source/Processors/Editors/ParameterEditor.h diff --git a/Builds/Linux/Makefile b/Builds/Linux/Makefile index ee7bed610..73471e695 100644 --- a/Builds/Linux/Makefile +++ b/Builds/Linux/Makefile @@ -85,6 +85,7 @@ OBJECTS := \ $(OBJDIR)/SpikeDetector_300d85e7.o \ $(OBJDIR)/AudioNode_94606ff3.o \ $(OBJDIR)/EventNode_95c842b7.o \ + $(OBJDIR)/ParameterEditor_91f62ae8.o \ $(OBJDIR)/SpikeDisplayEditor_e1812c1.o \ $(OBJDIR)/VisualizerEditor_3672b003.o \ $(OBJDIR)/MergerEditor_d1fcc0df.o \ @@ -356,6 +357,11 @@ $(OBJDIR)/EventNode_95c842b7.o: ../../Source/Processors/EventNode.cpp @echo "Compiling EventNode.cpp" @$(CXX) $(CXXFLAGS) -o "$@" -c "$<" +$(OBJDIR)/ParameterEditor_91f62ae8.o: ../../Source/Processors/Editors/ParameterEditor.cpp + -@mkdir -p $(OBJDIR) + @echo "Compiling ParameterEditor.cpp" + @$(CXX) $(CXXFLAGS) -o "$@" -c "$<" + $(OBJDIR)/SpikeDisplayEditor_e1812c1.o: ../../Source/Processors/Editors/SpikeDisplayEditor.cpp -@mkdir -p $(OBJDIR) @echo "Compiling SpikeDisplayEditor.cpp" diff --git a/Builds/MacOSX/open-ephys.xcodeproj/project.pbxproj b/Builds/MacOSX/open-ephys.xcodeproj/project.pbxproj index e402638d5..9681d71e8 100644 --- a/Builds/MacOSX/open-ephys.xcodeproj/project.pbxproj +++ b/Builds/MacOSX/open-ephys.xcodeproj/project.pbxproj @@ -59,6 +59,7 @@ 4BE0DDA01B73223EF0BD934A = { isa = PBXBuildFile; fileRef = 3DD0741FCFBC7563EC722D9B; }; 08B501E0D7764C6B613AF529 = { isa = PBXBuildFile; fileRef = B7750B27E4F3748ECCCCF69D; }; 9CBA3837CC8CAA03A03F2D9C = { isa = PBXBuildFile; fileRef = FA57CE4F63FF1592D6B3F9B5; }; + 632C915D01C42D27E828BFA9 = { isa = PBXBuildFile; fileRef = 47ECF9384C1D27EB2FBEBF9E; }; DD22A06702F4CF995893DD5C = { isa = PBXBuildFile; fileRef = F0B09605D4108F0F94EF3B57; }; F4CEF74DDCD7EFA0891249B5 = { isa = PBXBuildFile; fileRef = 9A3976537C96B39716B5312D; }; 93A3E6284F2DAED3F491332B = { isa = PBXBuildFile; fileRef = AD73EA6B24378294003DC2D0; }; @@ -263,6 +264,8 @@ 12866D44BE115E8837468F48 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = AudioNode.h; path = ../../Source/Processors/AudioNode.h; sourceTree = SOURCE_ROOT; }; FA57CE4F63FF1592D6B3F9B5 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = EventNode.cpp; path = ../../Source/Processors/EventNode.cpp; sourceTree = SOURCE_ROOT; }; 32163C956C8A6F5C1DD7FE7F = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = EventNode.h; path = ../../Source/Processors/EventNode.h; sourceTree = SOURCE_ROOT; }; + 47ECF9384C1D27EB2FBEBF9E = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = ParameterEditor.cpp; path = ../../Source/Processors/Editors/ParameterEditor.cpp; sourceTree = SOURCE_ROOT; }; + 07363B9FB8F988D45C4F0FE2 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = ParameterEditor.h; path = ../../Source/Processors/Editors/ParameterEditor.h; sourceTree = SOURCE_ROOT; }; F0B09605D4108F0F94EF3B57 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = SpikeDisplayEditor.cpp; path = ../../Source/Processors/Editors/SpikeDisplayEditor.cpp; sourceTree = SOURCE_ROOT; }; 2A46D8E3EC7207D969A2B202 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SpikeDisplayEditor.h; path = ../../Source/Processors/Editors/SpikeDisplayEditor.h; sourceTree = SOURCE_ROOT; }; 9A3976537C96B39716B5312D = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = VisualizerEditor.cpp; path = ../../Source/Processors/Editors/VisualizerEditor.cpp; sourceTree = SOURCE_ROOT; }; @@ -498,6 +501,8 @@ 0C5335B0E57C9DC92FC57E5F, 7738F51AE0EC63D76EE0F761 ); name = Visualization; sourceTree = "<group>"; }; 953CC35B9116404D6AA8D1C7 = { isa = PBXGroup; children = ( + 47ECF9384C1D27EB2FBEBF9E, + 07363B9FB8F988D45C4F0FE2, F0B09605D4108F0F94EF3B57, 2A46D8E3EC7207D969A2B202, 9A3976537C96B39716B5312D, @@ -753,6 +758,7 @@ 4BE0DDA01B73223EF0BD934A, 08B501E0D7764C6B613AF529, 9CBA3837CC8CAA03A03F2D9C, + 632C915D01C42D27E828BFA9, DD22A06702F4CF995893DD5C, F4CEF74DDCD7EFA0891249B5, 93A3E6284F2DAED3F491332B, diff --git a/Source/Processors/Editors/GenericEditor.cpp b/Source/Processors/Editors/GenericEditor.cpp index b44d1a867..496e2ea1e 100644 --- a/Source/Processors/Editors/GenericEditor.cpp +++ b/Source/Processors/Editors/GenericEditor.cpp @@ -23,6 +23,7 @@ #include "GenericEditor.h" +#include "ParameterEditor.h" #include "../ProcessorGraph.h" #include "../RecordNode.h" #include "../../UI/ProcessorList.h" @@ -79,13 +80,24 @@ GenericEditor::GenericEditor (GenericProcessor* owner)//, FilterViewport* vp) audioChannels.clear(); recordChannels.clear(); - backgroundGradient = ColourGradient(Colour(190, 190, 190), 0.0f, 150.0f, - Colour(145, 145, 145), 0.0f, 0.0f, false); + backgroundGradient = ColourGradient(Colour(190, 190, 190), 0.0f, 0.0f, + Colour(185, 185, 185), 0.0f, 120.0f, false); - //grad.addColour(0.5f, Colour(170, 170, 170)); + //backgroundGradient.addColour(0.05f, Colour(255, 255, 255)); + backgroundGradient.addColour(0.2f, Colour(155, 155, 155)); //grad.addColour(0.5, Colours::lightgrey); //grad.addColour(1.0f, Colours::grey); + for (int i = 0; i < owner->getNumParameters(); i++) + { + ParameterEditor* p = new ParameterEditor(owner->getParameterReference(i), titleFont); + p->setBounds(20, 40, 120, 30); + addAndMakeVisible(p); + } + + backgroundColor = Colour(10,10,10); + + //refreshColors(); fadeIn(); } @@ -260,12 +272,12 @@ void GenericEditor::paint (Graphics& g) // draw highlight box g.drawRect(0,0,getWidth(),getHeight(),2.0); - if (isFading) - { - g.setColour(Colours::black.withAlpha((float) (10.0-accumulator)/10.0f)); - if (getWidth() > 0 && getHeight() > 0) - g.fillAll(); - } + // if (isFading) + // { + // g.setColour(Colours::black.withAlpha((float) (10.0-accumulator)/10.0f)); + // if (getWidth() > 0 && getHeight() > 0) + // g.fillAll(); + // } } diff --git a/Source/Processors/Editors/GenericEditor.h b/Source/Processors/Editors/GenericEditor.h index 5530b679b..34698c152 100644 --- a/Source/Processors/Editors/GenericEditor.h +++ b/Source/Processors/Editors/GenericEditor.h @@ -48,6 +48,7 @@ class EditorButton; class ChannelSelectorButton; class TriangleButton; class PlusButton; +class ParameterEditor; class GenericEditor : public AudioProcessorEditor, public Timer, diff --git a/Source/Processors/Editors/ParameterEditor.cpp b/Source/Processors/Editors/ParameterEditor.cpp new file mode 100644 index 000000000..1173c1318 --- /dev/null +++ b/Source/Processors/Editors/ParameterEditor.cpp @@ -0,0 +1,231 @@ +/* + ------------------------------------------------------------------ + + This file is part of the Open Ephys GUI + Copyright (C) 2012 Open Ephys + + ------------------------------------------------------------------ + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + +*/ + +#include "ParameterEditor.h" + +ParameterEditor::ParameterEditor(Parameter& p, Font labelFont) +{ + + if (p.isBoolean()) + { + std::cout << "Boolean parameter. Creating checkbox." << std::endl; + // create checkbox + //ParameterCheckbox* pc = new ParameterCheckbox(p.getName()); + //addAndMakeVisible(pc); + //pc->setBounds(0,0,getWidth(), getHeight()); + + } else if (p.isContinuous()) + { + std::cout << "Continuous parameter. Creating slider." << std::endl; + // create slider + //ParameterSlider* ps = new ParameterSlider(p.getName(), p.getPossibleValues()); + + } else if (p.isDiscrete()) + { + std::cout << "Discrete parameter. Creating buttons." << std::endl; + // create buttons + Label* label = new Label(p.getName(), p.getName()); + labelFont.setHeight(10); + label->setColour(Label::textColourId, Colours::darkgrey); + label->setFont(labelFont); + label->setBounds(0, 0, 100, 10); + addAndMakeVisible(label); + + Array<var> possibleValues = p.getPossibleValues(); + + int buttonWidth = 35; + + std::cout << "Button width: " << buttonWidth << std::endl; + + std::cout << "Default value: " << (int) p.getDefaultValue() << std::endl; + + for (int i = 0; i < possibleValues.size(); i++) + { + std::cout << "Creating button " << i << std::endl; + int buttonType = MIDDLE; + if (i == 0) + buttonType = LEFT; + else if (i == possibleValues.size()-1) + buttonType = RIGHT; + + ParameterButton* pb = new ParameterButton(possibleValues[i], buttonType, labelFont); + pb->setBounds(buttonWidth*i, 12, buttonWidth, 18); + + if (i == (int) p.getDefaultValue()) + pb->setToggleState(true, false); + + componentArray.add(pb); + addAndMakeVisible(pb); + + } + } +} + +ParameterEditor::~ParameterEditor() +{ + deleteAllChildren(); +} + +void ParameterEditor::paint(Graphics& g) +{ + + // Path p; + // PathStrokeType pst = PathStrokeType(2.0f); + + // float radius = 10.0f; + + // p.startNewSubPath(0, radius); + // p.addArc(0, 0, radius*2, radius*2, 1.5*double_Pi, 2.0*double_Pi ); + + // p.lineTo(getWidth() - radius, 0);//getHeight()); + // p.addArc(getWidth()-radius*2, 0, radius*2, radius*2, 0, 0.5*double_Pi); + + // p.lineTo(getWidth(), getHeight()-radius); + // p.addArc(getWidth()-radius*2, getHeight()-radius*2, radius*2, radius*2, 0.5*double_Pi, double_Pi); + + // p.lineTo(radius, getHeight()); + // p.addArc(0, getHeight()-radius*2, radius*2, radius*2, double_Pi, 1.5*double_Pi); + // p.closeSubPath(); + // //p.lineTo(0, radius); + + // g.setColour(Colours::grey); + // //g.strokePath(p, pst); + // g.fillPath(p); + // //g.setColour(Colours::grey) + // ColourGradient grad = ColourGradient(Colour(220,220,220),0.0,0.0, + // Colour(170,170,170),0.0, getHeight(), + // false); + // //grad.addColour(0.5f, Colour(50,50,50)); + // g.setGradientFill(grad); + + // AffineTransform a = AffineTransform::scale(0.98f, 0.94f, float(getWidth())/2.0f, + // float(getHeight())/2.0f); + // //a.scaled(0.7, 0.7); + // g.fillPath(p, a); + + + +} + +/// ============= PARAMETER BUTTON ================== + +ParameterButton::ParameterButton(var value, int buttonType, Font labelFont) : + Button("parameter"), type(buttonType), valueString(value.toString()), + font(labelFont) +{ + + setRadioGroupId(1999); + setClickingTogglesState(true); + + + selectedGrad = ColourGradient(Colour(240,179,12),0.0,0.0, + Colour(207,160,33),0.0, 20.0f, + false); + selectedOverGrad = ColourGradient(Colour(209,162,33),0.0, 5.0f, + Colour(190,150,25),0.0, 0.0f, + false); + neutralGrad = ColourGradient(Colour(220,220,220),0.0,0.0, + Colour(170,170,170),0.0, 20.0f, + false); + neutralOverGrad = ColourGradient(Colour(180,180,180),0.0,5.0f, + Colour(150,150,150),0.0, 0.0, + false); + + +} + +void ParameterButton::paintButton(Graphics& g, bool isMouseOver, bool isButtonDown) +{ + g.setColour(Colours::grey); + g.fillPath(outlinePath); + + if (getToggleState()) + { + if (isMouseOver) + g.setGradientFill(selectedOverGrad); + else + g.setGradientFill(selectedGrad); + } else { + if (isMouseOver) + g.setGradientFill(neutralOverGrad); + else + g.setGradientFill(neutralGrad); + } + + AffineTransform a = AffineTransform::scale(0.98f, 0.94f, float(getWidth())/2.0f, + float(getHeight())/2.0f); + g.fillPath(outlinePath, a); + + font.setHeight(12.0f); + int stringWidth = font.getStringWidth(valueString); + + g.setFont(font); + + g.setColour(Colours::darkgrey); + g.drawSingleLineText(valueString, getWidth()/2 - stringWidth/2, 12); + + + +}; + +void ParameterButton::resized() +{ + + + float radius = 5.0f; + + if (type == LEFT) + { + outlinePath.startNewSubPath(0, radius); + outlinePath.addArc(0, 0, radius*2, radius*2, 1.5*double_Pi, 2.0*double_Pi ); + + outlinePath.lineTo(getWidth(), 0);//getHeight()); + + outlinePath.lineTo(getWidth(), getHeight()); + + outlinePath.lineTo(radius, getHeight()); + outlinePath.addArc(0, getHeight()-radius*2, radius*2, radius*2, double_Pi, 1.5*double_Pi); + outlinePath.closeSubPath(); + + } else if (type == RIGHT) + { + outlinePath.startNewSubPath(0, 0); + + outlinePath.lineTo(getWidth()-radius, 0); + + outlinePath.addArc(getWidth()-radius*2, 0, radius*2, radius*2, 0, 0.5*double_Pi); + + outlinePath.lineTo(getWidth(), getHeight()-radius); + + outlinePath.addArc(getWidth()-radius*2, getHeight()-radius*2, radius*2, radius*2, 0.5*double_Pi, double_Pi); + + outlinePath.lineTo(0, getHeight()); + outlinePath.closeSubPath(); + + + } else if (type == MIDDLE) + { + outlinePath.addRectangle(0,0,getWidth(),getHeight()); + } +} + diff --git a/Source/Processors/Editors/ParameterEditor.h b/Source/Processors/Editors/ParameterEditor.h new file mode 100644 index 000000000..7dbf4f931 --- /dev/null +++ b/Source/Processors/Editors/ParameterEditor.h @@ -0,0 +1,96 @@ +/* + ------------------------------------------------------------------ + + This file is part of the Open Ephys GUI + Copyright (C) 2012 Open Ephys + + ------------------------------------------------------------------ + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + +*/ + +#include "../../../JuceLibraryCode/JuceHeader.h" +#include "GenericEditor.h" +#include "../Parameter.h" +#include <stdio.h> + +#ifndef __PARAMETEREDITOR_H_44537DA9__ +#define __PARAMETEREDITOR_H_44537DA9__ + +/** + + Automatically creates an interactive editor for a particular + parameter. + + @see GenericEditor, Parameter + +*/ + +class ParameterEditor : public Component + +{ +public: + ParameterEditor(Parameter& p, Font labelFont); + ~ParameterEditor(); + + +private: + + void paint(Graphics& g); + + Array<Component*> componentArray; + + enum { + LEFT, + MIDDLE, + RIGHT + }; + +}; + +class ParameterButton : public Button + +{ +public: + ParameterButton(var value, int buttonType, Font labelFont); + ~ParameterButton() {} + +private: + void paintButton(Graphics& g, bool isMouseOver, bool isButtonDown); + + void resized(); + + int type; + + Path outlinePath; + + const String valueString; + + Font font; + + ColourGradient selectedGrad; + ColourGradient selectedOverGrad; + ColourGradient neutralGrad; + ColourGradient neutralOverGrad; + + enum { + LEFT, + MIDDLE, + RIGHT + }; + +}; + +#endif // __PARAMETEREDITOR_H_44537DA9__ diff --git a/Source/Processors/Editors/SignalGeneratorEditor.cpp b/Source/Processors/Editors/SignalGeneratorEditor.cpp index faddc33b5..57124b20d 100644 --- a/Source/Processors/Editors/SignalGeneratorEditor.cpp +++ b/Source/Processors/Editors/SignalGeneratorEditor.cpp @@ -43,7 +43,7 @@ SignalGeneratorEditor::SignalGeneratorEditor (GenericProcessor* parentNode) ws->setBounds(15 + (buttonWidth)*i, 30, buttonWidth, buttonHeight); ws->addListener(this); waveformSelectors.add(ws); - addAndMakeVisible(ws); + addChildComponent(ws); } amplitudeSlider = new Slider ("Amplitude Slider"); @@ -52,7 +52,7 @@ SignalGeneratorEditor::SignalGeneratorEditor (GenericProcessor* parentNode) amplitudeSlider->addListener(this); amplitudeSlider->setSliderStyle(Slider::Rotary); amplitudeSlider->setTextBoxStyle(Slider::TextBoxBelow, false, 40, 20); - addAndMakeVisible(amplitudeSlider); + addChildComponent(amplitudeSlider); frequencySlider = new Slider ("Frequency Slider"); frequencySlider->setBounds(70,60,50,60); @@ -60,7 +60,7 @@ SignalGeneratorEditor::SignalGeneratorEditor (GenericProcessor* parentNode) frequencySlider->addListener(this); frequencySlider->setSliderStyle(Slider::Rotary); frequencySlider->setTextBoxStyle(Slider::TextBoxBelow, false, 40, 20); - addAndMakeVisible(frequencySlider); + addChildComponent(frequencySlider); phaseSlider = new Slider ("Phase Slider"); phaseSlider->setBounds(130,60,50,60); @@ -68,7 +68,7 @@ SignalGeneratorEditor::SignalGeneratorEditor (GenericProcessor* parentNode) phaseSlider->addListener(this); phaseSlider->setSliderStyle(Slider::Rotary); phaseSlider->setTextBoxStyle(Slider::TextBoxBelow, false, 40, 20); - addAndMakeVisible(phaseSlider); + addChildComponent(phaseSlider); numChannelsLabel = new Label("Number of Channels","1"); numChannelsLabel->setEditable(true); diff --git a/Source/Processors/GenericProcessor.cpp b/Source/Processors/GenericProcessor.cpp index 16f70eb2f..0e96ba642 100644 --- a/Source/Processors/GenericProcessor.cpp +++ b/Source/Processors/GenericProcessor.cpp @@ -30,7 +30,7 @@ GenericProcessor::GenericProcessor(const String& name_) : isEnabled(true), saveOrder(-1), loadOrder(-1), nextAvailableChannel(0), currentChannel(-1), - wasConnected(false) + wasConnected(false), nullParam("VOID", false) { } @@ -44,13 +44,37 @@ AudioProcessorEditor* GenericProcessor::createEditor() return editor; } +Parameter& GenericProcessor::getParameterByName(String name_) +{ + // doesn't work + for (int i = 0; i < getNumParameters(); i++) + { + + Parameter& p = parameters.getReference(i); + const String parameterName = p.getName(); + + if (parameterName.compare(name_) == 0) // fails at this point + return p;//parameters.getReference(i); + } + + + return nullParam; + +} + +Parameter& GenericProcessor::getParameterReference(int parameterIndex) +{ + + return parameters.getReference(parameterIndex); + +} void GenericProcessor::setParameter (int parameterIndex, float newValue) { if (currentChannel > 0) { - //Parameter& p = parameters[parameterIndex]; - //parameters[parameterIndex].setValue(newValue, currentChannel); + Parameter& p = parameters.getReference(parameterIndex); + p.setValue(newValue, currentChannel); } } diff --git a/Source/Processors/GenericProcessor.h b/Source/Processors/GenericProcessor.h index 8e1a3e4e3..d530a434b 100644 --- a/Source/Processors/GenericProcessor.h +++ b/Source/Processors/GenericProcessor.h @@ -51,7 +51,7 @@ class EditorViewport; class DataViewport; class UIComponent; class GenericEditor; -//class Parameter; +class Parameter; class GenericProcessor : public AudioProcessor, public AccessClass @@ -103,6 +103,7 @@ public: float getParameter (int parameterIndex) {return 1.0;} Parameter& getParameterByName(String parameterName); + Parameter& getParameterReference(int parameterIndex); //---------------------------------------------------------------------- // Custom methods: @@ -234,6 +235,8 @@ public: Array<Parameter> parameters; StringArray parameterNames; + Parameter nullParam; + private: void processBlock (AudioSampleBuffer &buffer, MidiBuffer &midiMessages); diff --git a/Source/Processors/Parameter.cpp b/Source/Processors/Parameter.cpp index d68d52698..349506160 100644 --- a/Source/Processors/Parameter.cpp +++ b/Source/Processors/Parameter.cpp @@ -57,7 +57,7 @@ Parameter::Parameter(const String& name_, Array<var> a, int defaultVal) : name(name_), description("") { possibleValues = a; - defaultValue = possibleValues[defaultVal]; + defaultValue = defaultVal; //possibleValues[defaultVal]; isCont = false; isDisc = true; diff --git a/Source/Processors/Parameter.h b/Source/Processors/Parameter.h index 89a2c352e..89f78dc2c 100644 --- a/Source/Processors/Parameter.h +++ b/Source/Processors/Parameter.h @@ -53,6 +53,8 @@ public: const String& getDescription() {return description;} void addDescription(const String& desc) {description = desc;} + var getDefaultValue() {return defaultValue;} + Array<var> getPossibleValues() {return possibleValues;} void setValue(float val, int chan); diff --git a/Source/Processors/SignalGenerator.cpp b/Source/Processors/SignalGenerator.cpp index 35b192f45..76234e65c 100644 --- a/Source/Processors/SignalGenerator.cpp +++ b/Source/Processors/SignalGenerator.cpp @@ -35,12 +35,15 @@ SignalGenerator::SignalGenerator() { - // const String n = "Test"; + // create parameters, to be passed to the GenericEditor - Parameter p = Parameter("Bill",true); + //String paramName = String("Bill"); + Array<var> a; + a.add(1); + a.add(2); + a.add(3); - p.setValue(0.0f, 0); - bool a = p[0]; + Parameter p = Parameter("Paramter name",a,0); parameters.add(p); diff --git a/open-ephys.jucer b/open-ephys.jucer index 5eb088f97..bfaed967d 100644 --- a/open-ephys.jucer +++ b/open-ephys.jucer @@ -255,6 +255,10 @@ <FILE id="hGnGAjh" name="EventNode.cpp" compile="1" resource="0" file="Source/Processors/EventNode.cpp"/> <FILE id="dUtRN6" name="EventNode.h" compile="0" resource="0" file="Source/Processors/EventNode.h"/> <GROUP id="AqvwO6w" name="Editors"> + <FILE id="qWhyk9h" name="ParameterEditor.cpp" compile="1" resource="0" + file="Source/Processors/Editors/ParameterEditor.cpp"/> + <FILE id="3PkZxza" name="ParameterEditor.h" compile="0" resource="0" + file="Source/Processors/Editors/ParameterEditor.h"/> <FILE id="s5YUmi" name="SpikeDisplayEditor.cpp" compile="1" resource="0" file="Source/Processors/Editors/SpikeDisplayEditor.cpp"/> <FILE id="EE43GV" name="SpikeDisplayEditor.h" compile="0" resource="0" -- GitLab