Skip to content

Commit

Permalink
Add displayName for Parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
medengineer committed Jul 7, 2023
1 parent bb272ee commit 7a85fb8
Show file tree
Hide file tree
Showing 17 changed files with 167 additions and 47 deletions.
10 changes: 5 additions & 5 deletions Plugins/ArduinoOutput/ArduinoOutput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ ArduinoOutput::ArduinoOutput()
, gateIsOpen (true)
, deviceSelected (false)
{
addCategoricalParameter(Parameter::PROCESSOR_SCOPE, "Device", "The Arduino device to use", getDevices(), 0);
addIntParameter(Parameter::PROCESSOR_SCOPE, "Output Pin", "The Arduino pin to use", 13, 0, 13);
addIntParameter(Parameter::STREAM_SCOPE, "Input Line", "The TTL line for triggering output", 1, 1, 16);
addIntParameter(Parameter::STREAM_SCOPE, "Gate Line", "The TTL line for gating the output", 0, 0, 16);
addCategoricalParameter(Parameter::PROCESSOR_SCOPE, "device", "Device", "The Arduino device to use", getDevices(), 0);
addIntParameter(Parameter::PROCESSOR_SCOPE, "output_pin", "Output pin", "The Arduino pin to use", 13, 0, 13);
addIntParameter(Parameter::STREAM_SCOPE, "input_line", "Input line", "The TTL line for triggering output", 1, 1, 16);
addIntParameter(Parameter::STREAM_SCOPE, "gate_line", "Gate line", "The TTL line for gating the output", 0, 0, 16);
}


Expand Down Expand Up @@ -136,7 +136,7 @@ bool ArduinoOutput::stopAcquisition()

void ArduinoOutput::parameterValueChanged(Parameter* param)
{
if (param->getName().equalsIgnoreCase("Device"))
if (param->getName().equalsIgnoreCase("device"))
{
setDevice(getDevices()[param->getValue()]);
}
Expand Down
7 changes: 7 additions & 0 deletions Plugins/BasicSpikeDisplay/SpikeDetector/SpikeDetector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -504,19 +504,22 @@ SpikeChannel* SpikeDetector::addSpikeChannel (SpikeChannel::Type type,
spikeChannel->addParameter(new StringParameter(this,
Parameter::SPIKE_CHANNEL_SCOPE,
"name",
"Name",
"The name of a spike channel",
name));

spikeChannel->addParameter(new CategoricalParameter(this,
Parameter::SPIKE_CHANNEL_SCOPE,
"waveform_type",
"Waveform type",
"The type of waveform packaged in each spike object",
{"FULL","PEAK"},
0));

spikeChannel->addParameter(new CategoricalParameter(this,
Parameter::SPIKE_CHANNEL_SCOPE,
"thrshlder_type",
"Threshold type",
"The type of thresholder to use",
{"ABS", "STD", "DYN"},0));

Expand All @@ -525,25 +528,29 @@ SpikeChannel* SpikeDetector::addSpikeChannel (SpikeChannel::Type type,
spikeChannel->addParameter(new FloatParameter(this,
Parameter::SPIKE_CHANNEL_SCOPE,
"abs_threshold" + String(ch+1),
"Abs. threshold" + String(ch+1),
"Threshold for one channel when the absolute value thresholder is active", "uV",
-50.0f, -500.0f, -20.0f, 1.0f));

spikeChannel->addParameter(new FloatParameter(this,
Parameter::SPIKE_CHANNEL_SCOPE,
"std_threshold" + String(ch+1),
"STD thres h" + String(ch+1),
"Threshold for one channel when the std thresholder is active", "uV",
4.0f, 1.0f, 10.0f, 0.01f));

spikeChannel->addParameter(new FloatParameter(this,
Parameter::SPIKE_CHANNEL_SCOPE,
"dyn_threshold" + String(ch+1),
"Dyn. thresh " + String(ch+1),
"Threshold for one channel when the dynamic thresholder is active", "uV",
4.0f, 1.0f, 10.0f, 0.01f));
}

spikeChannel->addParameter(new SelectedChannelsParameter(this,
Parameter::SPIKE_CHANNEL_SCOPE,
"local_channels",
"Local channels",
"The local channel indices (within a Data Stream) used for spike detection",
selectedChannels,
spikeChannel->getNumChannels()));
Expand Down
11 changes: 7 additions & 4 deletions Plugins/CommonAverageRef/CommonAverageRef.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,17 @@ CommonAverageRef::CommonAverageRef()
: GenericProcessor ("Common Avg Ref")
{
addSelectedChannelsParameter(Parameter::STREAM_SCOPE,
"affected",
"Affected",
"Channels from which the average is subtracted");

addSelectedChannelsParameter(Parameter::STREAM_SCOPE,
"reference",
"Reference",
"Channels to use as the reference");

addFloatParameter(Parameter::STREAM_SCOPE,
"gain",
"Gain",
"Multiplier for reference value",
"", //Unitless
Expand Down Expand Up @@ -83,8 +86,8 @@ void CommonAverageRef::process (AudioBuffer<float>& buffer)
CARSettings* settings_ = settings[stream->getStreamId()];

const int numSamples = getNumSamplesInBlock(stream->getStreamId());
const int numReferenceChannels = (*stream)["Reference"].getArray()->size();
const int numAffectedChannels = (*stream)["Affected"].getArray()->size();
const int numReferenceChannels = (*stream)["reference"].getArray()->size();
const int numAffectedChannels = (*stream)["affected"].getArray()->size();

// There is no need to do any processing if either number of reference or affected channels is zero.
if (!numReferenceChannels
Expand All @@ -97,7 +100,7 @@ void CommonAverageRef::process (AudioBuffer<float>& buffer)

for (int i = 0; i < numReferenceChannels; ++i)
{
int localIndex = (*stream)["Reference"][i];
int localIndex = (*stream)["reference"][i];
int globalIndex = stream->getContinuousChannels()[localIndex]->getGlobalIndex();

settings_->m_avgBuffer.addFrom(0, // destChannel
Expand All @@ -115,7 +118,7 @@ void CommonAverageRef::process (AudioBuffer<float>& buffer)

for (int i = 0; i < numAffectedChannels; ++i)
{
int localIndex = (*stream)["Affected"][i];
int localIndex = (*stream)["affected"][i];
int globalIndex = stream->getContinuousChannels()[localIndex]->getGlobalIndex();

buffer.addFrom(globalIndex, // destChannel
Expand Down
10 changes: 5 additions & 5 deletions Plugins/FilterNode/FilterNode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,10 @@ FilterNode::FilterNode(bool headless)
: GenericProcessor ("Bandpass Filter", headless)
{

addFloatParameter(Parameter::STREAM_SCOPE, "high_cut", "Filter high cut", "Hz", 5000, 0.1, 6000, false);
addFloatParameter(Parameter::STREAM_SCOPE, "low_cut", "Filter low cut", "Hz", 100, 0.1, 600, false);
addMaskChannelsParameter(Parameter::STREAM_SCOPE, "Channels", "Channels to filter for this stream");
addCategoricalParameter(Parameter::STREAM_SCOPE, "Threads", "Number of threads to use", { "1", "8", "16", "32"}, 3);
addFloatParameter(Parameter::STREAM_SCOPE, "high_cut", "High cut", "Filter high cut", "Hz", 5000, 0.1, 6000, false);
addFloatParameter(Parameter::STREAM_SCOPE, "low_cut", "Low cut", "Filter low cut", "Hz", 100, 0.1, 600, false);
addMaskChannelsParameter(Parameter::STREAM_SCOPE, "channels", "Channels", "Channels to filter for this stream");
addCategoricalParameter(Parameter::STREAM_SCOPE, "threads", "Threads", "Number of threads to use", { "1", "8", "16", "32"}, 3);

LOGD("[FilterNode]", " Created FilterNode");

Expand Down Expand Up @@ -215,7 +215,7 @@ void FilterNode::process (AudioBuffer<float>& buffer)
const uint16 streamId = stream->getStreamId();
const uint32 numSamples = getNumSamplesInBlock(streamId);

for (auto localChannelIndex : *((*stream)["Channels"].getArray()))
for (auto localChannelIndex : *((*stream)["channels"].getArray()))
{
int globalChannelIndex = getGlobalChannelIndex(stream->getStreamId(), (int) localChannelIndex);

Expand Down
17 changes: 9 additions & 8 deletions Plugins/PhaseDetector/PhaseDetector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,12 @@ TTLEventPtr PhaseDetectorSettings::clearOutputLine(int64 sample_number)
PhaseDetector::PhaseDetector() : GenericProcessor ("Phase Detector")
{

addSelectedChannelsParameter(Parameter::STREAM_SCOPE, "Channel", "The continuous channel to analyze", 1);
addIntParameter(Parameter::STREAM_SCOPE, "TTL_out", "The output TTL line", 1, 1, 16);
addIntParameter(Parameter::STREAM_SCOPE,"gate_line", "The input TTL line for gating the signal (0 = off)", 0, 0, 16);
addSelectedChannelsParameter(Parameter::STREAM_SCOPE, "channel", "Channel", "The continuous channel to analyze", 1);
addIntParameter(Parameter::STREAM_SCOPE, "ttl_out", "TTL out", "The output TTL line", 1, 1, 16);
addIntParameter(Parameter::STREAM_SCOPE,"gate_line", "Gate line", "The input TTL line for gating the signal (0 = off)", 0, 0, 16);
addCategoricalParameter(Parameter::STREAM_SCOPE,
"phase",
"Phase",
"The phase for triggering the output",
{ "PEAK",
"FALLING ZERO-CROSSING",
Expand All @@ -102,7 +103,7 @@ void PhaseDetector::parameterValueChanged(Parameter* param)
{
settings[param->getStreamId()]->detectorType = DetectorType((int) param->getValue());
}
else if (param->getName().equalsIgnoreCase("Channel"))
else if (param->getName().equalsIgnoreCase("channel"))
{
Array<var>* array = param->getValue().getArray();

Expand All @@ -113,14 +114,14 @@ void PhaseDetector::parameterValueChanged(Parameter* param)
settings[param->getStreamId()]->triggerChannel = globalIndex;

//TODO: It would be nice to have param->getEditor() helper
((TextButton*)getEditor()->getParameterEditor("Channel")->getEditor())->setButtonText(String(localIndex + 1));
((TextButton*)getEditor()->getParameterEditor("channel")->getEditor())->setButtonText(String(localIndex + 1));
}
else
{
settings[param->getStreamId()]->triggerChannel = -1;
}
}
else if (param->getName().equalsIgnoreCase("TTL_out"))
else if (param->getName().equalsIgnoreCase("ttl_out"))
{
settings[param->getStreamId()]->lastOutputLine = settings[param->getStreamId()]->outputLine;
settings[param->getStreamId()]->outputLine = (int)param->getValue() - 1;
Expand All @@ -141,8 +142,8 @@ void PhaseDetector::updateSettings()
{
// update "settings" objects
parameterValueChanged(stream->getParameter("phase"));
parameterValueChanged(stream->getParameter("Channel"));
parameterValueChanged(stream->getParameter("TTL_out"));
parameterValueChanged(stream->getParameter("channel"));
parameterValueChanged(stream->getParameter("ttl_out"));
parameterValueChanged(stream->getParameter("gate_line"));

EventChannel::Settings s{
Expand Down
3 changes: 3 additions & 0 deletions Plugins/RecordControl/RecordControl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,21 @@ RecordControl::RecordControl()

addCategoricalParameter(Parameter::PROCESSOR_SCOPE,
"trigger_type",
"Trigger type",
"Determines whether recording state is set or toggled by an incoming event",
{ "Edge set", "Edge toggle" },
0);

addCategoricalParameter(Parameter::PROCESSOR_SCOPE,
"edge",
"Edge",
"Determines whether recording state is changed by rising or falling events",
{ "Rising", "Falling" },
0);

addIntParameter(Parameter::STREAM_SCOPE,
"trigger_line",
"Trigger line",
"The TTL line that triggers a change in recording state",
1,
1,
Expand Down
35 changes: 22 additions & 13 deletions Source/Processors/AudioMonitor/AudioMonitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,21 +34,30 @@ AudioMonitor::AudioMonitor()

tempBuffer = std::make_unique<AudioSampleBuffer>();

addBooleanParameter(Parameter::PROCESSOR_SCOPE,
String("mute_audio"),
"Mute audio for this Audio Monitor",
false);
addBooleanParameter(
Parameter::PROCESSOR_SCOPE,
"mute_audio",
"Mute audio",
"Mute audio for this Audio Monitor",
false
);

addCategoricalParameter(Parameter::PROCESSOR_SCOPE,
String("audio_output"),
"Select L/R or both",
{ "LEFT", "BOTH", "RIGHT" },
1);
addCategoricalParameter(
Parameter::PROCESSOR_SCOPE,
"audio_output",
"Audio output",
"Select L/R or both",
{ "LEFT", "BOTH", "RIGHT" },
1
);

addSelectedChannelsParameter(Parameter::STREAM_SCOPE,
String("Channels"),
"Channels to monitor",
4);
addSelectedChannelsParameter(
Parameter::STREAM_SCOPE,
"channels",
"Channels",
"Channels to monitor",
4
);

for (int i = 0; i < MAX_CHANNELS; i++)
{
Expand Down
2 changes: 1 addition & 1 deletion Source/Processors/EventTranslator/EventTranslator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ TTLEventPtr EventTranslatorSettings::createEvent(int64 sample_number,

EventTranslator::EventTranslator() : GenericProcessor("Event Translator")
{
addIntParameter(Parameter::STREAM_SCOPE,"sync_line", "The TTL sync line for a given stream", 0, 0, 16);
addIntParameter(Parameter::STREAM_SCOPE,"sync_line", "Sync line", "The TTL sync line for a given stream", 0, 0, 16);
}

EventTranslator::~EventTranslator()
Expand Down
Loading

0 comments on commit 7a85fb8

Please sign in to comment.