From b52119b85600250243a7a02e6cc9d07629dc20a0 Mon Sep 17 00:00:00 2001 From: Pavel Kulik Date: Sun, 1 Dec 2024 22:27:13 -0800 Subject: [PATCH] Apply formatting --- .clang-format | 64 +++ Source/OpenEphysLib.cpp | 50 +- Source/PulsePalOutput.cpp | 351 +++++++------- Source/PulsePalOutput.h | 85 ++-- Source/PulsePalOutputCanvas.cpp | 785 ++++++++++++++++---------------- Source/PulsePalOutputCanvas.h | 36 +- Source/PulsePalOutputEditor.cpp | 159 +++---- Source/PulsePalOutputEditor.h | 31 +- Source/serial/PulsePal.cpp | 623 ++++++++++++++----------- Source/serial/PulsePal.h | 72 +-- 10 files changed, 1176 insertions(+), 1080 deletions(-) create mode 100644 .clang-format diff --git a/.clang-format b/.clang-format new file mode 100644 index 0000000..bd1691e --- /dev/null +++ b/.clang-format @@ -0,0 +1,64 @@ +--- +Language: Cpp +# BasedOnStyle: JUCE (Custom) +AccessModifierOffset: -4 +AlignAfterOpenBracket: Align +AlignConsecutiveAssignments: false +AlignConsecutiveDeclarations: false +AlignEscapedNewlines: Left +AlignOperands: Align +AlignTrailingComments: false +AllowAllParametersOfDeclarationOnNextLine: false +AllowShortBlocksOnASingleLine: Never +AllowShortCaseLabelsOnASingleLine: false +AllowShortFunctionsOnASingleLine: All +AllowShortIfStatementsOnASingleLine: Never +AllowShortLoopsOnASingleLine: false +AlwaysBreakAfterDefinitionReturnType: None +AlwaysBreakAfterReturnType: None +AlwaysBreakBeforeMultilineStrings: false +AlwaysBreakTemplateDeclarations: Yes +BinPackArguments: false +BinPackParameters: false +BreakAfterJavaFieldAnnotations: false +BreakBeforeBinaryOperators: NonAssignment +BreakBeforeBraces: Allman +BreakBeforeTernaryOperators: true +BreakConstructorInitializers: BeforeColon +BreakInheritanceList : BeforeColon +BreakStringLiterals: false +ColumnLimit: 0 +# ConstructorInitializerAllOnOneLineOrOnePerLine: true +ConstructorInitializerIndentWidth: 4 +ContinuationIndentWidth: 4 +Cpp11BracedListStyle: false +DerivePointerAlignment: false +DisableFormat: false +ExperimentalAutoDetectBinPacking: false +IndentCaseLabels: true +IndentWidth: 4 +IndentWrappedFunctionNames: true +KeepEmptyLinesAtTheStartOfBlocks: false +MaxEmptyLinesToKeep: 1 +NamespaceIndentation: Inner +PackConstructorInitializers: CurrentLine +PointerAlignment: Left +ReflowComments: false +SortIncludes: true +SpaceAfterCStyleCast: true +SpaceAfterLogicalNot: true +SpaceBeforeAssignmentOperators: true +SpaceBeforeCpp11BracedList: true +SpaceBeforeParens: NonEmptyParentheses +SpaceInEmptyParentheses: false +SpaceBeforeInheritanceColon: true +SpacesInAngles: false +SpacesInCStyleCastParentheses: false +SpacesInContainerLiterals: true +SpacesInParentheses: false +SpacesInSquareBrackets: false +Standard: "c++17" +TabWidth: 4 +UseTab: Never +--- + diff --git a/Source/OpenEphysLib.cpp b/Source/OpenEphysLib.cpp index 74ab59c..8e83bf2 100644 --- a/Source/OpenEphysLib.cpp +++ b/Source/OpenEphysLib.cpp @@ -21,50 +21,50 @@ along with this program. If not, see . */ -#include #include "PulsePalOutput.h" +#include #include #ifdef _WIN32 #include -#define EXPORT __declspec(dllexport) +#define EXPORT __declspec (dllexport) #else -#define EXPORT __attribute__((visibility("default"))) +#define EXPORT __attribute__ ((visibility ("default"))) #endif using namespace Plugin; #define NUM_PLUGINS 1 -extern "C" EXPORT void getLibInfo(Plugin::LibraryInfo* info) +extern "C" EXPORT void getLibInfo (Plugin::LibraryInfo* info) { - info->apiVersion = PLUGIN_API_VER; + info->apiVersion = PLUGIN_API_VER; info->name = "Pulse Pal Output"; - info->libVersion = "0.2.0"; - info->numPlugins = NUM_PLUGINS; + info->libVersion = "0.2.0"; + info->numPlugins = NUM_PLUGINS; } -extern "C" EXPORT int getPluginInfo(int index, Plugin::PluginInfo* info) +extern "C" EXPORT int getPluginInfo (int index, Plugin::PluginInfo* info) { - switch (index) - { - case 0: - info->type = Plugin::Type::PROCESSOR; - info->processor.name = "Pulse Pal"; - info->processor.type = Plugin::Processor::SINK; - info->processor.creator = &(Plugin::createProcessor); - break; - default: - return -1; - break; - } - return 0; + switch (index) + { + case 0: + info->type = Plugin::Type::PROCESSOR; + info->processor.name = "Pulse Pal"; + info->processor.type = Plugin::Processor::SINK; + info->processor.creator = &(Plugin::createProcessor); + break; + default: + return -1; + break; + } + return 0; } #ifdef WIN32 -BOOL WINAPI DllMain(IN HINSTANCE hDllHandle, - IN DWORD nReason, - IN LPVOID Reserved) +BOOL WINAPI DllMain (IN HINSTANCE hDllHandle, + IN DWORD nReason, + IN LPVOID Reserved) { - return TRUE; + return TRUE; } #endif diff --git a/Source/PulsePalOutput.cpp b/Source/PulsePalOutput.cpp index f2cfd6e..2da8dc0 100644 --- a/Source/PulsePalOutput.cpp +++ b/Source/PulsePalOutput.cpp @@ -31,7 +31,6 @@ along with this program. If not, see . */ - #include #include "PulsePalOutput.h" @@ -39,39 +38,37 @@ #include "PulsePalOutputEditor.h" PulsePalOutput::PulsePalOutput() - : GenericProcessor ("Pulse Pal") - , channelToChange (0) - , pulsePalVersion (0) + : GenericProcessor ("Pulse Pal"), channelToChange (0), pulsePalVersion (0) { // Init Pulse Pal pulsePal.initialize(); pulsePal.setDefaultParameters(); - pulsePal.updateDisplay("Connected to GUI"," Click for menu"); + pulsePal.updateDisplay ("Connected to GUI", " Click for menu"); pulsePalVersion = pulsePal.getFirmwareVersion(); // if >0, Pulse Pal is connected // Init Pulse Pal parameter arrays - m_isBiphasic = vector(PULSEPALCHANNELS, 0); - m_phase1Duration = vector(PULSEPALCHANNELS, DEF_PHASE_DURATION); - m_phase2Duration = vector(PULSEPALCHANNELS, DEF_PHASE_DURATION); - m_interPhaseInterval = vector(PULSEPALCHANNELS, DEF_INTER_PHASE); - m_phase1Voltage = vector(PULSEPALCHANNELS, DEF_VOLTAGE); - m_phase2Voltage = vector(PULSEPALCHANNELS, DEF_VOLTAGE); - m_restingVoltage = vector(PULSEPALCHANNELS, 0); - m_interPulseInterval = vector(PULSEPALCHANNELS, DEF_INTER_PULSE); - m_burstDuration = vector(PULSEPALCHANNELS, 0); - m_interBurstInterval = vector(PULSEPALCHANNELS, 0); - m_trainDuration = vector(PULSEPALCHANNELS, DEF_TRAINDURATION); - m_trainDelay = vector(PULSEPALCHANNELS, 0); - m_linkTriggerChannel1 = vector(PULSEPALCHANNELS, 0); - m_linkTriggerChannel2 = vector(PULSEPALCHANNELS, 0); - m_triggerMode = vector(PULSEPALCHANNELS, 0); - m_continuous = vector(PULSEPALCHANNELS, 0); + m_isBiphasic = vector (PULSEPALCHANNELS, 0); + m_phase1Duration = vector (PULSEPALCHANNELS, DEF_PHASE_DURATION); + m_phase2Duration = vector (PULSEPALCHANNELS, DEF_PHASE_DURATION); + m_interPhaseInterval = vector (PULSEPALCHANNELS, DEF_INTER_PHASE); + m_phase1Voltage = vector (PULSEPALCHANNELS, DEF_VOLTAGE); + m_phase2Voltage = vector (PULSEPALCHANNELS, DEF_VOLTAGE); + m_restingVoltage = vector (PULSEPALCHANNELS, 0); + m_interPulseInterval = vector (PULSEPALCHANNELS, DEF_INTER_PULSE); + m_burstDuration = vector (PULSEPALCHANNELS, 0); + m_interBurstInterval = vector (PULSEPALCHANNELS, 0); + m_trainDuration = vector (PULSEPALCHANNELS, DEF_TRAINDURATION); + m_trainDelay = vector (PULSEPALCHANNELS, 0); + m_linkTriggerChannel1 = vector (PULSEPALCHANNELS, 0); + m_linkTriggerChannel2 = vector (PULSEPALCHANNELS, 0); + m_triggerMode = vector (PULSEPALCHANNELS, 0); + m_continuous = vector (PULSEPALCHANNELS, 0); for (int i = 0; i < PULSEPALCHANNELS; ++i) { - channelTtlTrigger.add (-1); - channelTtlGate.add (-1); - channelState.add (true); + channelTtlTrigger.add (-1); + channelTtlGate.add (-1); + channelState.add (true); } } @@ -79,10 +76,9 @@ PulsePalOutput::~PulsePalOutput() { if (pulsePalVersion > 0) { - String versionString = " PULSE PAL v" + String(pulsePalVersion) + ".0"; - pulsePal.updateDisplay(versionString.toStdString(), " Click for menu"); + String versionString = " PULSE PAL v" + String (pulsePalVersion) + ".0"; + pulsePal.updateDisplay (versionString.toStdString(), " Click for menu"); } - } void PulsePalOutput::updateSettings() @@ -99,36 +95,34 @@ AudioProcessorEditor* PulsePalOutput::createEditor() void PulsePalOutput::handleTTLEvent (TTLEventPtr ttl) { - - const int state = ttl->getState() ? 1 : 0; - const int eventSourceId = ttl->getChannelInfo()->getSourceNodeId(); + const int state = ttl->getState() ? 1 : 0; + const int eventSourceId = ttl->getChannelInfo()->getSourceNodeId(); const String eventStream = ttl->getChannelInfo()->getStreamName(); - const int eventLine = ttl->getLine(); + const int eventLine = ttl->getLine(); for (int i = 0; i < PULSEPALCHANNELS; ++i) { - if (channelTtlTrigger[i] != -1 && channelState[i]) { EventSources s = sources.getReference (channelTtlTrigger[i]); if (eventSourceId == s.sourceNodeId - && eventStream.equalsIgnoreCase(s.streamName) - && eventLine == s.ttlLine + && eventStream.equalsIgnoreCase (s.streamName) + && eventLine == s.ttlLine && state) { - LOGD("Pulse Pal Trigger ", i + 1); + LOGD ("Pulse Pal Trigger ", i + 1); pulsePal.triggerChannel (i + 1); } } - + if (channelTtlGate[i] != -1) { EventSources s = sources.getReference (channelTtlGate[i]); if (eventSourceId == s.sourceNodeId - && eventStream.equalsIgnoreCase(s.streamName) + && eventStream.equalsIgnoreCase (s.streamName) && eventLine == s.ttlLine) { - LOGD("Pulse Pal Gate ", i + 1, ": ", state); + LOGD ("Pulse Pal Gate ", i + 1, ": ", state); if (state == 1) channelState.set (i, true); else @@ -138,39 +132,38 @@ void PulsePalOutput::handleTTLEvent (TTLEventPtr ttl) } } - void PulsePalOutput::setParameter (int parameterIndex, float newValue) { //editor->updateParameterButtons (parameterIndex); switch (parameterIndex) { - case 0: - channelToChange = (int) newValue; - LOGD("Changing active channel to ", newValue); - break; + case 0: + channelToChange = (int) newValue; + LOGD ("Changing active channel to ", newValue); + break; - case 1: - channelTtlTrigger.set (channelToChange, (int) newValue); - LOGD("Changing trigger line to ", newValue); - break; + case 1: + channelTtlTrigger.set (channelToChange, (int) newValue); + LOGD ("Changing trigger line to ", newValue); + break; - case 2: - channelTtlGate.set (channelToChange, (int) newValue); - LOGD("Changing gate line to ", newValue); + case 2: + channelTtlGate.set (channelToChange, (int) newValue); + LOGD ("Changing gate line to ", newValue); - if (newValue < 0) - { - channelState.set (channelToChange, true); - } - else - { - channelState.set (channelToChange, false); - } - break; + if (newValue < 0) + { + channelState.set (channelToChange, true); + } + else + { + channelState.set (channelToChange, false); + } + break; - default: - std::cout << "Unrecognized parameter index." << std::endl; + default: + std::cout << "Unrecognized parameter index." << std::endl; } } @@ -179,9 +172,9 @@ void PulsePalOutput::process (AudioBuffer& buffer) checkForEvents(); } -void PulsePalOutput::addEventSource(EventSources s) +void PulsePalOutput::addEventSource (EventSources s) { - sources.add(s); + sources.add (s); } void PulsePalOutput::clearEventSources() @@ -189,36 +182,36 @@ void PulsePalOutput::clearEventSources() sources.clear(); } -bool PulsePalOutput::updatePulsePal(int chan) +bool PulsePalOutput::updatePulsePal (int chan) { // check that Pulspal is connected and update parameters for channel chan+1 if (pulsePalVersion != 0) { int actual_chan = chan + 1; - pulsePal.setBiphasic(actual_chan, m_isBiphasic[chan]); - pulsePal.setPhase1Duration(actual_chan, float(m_phase1Duration[chan])/1000); - pulsePal.setPhase2Duration(actual_chan, float(m_phase2Duration[chan])/1000); - pulsePal.setInterPhaseInterval(actual_chan, float(m_interPhaseInterval[chan])/1000); - pulsePal.setPhase1Voltage(actual_chan, float(m_phase1Voltage[chan])); - pulsePal.setPhase2Voltage(actual_chan, float(m_phase2Voltage[chan])); - pulsePal.setRestingVoltage(actual_chan, float(m_restingVoltage[chan])); - pulsePal.setInterPulseInterval(actual_chan, float(m_interPulseInterval[chan])/1000); - pulsePal.setBurstDuration(actual_chan, float(m_burstDuration[chan])/1000); - pulsePal.setBurstInterval(actual_chan, float(m_interBurstInterval[chan])/1000); - pulsePal.setPulseTrainDuration(actual_chan, float(m_trainDuration[chan])/1000); - pulsePal.setPulseTrainDelay(actual_chan, float(m_trainDelay[chan])/1000); - - pulsePal.setTrigger1Link(actual_chan, m_linkTriggerChannel1[chan]); - pulsePal.setTrigger2Link(actual_chan, m_linkTriggerChannel2[chan]); - pulsePal.setTriggerMode(actual_chan, m_triggerMode[chan]); - pulsePal.setContinuousLoop(actual_chan, m_continuous[chan]); + pulsePal.setBiphasic (actual_chan, m_isBiphasic[chan]); + pulsePal.setPhase1Duration (actual_chan, float (m_phase1Duration[chan]) / 1000); + pulsePal.setPhase2Duration (actual_chan, float (m_phase2Duration[chan]) / 1000); + pulsePal.setInterPhaseInterval (actual_chan, float (m_interPhaseInterval[chan]) / 1000); + pulsePal.setPhase1Voltage (actual_chan, float (m_phase1Voltage[chan])); + pulsePal.setPhase2Voltage (actual_chan, float (m_phase2Voltage[chan])); + pulsePal.setRestingVoltage (actual_chan, float (m_restingVoltage[chan])); + pulsePal.setInterPulseInterval (actual_chan, float (m_interPulseInterval[chan]) / 1000); + pulsePal.setBurstDuration (actual_chan, float (m_burstDuration[chan]) / 1000); + pulsePal.setBurstInterval (actual_chan, float (m_interBurstInterval[chan]) / 1000); + pulsePal.setPulseTrainDuration (actual_chan, float (m_trainDuration[chan]) / 1000); + pulsePal.setPulseTrainDelay (actual_chan, float (m_trainDelay[chan]) / 1000); + + pulsePal.setTrigger1Link (actual_chan, m_linkTriggerChannel1[chan]); + pulsePal.setTrigger2Link (actual_chan, m_linkTriggerChannel2[chan]); + pulsePal.setTriggerMode (actual_chan, m_triggerMode[chan]); + pulsePal.setContinuousLoop (actual_chan, m_continuous[chan]); return true; } else return false; } -bool PulsePalOutput::getIsBiphasic(int chan) const +bool PulsePalOutput::getIsBiphasic (int chan) const { if (m_isBiphasic[chan]) return true; @@ -226,79 +219,79 @@ bool PulsePalOutput::getIsBiphasic(int chan) const return false; } -float PulsePalOutput::getPhase1Duration(int chan) const +float PulsePalOutput::getPhase1Duration (int chan) const { return m_phase1Duration[chan]; } -float PulsePalOutput::getPhase2Duration(int chan) const +float PulsePalOutput::getPhase2Duration (int chan) const { return m_phase2Duration[chan]; } -float PulsePalOutput::getInterPhaseInt(int chan) const +float PulsePalOutput::getInterPhaseInt (int chan) const { return m_interPhaseInterval[chan]; } -float PulsePalOutput::getVoltage1(int chan) const +float PulsePalOutput::getVoltage1 (int chan) const { return m_phase1Voltage[chan]; } -float PulsePalOutput::getVoltage2(int chan) const +float PulsePalOutput::getVoltage2 (int chan) const { return m_phase2Voltage[chan]; } -float PulsePalOutput::getRestingVoltage(int chan) const +float PulsePalOutput::getRestingVoltage (int chan) const { return m_restingVoltage[chan]; } -float PulsePalOutput::getInterPulseInt(int chan) const +float PulsePalOutput::getInterPulseInt (int chan) const { return m_interPulseInterval[chan]; } -float PulsePalOutput::getBurstDuration(int chan) const +float PulsePalOutput::getBurstDuration (int chan) const { return m_burstDuration[chan]; } -float PulsePalOutput::getInterBurstInt(int chan) const +float PulsePalOutput::getInterBurstInt (int chan) const { return m_interBurstInterval[chan]; } -float PulsePalOutput::getTrainDuration(int chan) const +float PulsePalOutput::getTrainDuration (int chan) const { return m_trainDuration[chan]; } -float PulsePalOutput::getTrainDelay(int chan) const +float PulsePalOutput::getTrainDelay (int chan) const { return m_trainDelay[chan]; } -int PulsePalOutput::getLinkTriggerChannel1(int chan) const +int PulsePalOutput::getLinkTriggerChannel1 (int chan) const { return m_linkTriggerChannel1[chan]; } -int PulsePalOutput::getLinkTriggerChannel2(int chan) const +int PulsePalOutput::getLinkTriggerChannel2 (int chan) const { return m_linkTriggerChannel2[chan]; } -int PulsePalOutput::getTriggerMode(int chan) const +int PulsePalOutput::getTriggerMode (int chan) const { return m_triggerMode[chan]; } -int PulsePalOutput::getContinuous(int chan) const +int PulsePalOutput::getContinuous (int chan) const { - return m_continuous[chan]; + return m_continuous[chan]; } uint32_t PulsePalOutput::getPulsePalVersion() const @@ -306,7 +299,7 @@ uint32_t PulsePalOutput::getPulsePalVersion() const return pulsePalVersion; } -void PulsePalOutput::setIsBiphasic(int chan, bool isBiphasic) +void PulsePalOutput::setIsBiphasic (int chan, bool isBiphasic) { if (isBiphasic) m_isBiphasic[chan] = 1; @@ -314,82 +307,82 @@ void PulsePalOutput::setIsBiphasic(int chan, bool isBiphasic) m_isBiphasic[chan] = 0; } -void PulsePalOutput::setPhase1Duration(int chan, float phaseDuration) +void PulsePalOutput::setPhase1Duration (int chan, float phaseDuration) { m_phase1Duration[chan] = phaseDuration; } -void PulsePalOutput::setPhase2Duration(int chan, float phaseDuration) +void PulsePalOutput::setPhase2Duration (int chan, float phaseDuration) { m_phase2Duration[chan] = phaseDuration; } -void PulsePalOutput::setInterPhaseInt(int chan, float interPhaseInt) +void PulsePalOutput::setInterPhaseInt (int chan, float interPhaseInt) { m_interPhaseInterval[chan] = interPhaseInt; } -void PulsePalOutput::setVoltage1(int chan, float voltage) +void PulsePalOutput::setVoltage1 (int chan, float voltage) { m_phase1Voltage[chan] = voltage; } -void PulsePalOutput::setVoltage2(int chan, float voltage) +void PulsePalOutput::setVoltage2 (int chan, float voltage) { m_phase2Voltage[chan] = voltage; } -void PulsePalOutput::setRestingVoltage(int chan, float voltage) +void PulsePalOutput::setRestingVoltage (int chan, float voltage) { m_restingVoltage[chan] = voltage; } -void PulsePalOutput::setInterPulseInt(int chan, float interPulseInt) +void PulsePalOutput::setInterPulseInt (int chan, float interPulseInt) { m_interPulseInterval[chan] = interPulseInt; } -void PulsePalOutput::setBurstDuration(int chan, float burstDuration) +void PulsePalOutput::setBurstDuration (int chan, float burstDuration) { m_burstDuration[chan] = burstDuration; } -void PulsePalOutput::setInterBurstInt(int chan, float interBurstInt) +void PulsePalOutput::setInterBurstInt (int chan, float interBurstInt) { m_interBurstInterval[chan] = interBurstInt; } -void PulsePalOutput::setTrainDuration(int chan, float trainDuration) +void PulsePalOutput::setTrainDuration (int chan, float trainDuration) { m_trainDuration[chan] = trainDuration; } -void PulsePalOutput::setTrainDelay(int chan, float trainDelay) +void PulsePalOutput::setTrainDelay (int chan, float trainDelay) { m_trainDelay[chan] = trainDelay; } -void PulsePalOutput::setLinkTriggerChannel1(int chan, int link) +void PulsePalOutput::setLinkTriggerChannel1 (int chan, int link) { m_linkTriggerChannel1[chan] = link; } -void PulsePalOutput::setLinkTriggerChannel2(int chan, int link) +void PulsePalOutput::setLinkTriggerChannel2 (int chan, int link) { m_linkTriggerChannel2[chan] = link; } -void PulsePalOutput::setTriggerMode(int chan, int mode) +void PulsePalOutput::setTriggerMode (int chan, int mode) { m_triggerMode[chan] = mode; } -void PulsePalOutput::setContinuous(int chan, int continued) +void PulsePalOutput::setContinuous (int chan, int continued) { - m_continuous[chan] = continued; + m_continuous[chan] = continued; } -void PulsePalOutput::setTTLsettings(int chan) +void PulsePalOutput::setTTLsettings (int chan) { m_isBiphasic[chan] = 0; m_phase1Duration[chan] = 1; @@ -405,31 +398,30 @@ void PulsePalOutput::setTTLsettings(int chan) m_trainDelay[chan] = 0; } -bool PulsePalOutput::checkParameterConsistency(int chan) +bool PulsePalOutput::checkParameterConsistency (int chan) { bool consistent; - if (!m_isBiphasic[chan]) + if (! m_isBiphasic[chan]) if (m_burstDuration[chan] != 0) - consistent = (m_phase1Duration[chan] + m_interPulseInterval[chan] < m_burstDuration[chan]) && - (m_burstDuration[chan] + m_interBurstInterval[chan] < m_trainDuration[chan]); + consistent = (m_phase1Duration[chan] + m_interPulseInterval[chan] < m_burstDuration[chan]) && (m_burstDuration[chan] + m_interBurstInterval[chan] < m_trainDuration[chan]); else consistent = (m_phase1Duration[chan] <= m_trainDuration[chan]); + else if (m_burstDuration[chan] != 0) + consistent = (m_phase1Duration[chan] + m_phase2Duration[chan] + m_interPhaseInterval[chan] + + m_interPulseInterval[chan] + < m_burstDuration[chan]) + && (m_burstDuration[chan] + m_interBurstInterval[chan] < m_trainDuration[chan]); else - if (m_burstDuration[chan] != 0) - consistent = (m_phase1Duration[chan] + m_phase2Duration[chan] + m_interPhaseInterval[chan] - + m_interPulseInterval[chan] < m_burstDuration[chan]) && - (m_burstDuration[chan] + m_interBurstInterval[chan] < m_trainDuration[chan]); - else - consistent = (m_phase1Duration[chan] + m_phase2Duration[chan] + m_interPhaseInterval[chan] - <= m_trainDuration[chan]); + consistent = (m_phase1Duration[chan] + m_phase2Duration[chan] + m_interPhaseInterval[chan] + <= m_trainDuration[chan]); return consistent; } -void PulsePalOutput::adjustParameters(int chan) +void PulsePalOutput::adjustParameters (int chan) { - if (!m_isBiphasic[chan]) + if (! m_isBiphasic[chan]) if (m_burstDuration[chan] != 0) { m_burstDuration[chan] = m_phase1Duration[chan] + m_interPulseInterval[chan] + 1; @@ -437,70 +429,69 @@ void PulsePalOutput::adjustParameters(int chan) } else m_trainDuration[chan] = m_phase1Duration[chan] + m_interPulseInterval[chan] + 1; + else if (m_burstDuration[chan] != 0) + { + m_burstDuration[chan] = m_phase1Duration[chan] + m_phase2Duration[chan] + m_interPhaseInterval[chan] + + m_interPulseInterval[chan] + 1; + m_trainDuration[chan] = m_burstDuration[chan] + m_interBurstInterval[chan] + 1; + } else - if (m_burstDuration[chan] != 0) - { - m_burstDuration[chan] = m_phase1Duration[chan] + m_phase2Duration[chan] + m_interPhaseInterval[chan] - + m_interPulseInterval[chan] + 1; - m_trainDuration[chan] = m_burstDuration[chan] + m_interBurstInterval[chan] + 1; - } - else - m_trainDuration[chan] = m_phase1Duration[chan] + m_phase2Duration[chan] + m_interPhaseInterval[chan] - + m_interPulseInterval[chan] + 1; + m_trainDuration[chan] = m_phase1Duration[chan] + m_phase2Duration[chan] + m_interPhaseInterval[chan] + + m_interPulseInterval[chan] + 1; } -void PulsePalOutput::saveCustomParametersToXml(XmlElement *parentElement) +void PulsePalOutput::saveCustomParametersToXml (XmlElement* parentElement) { - XmlElement* mainNode = parentElement->createNewChildElement("PulsePalOutput"); - for (int i=0; icreateNewChildElement ("PulsePalOutput"); + for (int i = 0; i < PULSEPALCHANNELS; i++) { - XmlElement* chan = new XmlElement(String("Channel_")+=String(i+1)); - chan->setAttribute("id", i); - chan->setAttribute("biphasic", m_isBiphasic[i]); - chan->setAttribute("phase1", m_phase1Duration[i]); - chan->setAttribute("phase2", m_phase1Duration[i]); - chan->setAttribute("interphase", m_interPhaseInterval[i]); - chan->setAttribute("voltage1", m_phase1Voltage[i]); - chan->setAttribute("voltage2", m_phase2Voltage[i]); - chan->setAttribute("restingvoltage", m_restingVoltage[i]); - chan->setAttribute("interpulse", m_interPulseInterval[i]); - chan->setAttribute("burstduration", m_burstDuration[i]); - chan->setAttribute("interburst", m_interBurstInterval[i]); - chan->setAttribute("trainduration", m_trainDuration[i]); - chan->setAttribute("traindelay", m_trainDelay[i]); - chan->setAttribute("link2trigger1", m_linkTriggerChannel1[i]); - chan->setAttribute("link2trigger2", m_linkTriggerChannel2[i]); - chan->setAttribute("triggermode", m_triggerMode[i]); - chan->setAttribute("continuous", m_continuous[i]); - mainNode->addChildElement(chan); + XmlElement* chan = new XmlElement (String ("Channel_") += String (i + 1)); + chan->setAttribute ("id", i); + chan->setAttribute ("biphasic", m_isBiphasic[i]); + chan->setAttribute ("phase1", m_phase1Duration[i]); + chan->setAttribute ("phase2", m_phase1Duration[i]); + chan->setAttribute ("interphase", m_interPhaseInterval[i]); + chan->setAttribute ("voltage1", m_phase1Voltage[i]); + chan->setAttribute ("voltage2", m_phase2Voltage[i]); + chan->setAttribute ("restingvoltage", m_restingVoltage[i]); + chan->setAttribute ("interpulse", m_interPulseInterval[i]); + chan->setAttribute ("burstduration", m_burstDuration[i]); + chan->setAttribute ("interburst", m_interBurstInterval[i]); + chan->setAttribute ("trainduration", m_trainDuration[i]); + chan->setAttribute ("traindelay", m_trainDelay[i]); + chan->setAttribute ("link2trigger1", m_linkTriggerChannel1[i]); + chan->setAttribute ("link2trigger2", m_linkTriggerChannel2[i]); + chan->setAttribute ("triggermode", m_triggerMode[i]); + chan->setAttribute ("continuous", m_continuous[i]); + mainNode->addChildElement (chan); } } void PulsePalOutput::loadCustomParametersFromXml (XmlElement* xml) { - forEachXmlChildElement (*xml, mainNode) + forEachXmlChildElement (*xml, mainNode) { if (mainNode->hasTagName ("PulsePalOutput")) { - forEachXmlChildElement(*mainNode, chan) + forEachXmlChildElement (*mainNode, chan) { - int id = chan->getIntAttribute("id"); - int biphasic = chan->getIntAttribute("biphasic"); - double phase1 = chan->getDoubleAttribute("phase1"); - double phase2 = chan->getDoubleAttribute("phase2"); - double interphase = chan->getDoubleAttribute("interphase"); - double voltage1 = chan->getDoubleAttribute("voltage1"); - double voltage2 = chan->getDoubleAttribute("voltage2"); - double resting = chan->getDoubleAttribute("restingvoltage"); - double interpulse = chan->getDoubleAttribute("interpulse"); - double burst = chan->getDoubleAttribute("burstduration"); - double interburst = chan->getDoubleAttribute("interburst"); - double trainduration = chan->getDoubleAttribute("trainduration"); - double traindelay = chan->getDoubleAttribute("traindelay"); - int link21 = chan->getIntAttribute("link2trigger1"); - int link22 = chan->getIntAttribute("link2trigger2"); - int trigger = chan->getIntAttribute("triggermode"); - int contd = chan->getIntAttribute("continuous"); + int id = chan->getIntAttribute ("id"); + int biphasic = chan->getIntAttribute ("biphasic"); + double phase1 = chan->getDoubleAttribute ("phase1"); + double phase2 = chan->getDoubleAttribute ("phase2"); + double interphase = chan->getDoubleAttribute ("interphase"); + double voltage1 = chan->getDoubleAttribute ("voltage1"); + double voltage2 = chan->getDoubleAttribute ("voltage2"); + double resting = chan->getDoubleAttribute ("restingvoltage"); + double interpulse = chan->getDoubleAttribute ("interpulse"); + double burst = chan->getDoubleAttribute ("burstduration"); + double interburst = chan->getDoubleAttribute ("interburst"); + double trainduration = chan->getDoubleAttribute ("trainduration"); + double traindelay = chan->getDoubleAttribute ("traindelay"); + int link21 = chan->getIntAttribute ("link2trigger1"); + int link22 = chan->getIntAttribute ("link2trigger2"); + int trigger = chan->getIntAttribute ("triggermode"); + int contd = chan->getIntAttribute ("continuous"); m_isBiphasic[id] = biphasic; m_phase1Duration[id] = phase1; m_phase2Duration[id] = phase2; @@ -516,7 +507,7 @@ void PulsePalOutput::loadCustomParametersFromXml (XmlElement* xml) m_linkTriggerChannel1[id] = link21; m_linkTriggerChannel2[id] = link22; m_triggerMode[id] = trigger; - m_continuous[id] = contd; + m_continuous[id] = contd; } } } diff --git a/Source/PulsePalOutput.h b/Source/PulsePalOutput.h index 8baddf4..84fb884 100644 --- a/Source/PulsePalOutput.h +++ b/Source/PulsePalOutput.h @@ -72,7 +72,6 @@ struct EventSources class PulsePalOutput : public GenericProcessor { public: - /** The class constructor, used to connect to PulsePal initialize any members. */ PulsePalOutput(); @@ -95,16 +94,16 @@ class PulsePalOutput : public GenericProcessor void handleTTLEvent (TTLEventPtr event) override; /** Saves parameters */ - void saveCustomParametersToXml(XmlElement *parentElement) override; + void saveCustomParametersToXml (XmlElement* parentElement) override; /** Loads parameters*/ - void loadCustomParametersFromXml(XmlElement* xml) override; + void loadCustomParametersFromXml (XmlElement* xml) override; /** * @brief updatePulsePal sets parameters of channel chan to the Pulse Pal * @param chan: channel number (0-1-2-3) to update * @return true if Pulse Pal is connected, false otherwise */ - bool updatePulsePal(int chan); + bool updatePulsePal (int chan); /** * @brief getPulsePalVersion returns connected Pulse Pal version * @return Pulse Pal version @@ -114,44 +113,44 @@ class PulsePalOutput : public GenericProcessor * @brief get-set for all Pulse Pal parameters * @param chan: channel number (0-1-2-3) */ - bool getIsBiphasic(int chan) const; - float getPhase1Duration(int chan) const; - float getPhase2Duration(int chan) const; - float getInterPhaseInt(int chan) const; - float getVoltage1(int chan) const; - float getVoltage2(int chan) const; - float getRestingVoltage(int chan) const; - float getInterPulseInt(int chan) const; - float getBurstDuration(int chan) const; - float getInterBurstInt(int chan) const; - float getTrainDuration(int chan) const; - float getTrainDelay(int chan) const; - int getLinkTriggerChannel1(int chan) const; - int getLinkTriggerChannel2(int chan) const; - int getTriggerMode(int chan) const; - int getContinuous(int chan) const; - void setIsBiphasic(int chan, bool isBiphasic); - void setNegFirst(int chan, bool negFirst); - void setPhase1Duration(int chan, float phaseDuration); - void setPhase2Duration(int chan, float phaseDuration); - void setInterPhaseInt(int chan, float interPhaseInt); - void setVoltage1(int chan, float voltage); - void setVoltage2(int chan, float voltage); - void setRestingVoltage(int chan, float voltage); - void setInterPulseInt(int chan, float interPulseInt); - void setBurstDuration(int chan, float burstDuration); - void setInterBurstInt(int chan, float interBurstInt); - void setTrainDuration(int chan, float trainDuration); - void setTrainDelay(int chan, float trainDelay); - void setLinkTriggerChannel1(int chan, int link); - void setLinkTriggerChannel2(int chan, int link); - void setTriggerMode(int chan, int mode); - void setContinuous(int chan, int continued); + bool getIsBiphasic (int chan) const; + float getPhase1Duration (int chan) const; + float getPhase2Duration (int chan) const; + float getInterPhaseInt (int chan) const; + float getVoltage1 (int chan) const; + float getVoltage2 (int chan) const; + float getRestingVoltage (int chan) const; + float getInterPulseInt (int chan) const; + float getBurstDuration (int chan) const; + float getInterBurstInt (int chan) const; + float getTrainDuration (int chan) const; + float getTrainDelay (int chan) const; + int getLinkTriggerChannel1 (int chan) const; + int getLinkTriggerChannel2 (int chan) const; + int getTriggerMode (int chan) const; + int getContinuous (int chan) const; + void setIsBiphasic (int chan, bool isBiphasic); + void setNegFirst (int chan, bool negFirst); + void setPhase1Duration (int chan, float phaseDuration); + void setPhase2Duration (int chan, float phaseDuration); + void setInterPhaseInt (int chan, float interPhaseInt); + void setVoltage1 (int chan, float voltage); + void setVoltage2 (int chan, float voltage); + void setRestingVoltage (int chan, float voltage); + void setInterPulseInt (int chan, float interPulseInt); + void setBurstDuration (int chan, float burstDuration); + void setInterBurstInt (int chan, float interBurstInt); + void setTrainDuration (int chan, float trainDuration); + void setTrainDelay (int chan, float trainDelay); + void setLinkTriggerChannel1 (int chan, int link); + void setLinkTriggerChannel2 (int chan, int link); + void setTriggerMode (int chan, int mode); + void setContinuous (int chan, int continued); /** * @brief setTTLsettings sets channel chan to TTL settings * @param chan: channel number (0-1-2-3) */ - void setTTLsettings(int chan); + void setTTLsettings (int chan); /** * @brief checkParameterConsistency checks if the Pulse Pal parameters * for channel chan are consistent @@ -159,7 +158,7 @@ class PulsePalOutput : public GenericProcessor * @param chan: channel number (0-1-2-3) * @return true if parameters are consistent, false otherwise */ - bool checkParameterConsistency(int chan); + bool checkParameterConsistency (int chan); /** * @brief adjustParameters adjusts consistency of parameters by setting * burst and train duration based on pulse duration. @@ -167,12 +166,12 @@ class PulsePalOutput : public GenericProcessor * duration and interval, then inter pulse duration and pulse) * @param chan: channel number (0-1-2-3) */ - void adjustParameters(int chan); + void adjustParameters (int chan); /** * @brief addEventSource adds a TTLevent source to the sources array * @param s: new source to add to the sources array */ - void addEventSource(EventSources s); + void addEventSource (EventSources s); /** * @brief clearEventSources clears sources array */ @@ -200,7 +199,7 @@ class PulsePalOutput : public GenericProcessor vector m_linkTriggerChannel1; vector m_linkTriggerChannel2; vector m_triggerMode; - vector m_continuous; + vector m_continuous; // Pulse Pal instance and version PulsePal pulsePal; @@ -208,4 +207,4 @@ class PulsePalOutput : public GenericProcessor JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (PulsePalOutput); }; -#endif // __PULSEPALOUTPUT_H_A8BF66D6__ +#endif // __PULSEPALOUTPUT_H_A8BF66D6__ diff --git a/Source/PulsePalOutputCanvas.cpp b/Source/PulsePalOutputCanvas.cpp index 8c585fa..9e4961d 100644 --- a/Source/PulsePalOutputCanvas.cpp +++ b/Source/PulsePalOutputCanvas.cpp @@ -29,212 +29,199 @@ along with this program. If not, see . */ - #include "PulsePalOutputCanvas.h" #include "PulsePalOutput.h" - -PulsePalOutputCanvas::PulsePalOutputCanvas(PulsePalOutput* PulsePalOutput) - : processor(PulsePalOutput) - , labelColour(Colour(200, 255, 0)) - , labelTextColour(Colour(255, 200, 0)) - , labelBackgroundColour(Colour(100,100,100)) +PulsePalOutputCanvas::PulsePalOutputCanvas (PulsePalOutput* PulsePalOutput) + : processor (PulsePalOutput), labelColour (Colour (200, 255, 0)), labelTextColour (Colour (255, 200, 0)), labelBackgroundColour (Colour (100, 100, 100)) { - initButtons(); initLabels(); - } -float PulsePalOutputCanvas::my_round(float x) +float PulsePalOutputCanvas::my_round (float x) { - return x < 0.0 ? ceil(x - 0.5) : floor(x + 0.5); + return x < 0.0 ? ceil (x - 0.5) : floor (x + 0.5); } - void PulsePalOutputCanvas::paint (Graphics& g) { - - g.setColour(labelBackgroundColour); // background color - g.fillRect(0, 0, getWidth(), getHeight()); + g.setColour (labelBackgroundColour); // background color + g.fillRect (0, 0, getWidth(), getHeight()); // Check Pulse Pal connection if (processor->getPulsePalVersion() > 0) { - pulsePalLabel->setText(String("Pulse Pal: ") += String("CONNECTED"), dontSendNotification); + pulsePalLabel->setText (String ("Pulse Pal: ") += String ("CONNECTED"), dontSendNotification); } else { - pulsePalLabel->setText(String("Pulse Pal: ") += String("NOT CONNECTED"), dontSendNotification); + pulsePalLabel->setText (String ("Pulse Pal: ") += String ("NOT CONNECTED"), dontSendNotification); } - for (int i = 0; i < PULSEPALCHANNELS; i++) { - g.setColour(Colours::grey); - g.fillRoundedRectangle(0.005*getWidth() + 0.25*i*getWidth(), 0.1*getHeight(), 0.23*getWidth(), 0.885*getHeight(), 4.0f); + g.setColour (Colours::grey); + g.fillRoundedRectangle (0.005 * getWidth() + 0.25 * i * getWidth(), 0.1 * getHeight(), 0.23 * getWidth(), 0.885 * getHeight(), 4.0f); } - } void PulsePalOutputCanvas::resized() { - pulsePalLabel->setBounds(0.01*getWidth(), 0.02*getHeight(), 0.5*getWidth(),0.04*getHeight()); + pulsePalLabel->setBounds (0.01 * getWidth(), 0.02 * getHeight(), 0.5 * getWidth(), 0.04 * getHeight()); for (int i = 0; i < PULSEPALCHANNELS; i++) { - channelLabel[i]->setBounds(0.01*getWidth() + 0.25*i*getWidth(), 0.11*getHeight(), 0.2*getWidth(),0.04*getHeight()); - - phase1Label[i]->setBounds(0.01*getWidth() + 0.25*i*getWidth(), 0.2*getHeight(), 0.1*getWidth(),0.04*getHeight()); - phase1EditLabel[i]->setBounds(0.13*getWidth() + 0.25*i*getWidth(), 0.2*getHeight(), 0.1*getWidth(),0.04*getHeight()); - voltage1Label[i]->setBounds(0.01*getWidth() + 0.25*i*getWidth(), 0.25*getHeight(), 0.1*getWidth(),0.04*getHeight()); - voltage1EditLabel[i]->setBounds(0.13*getWidth() + 0.25*i*getWidth(), 0.25*getHeight(), 0.1*getWidth(),0.04*getHeight()); - phase2Label[i]->setBounds(0.01*getWidth() + 0.25*i*getWidth(), 0.3*getHeight(), 0.1*getWidth(),0.04*getHeight()); - phase2EditLabel[i]->setBounds(0.13*getWidth() + 0.25*i*getWidth(), 0.3*getHeight(), 0.1*getWidth(),0.04*getHeight()); - voltage2Label[i]->setBounds(0.01*getWidth() + 0.25*i*getWidth(), 0.35*getHeight(), 0.1*getWidth(),0.04*getHeight()); - voltage2EditLabel[i]->setBounds(0.13*getWidth() + 0.25*i*getWidth(), 0.35*getHeight(), 0.1*getWidth(),0.04*getHeight()); - interphaseLabel[i]->setBounds(0.01*getWidth() + 0.25*i*getWidth(), 0.4*getHeight(), 0.1*getWidth(),0.04*getHeight()); - interphaseEditLabel[i]->setBounds(0.13*getWidth() + 0.25*i*getWidth(), 0.4*getHeight(), 0.1*getWidth(),0.04*getHeight()); - - restingVoltageLabel[i]->setBounds(0.01*getWidth() + 0.25*i*getWidth(), 0.45*getHeight(), 0.1*getWidth(),0.04*getHeight()); - restingVoltageEditLabel[i]->setBounds(0.13*getWidth() + 0.25*i*getWidth(), 0.45*getHeight(), 0.1*getWidth(),0.04*getHeight()); - interpulseLabel[i]->setBounds(0.01*getWidth() + 0.25*i*getWidth(), 0.5*getHeight(), 0.1*getWidth(),0.04*getHeight()); - interpulseEditLabel[i]->setBounds(0.13*getWidth() + 0.25*i*getWidth(), 0.5*getHeight(), 0.1*getWidth(),0.04*getHeight()); - burstDurationLabel[i]->setBounds(0.01*getWidth() + 0.25*i*getWidth(), 0.55*getHeight(), 0.1*getWidth(),0.04*getHeight()); - burstDurationEditLabel[i]->setBounds(0.13*getWidth() + 0.25*i*getWidth(), 0.55*getHeight(), 0.1*getWidth(),0.04*getHeight()); - interburstLabel[i]->setBounds(0.01*getWidth() + 0.25*i*getWidth(), 0.6*getHeight(), 0.1*getWidth(),0.04*getHeight()); - interburstEditLabel[i]->setBounds(0.13*getWidth() + 0.25*i*getWidth(), 0.6*getHeight(), 0.1*getWidth(),0.04*getHeight()); - trainDurationLabel[i]->setBounds(0.01*getWidth() + 0.25*i*getWidth(), 0.65*getHeight(), 0.1*getWidth(),0.04*getHeight()); - trainDurationEditLabel[i]->setBounds(0.13*getWidth() + 0.25*i*getWidth(), 0.65*getHeight(), 0.1*getWidth(),0.04*getHeight()); - trainDelayLabel[i]->setBounds(0.01*getWidth() + 0.25*i*getWidth(), 0.7*getHeight(), 0.1*getWidth(),0.04*getHeight()); - trainDelayEditLabel[i]->setBounds(0.13*getWidth() + 0.25*i*getWidth(), 0.7*getHeight(), 0.1*getWidth(),0.04*getHeight()); - triggerModeLabel[i]->setBounds(0.01*getWidth() + 0.25*i*getWidth(), 0.75*getHeight(), 0.1*getWidth(),0.04*getHeight()); - triggerMode[i]->setBounds(0.13*getWidth() + 0.25*i*getWidth(), 0.75*getHeight(), 0.1*getWidth(),0.04*getHeight()); - - link2tr1Button[i]->setBounds(0.01*getWidth() + 0.25*i*getWidth(), 0.83*getHeight(), 0.11*getWidth(), 0.03*getHeight()); - link2tr2Button[i]->setBounds(0.12*getWidth() + 0.25*i*getWidth(), 0.83*getHeight(), 0.11*getWidth(), 0.03*getHeight()); - biphasicButton[i]->setBounds(0.01*getWidth() + 0.25*i*getWidth(), 0.87*getHeight(), 0.11*getWidth(), 0.03*getHeight()); - burstButton[i]->setBounds(0.12*getWidth() + 0.25*i*getWidth(), 0.87*getHeight(), 0.11*getWidth(), 0.03*getHeight()); - ttlButton[i]->setBounds(0.01*getWidth() + 0.25*i*getWidth(), 0.91*getHeight(), 0.11*getWidth(), 0.06*getHeight()); - continuousButton[i]->setBounds(0.12*getWidth() + 0.25*i*getWidth(), 0.91*getHeight(), 0.11*getWidth(), 0.06*getHeight()); + channelLabel[i]->setBounds (0.01 * getWidth() + 0.25 * i * getWidth(), 0.11 * getHeight(), 0.2 * getWidth(), 0.04 * getHeight()); + + phase1Label[i]->setBounds (0.01 * getWidth() + 0.25 * i * getWidth(), 0.2 * getHeight(), 0.1 * getWidth(), 0.04 * getHeight()); + phase1EditLabel[i]->setBounds (0.13 * getWidth() + 0.25 * i * getWidth(), 0.2 * getHeight(), 0.1 * getWidth(), 0.04 * getHeight()); + voltage1Label[i]->setBounds (0.01 * getWidth() + 0.25 * i * getWidth(), 0.25 * getHeight(), 0.1 * getWidth(), 0.04 * getHeight()); + voltage1EditLabel[i]->setBounds (0.13 * getWidth() + 0.25 * i * getWidth(), 0.25 * getHeight(), 0.1 * getWidth(), 0.04 * getHeight()); + phase2Label[i]->setBounds (0.01 * getWidth() + 0.25 * i * getWidth(), 0.3 * getHeight(), 0.1 * getWidth(), 0.04 * getHeight()); + phase2EditLabel[i]->setBounds (0.13 * getWidth() + 0.25 * i * getWidth(), 0.3 * getHeight(), 0.1 * getWidth(), 0.04 * getHeight()); + voltage2Label[i]->setBounds (0.01 * getWidth() + 0.25 * i * getWidth(), 0.35 * getHeight(), 0.1 * getWidth(), 0.04 * getHeight()); + voltage2EditLabel[i]->setBounds (0.13 * getWidth() + 0.25 * i * getWidth(), 0.35 * getHeight(), 0.1 * getWidth(), 0.04 * getHeight()); + interphaseLabel[i]->setBounds (0.01 * getWidth() + 0.25 * i * getWidth(), 0.4 * getHeight(), 0.1 * getWidth(), 0.04 * getHeight()); + interphaseEditLabel[i]->setBounds (0.13 * getWidth() + 0.25 * i * getWidth(), 0.4 * getHeight(), 0.1 * getWidth(), 0.04 * getHeight()); + + restingVoltageLabel[i]->setBounds (0.01 * getWidth() + 0.25 * i * getWidth(), 0.45 * getHeight(), 0.1 * getWidth(), 0.04 * getHeight()); + restingVoltageEditLabel[i]->setBounds (0.13 * getWidth() + 0.25 * i * getWidth(), 0.45 * getHeight(), 0.1 * getWidth(), 0.04 * getHeight()); + interpulseLabel[i]->setBounds (0.01 * getWidth() + 0.25 * i * getWidth(), 0.5 * getHeight(), 0.1 * getWidth(), 0.04 * getHeight()); + interpulseEditLabel[i]->setBounds (0.13 * getWidth() + 0.25 * i * getWidth(), 0.5 * getHeight(), 0.1 * getWidth(), 0.04 * getHeight()); + burstDurationLabel[i]->setBounds (0.01 * getWidth() + 0.25 * i * getWidth(), 0.55 * getHeight(), 0.1 * getWidth(), 0.04 * getHeight()); + burstDurationEditLabel[i]->setBounds (0.13 * getWidth() + 0.25 * i * getWidth(), 0.55 * getHeight(), 0.1 * getWidth(), 0.04 * getHeight()); + interburstLabel[i]->setBounds (0.01 * getWidth() + 0.25 * i * getWidth(), 0.6 * getHeight(), 0.1 * getWidth(), 0.04 * getHeight()); + interburstEditLabel[i]->setBounds (0.13 * getWidth() + 0.25 * i * getWidth(), 0.6 * getHeight(), 0.1 * getWidth(), 0.04 * getHeight()); + trainDurationLabel[i]->setBounds (0.01 * getWidth() + 0.25 * i * getWidth(), 0.65 * getHeight(), 0.1 * getWidth(), 0.04 * getHeight()); + trainDurationEditLabel[i]->setBounds (0.13 * getWidth() + 0.25 * i * getWidth(), 0.65 * getHeight(), 0.1 * getWidth(), 0.04 * getHeight()); + trainDelayLabel[i]->setBounds (0.01 * getWidth() + 0.25 * i * getWidth(), 0.7 * getHeight(), 0.1 * getWidth(), 0.04 * getHeight()); + trainDelayEditLabel[i]->setBounds (0.13 * getWidth() + 0.25 * i * getWidth(), 0.7 * getHeight(), 0.1 * getWidth(), 0.04 * getHeight()); + triggerModeLabel[i]->setBounds (0.01 * getWidth() + 0.25 * i * getWidth(), 0.75 * getHeight(), 0.1 * getWidth(), 0.04 * getHeight()); + triggerMode[i]->setBounds (0.13 * getWidth() + 0.25 * i * getWidth(), 0.75 * getHeight(), 0.1 * getWidth(), 0.04 * getHeight()); + + link2tr1Button[i]->setBounds (0.01 * getWidth() + 0.25 * i * getWidth(), 0.83 * getHeight(), 0.11 * getWidth(), 0.03 * getHeight()); + link2tr2Button[i]->setBounds (0.12 * getWidth() + 0.25 * i * getWidth(), 0.83 * getHeight(), 0.11 * getWidth(), 0.03 * getHeight()); + biphasicButton[i]->setBounds (0.01 * getWidth() + 0.25 * i * getWidth(), 0.87 * getHeight(), 0.11 * getWidth(), 0.03 * getHeight()); + burstButton[i]->setBounds (0.12 * getWidth() + 0.25 * i * getWidth(), 0.87 * getHeight(), 0.11 * getWidth(), 0.03 * getHeight()); + ttlButton[i]->setBounds (0.01 * getWidth() + 0.25 * i * getWidth(), 0.91 * getHeight(), 0.11 * getWidth(), 0.06 * getHeight()); + continuousButton[i]->setBounds (0.12 * getWidth() + 0.25 * i * getWidth(), 0.91 * getHeight(), 0.11 * getWidth(), 0.06 * getHeight()); } - } -void PulsePalOutputCanvas::buttonClicked(Button* button) +void PulsePalOutputCanvas::buttonClicked (Button* button) { for (int i = 0; i < PULSEPALCHANNELS; i++) { if (button == biphasicButton[i]) { - if (button->getToggleState()==true) + if (button->getToggleState() == true) { - processor->setIsBiphasic(i, true); - phase2Label[i]->setVisible(true); - phase2EditLabel[i]->setVisible(true); - interphaseLabel[i]->setVisible(true); - interphaseEditLabel[i]->setVisible(true); - voltage2Label[i]->setVisible(true); - voltage2EditLabel[i]->setVisible(true); + processor->setIsBiphasic (i, true); + phase2Label[i]->setVisible (true); + phase2EditLabel[i]->setVisible (true); + interphaseLabel[i]->setVisible (true); + interphaseEditLabel[i]->setVisible (true); + voltage2Label[i]->setVisible (true); + voltage2EditLabel[i]->setVisible (true); } else { - processor->setIsBiphasic(i, false); - phase2Label[i]->setVisible(false); - phase2EditLabel[i]->setVisible(false); - interphaseLabel[i]->setVisible(false); - interphaseEditLabel[i]->setVisible(false); - voltage2Label[i]->setVisible(false); - voltage2EditLabel[i]->setVisible(false); + processor->setIsBiphasic (i, false); + phase2Label[i]->setVisible (false); + phase2EditLabel[i]->setVisible (false); + interphaseLabel[i]->setVisible (false); + interphaseEditLabel[i]->setVisible (false); + voltage2Label[i]->setVisible (false); + voltage2EditLabel[i]->setVisible (false); } } else if (button == burstButton[i]) { - if (button->getToggleState()==true) + if (button->getToggleState() == true) { - if (processor->getBurstDuration(i) == 0) + if (processor->getBurstDuration (i) == 0) { - processor->setBurstDuration(i, DEF_BURSTDURATION); - processor->setInterBurstInt(i, DEF_INTER_BURST); + processor->setBurstDuration (i, DEF_BURSTDURATION); + processor->setInterBurstInt (i, DEF_INTER_BURST); } - burstDurationLabel[i]->setVisible(true); - burstDurationEditLabel[i]->setVisible(true); - interburstLabel[i]->setVisible(true); - interburstEditLabel[i]->setVisible(true); + burstDurationLabel[i]->setVisible (true); + burstDurationEditLabel[i]->setVisible (true); + interburstLabel[i]->setVisible (true); + interburstEditLabel[i]->setVisible (true); } else { - if (processor->getBurstDuration(i) != 0) + if (processor->getBurstDuration (i) != 0) { - processor->setBurstDuration(i, 0); - processor->setInterBurstInt(i, 0); + processor->setBurstDuration (i, 0); + processor->setInterBurstInt (i, 0); } - burstDurationLabel[i]->setVisible(false); - burstDurationEditLabel[i]->setVisible(false); - interburstLabel[i]->setVisible(false); - interburstEditLabel[i]->setVisible(false); + burstDurationLabel[i]->setVisible (false); + burstDurationEditLabel[i]->setVisible (false); + interburstLabel[i]->setVisible (false); + interburstEditLabel[i]->setVisible (false); } } else if (button == link2tr1Button[i]) { - if (button->getToggleState()==true) - processor->setLinkTriggerChannel1(i, 1); - else if (button->getToggleState()==false) - processor->setLinkTriggerChannel1(i, 0); + if (button->getToggleState() == true) + processor->setLinkTriggerChannel1 (i, 1); + else if (button->getToggleState() == false) + processor->setLinkTriggerChannel1 (i, 0); } else if (button == link2tr2Button[i]) { - if (button->getToggleState()==true) - processor->setLinkTriggerChannel2(i, 1); - else if (button->getToggleState()==false) - processor->setLinkTriggerChannel2(i, 0); + if (button->getToggleState() == true) + processor->setLinkTriggerChannel2 (i, 1); + else if (button->getToggleState() == false) + processor->setLinkTriggerChannel2 (i, 0); } else if (button == ttlButton[i]) { // set ttl channel i - processor->setTTLsettings(i); - processor->setIsBiphasic(i, false); - phase2Label[i]->setVisible(false); - phase2EditLabel[i]->setVisible(false); - interphaseLabel[i]->setVisible(false); - interphaseEditLabel[i]->setVisible(false); - voltage2Label[i]->setVisible(false); - voltage2EditLabel[i]->setVisible(false); - burstDurationLabel[i]->setVisible(false); - burstDurationEditLabel[i]->setVisible(false); - interburstLabel[i]->setVisible(false); - interburstEditLabel[i]->setVisible(false); - if (biphasicButton[i]->getToggleState()==true) + processor->setTTLsettings (i); + processor->setIsBiphasic (i, false); + phase2Label[i]->setVisible (false); + phase2EditLabel[i]->setVisible (false); + interphaseLabel[i]->setVisible (false); + interphaseEditLabel[i]->setVisible (false); + voltage2Label[i]->setVisible (false); + voltage2EditLabel[i]->setVisible (false); + burstDurationLabel[i]->setVisible (false); + burstDurationEditLabel[i]->setVisible (false); + interburstLabel[i]->setVisible (false); + interburstEditLabel[i]->setVisible (false); + if (biphasicButton[i]->getToggleState() == true) { - biphasicButton[i]->setToggleState(false, dontSendNotification); + biphasicButton[i]->setToggleState (false, dontSendNotification); } - if (burstButton[i]->getToggleState()==true) + if (burstButton[i]->getToggleState() == true) { - burstButton[i]->setToggleState(false, dontSendNotification); + burstButton[i]->setToggleState (false, dontSendNotification); } } - else if (button == continuousButton[i]) - { - if (button->getToggleState() == true) - processor->setContinuous(i, 1); - else if (button->getToggleState() == false) - processor->setContinuous(i, 0); - } - if (!processor->checkParameterConsistency(i)) + else if (button == continuousButton[i]) + { + if (button->getToggleState() == true) + processor->setContinuous (i, 1); + else if (button->getToggleState() == false) + processor->setContinuous (i, 0); + } + if (! processor->checkParameterConsistency (i)) { - CoreServices::sendStatusMessage("Inconsistent parameters: set train duration first"); - processor->adjustParameters(i); + CoreServices::sendStatusMessage ("Inconsistent parameters: set train duration first"); + processor->adjustParameters (i); } - updateLabels(i); - processor->updatePulsePal(i); + updateLabels (i); + processor->updatePulsePal (i); } repaint(); } - -void PulsePalOutputCanvas::labelTextChanged(Label *label) +void PulsePalOutputCanvas::labelTextChanged (Label* label) { for (int i = 0; i < PULSEPALCHANNELS; i++) { @@ -242,453 +229,445 @@ void PulsePalOutputCanvas::labelTextChanged(Label *label) { // 100 - 3600*10e3 (3600 s) Value val = label->getTextValue(); - float value = float(my_round(float(val.getValue())*10) / 10); //only multiple of 100us - if ((float(val.getValue()) >= 0 && int(val.getValue())<=MAX_INTERVAL)) + float value = float (my_round (float (val.getValue()) * 10) / 10); //only multiple of 100us + if ((float (val.getValue()) >= 0 && int (val.getValue()) <= MAX_INTERVAL)) { - processor->setPhase1Duration(i, value); - label->setText(String(value), dontSendNotification); + processor->setPhase1Duration (i, value); + label->setText (String (value), dontSendNotification); } else { - CoreServices::sendStatusMessage("Selected values must be within 0 and 3600000 with 0.1 step!"); - label->setText("", dontSendNotification); - + CoreServices::sendStatusMessage ("Selected values must be within 0 and 3600000 with 0.1 step!"); + label->setText ("", dontSendNotification); } } else if (label == phase2EditLabel[i]) { // 100 - 3600000 (3600 s) Value val = label->getTextValue(); - float value = float(my_round(float(val.getValue())*10) / 10); //only multiple of 100us - if ((float(val.getValue())>=0 && int(val.getValue())<=MAX_INTERVAL)) + float value = float (my_round (float (val.getValue()) * 10) / 10); //only multiple of 100us + if ((float (val.getValue()) >= 0 && int (val.getValue()) <= MAX_INTERVAL)) { - processor->setPhase2Duration(i, value); - label->setText(String(value), dontSendNotification); + processor->setPhase2Duration (i, value); + label->setText (String (value), dontSendNotification); } else { - CoreServices::sendStatusMessage("Selected values must be within 0 and 3600*10e3 with 0.1 step!"); - label->setText("", dontSendNotification); - + CoreServices::sendStatusMessage ("Selected values must be within 0 and 3600*10e3 with 0.1 step!"); + label->setText ("", dontSendNotification); } } else if (label == interphaseEditLabel[i]) { Value val = label->getTextValue(); - float value = float(my_round(float(val.getValue())*10) / 10); //only multiple of 100us - if ((float(val.getValue())>=0 && int(val.getValue())<=MAX_INTERVAL)) + float value = float (my_round (float (val.getValue()) * 10) / 10); //only multiple of 100us + if ((float (val.getValue()) >= 0 && int (val.getValue()) <= MAX_INTERVAL)) { - processor->setInterPhaseInt(i, value); - label->setText(String(value), dontSendNotification); + processor->setInterPhaseInt (i, value); + label->setText (String (value), dontSendNotification); } else { - CoreServices::sendStatusMessage("Selected values must be within 0 and 3600*10e3 with 0.1 step!"); - label->setText("", dontSendNotification); + CoreServices::sendStatusMessage ("Selected values must be within 0 and 3600*10e3 with 0.1 step!"); + label->setText ("", dontSendNotification); } } else if (label == voltage1EditLabel[i]) { Value val = label->getTextValue(); - if (float(val.getValue()) >= 0 && float(val.getValue()) <= MAX_VOLTAGE) + if (float (val.getValue()) >= 0 && float (val.getValue()) <= MAX_VOLTAGE) { - processor->setVoltage1(i, float(val.getValue())); + processor->setVoltage1 (i, float (val.getValue())); } else { - CoreServices::sendStatusMessage("Selected values must be within 0 and 10 with 0.05 step!"); - label->setText("", dontSendNotification); + CoreServices::sendStatusMessage ("Selected values must be within 0 and 10 with 0.05 step!"); + label->setText ("", dontSendNotification); } } else if (label == voltage2EditLabel[i]) { Value val = label->getTextValue(); - if (float(val.getValue()) >= 0 && float(val.getValue()) <= MAX_VOLTAGE) + if (float (val.getValue()) >= 0 && float (val.getValue()) <= MAX_VOLTAGE) { - processor->setVoltage2(i, float(val.getValue())); + processor->setVoltage2 (i, float (val.getValue())); } else { - CoreServices::sendStatusMessage("Selected values must be within 0 and 10 with 0.05 step!"); - label->setText("", dontSendNotification); + CoreServices::sendStatusMessage ("Selected values must be within 0 and 10 with 0.05 step!"); + label->setText ("", dontSendNotification); } } else if (label == burstDurationEditLabel[i]) { Value val = label->getTextValue(); - float value = float(my_round(float(val.getValue())*10) / 10); //only multiple of 100us - if ((float(val.getValue()) >= 0 && int(val.getValue()) <= MAX_INTERVAL)) + float value = float (my_round (float (val.getValue()) * 10) / 10); //only multiple of 100us + if ((float (val.getValue()) >= 0 && int (val.getValue()) <= MAX_INTERVAL)) { - processor->setBurstDuration(i, value); - label->setText(String(value), dontSendNotification); + processor->setBurstDuration (i, value); + label->setText (String (value), dontSendNotification); } else { - CoreServices::sendStatusMessage("Selected values must be within 0 and 3600*10e3 with 0.1 step!"); - label->setText("", dontSendNotification); + CoreServices::sendStatusMessage ("Selected values must be within 0 and 3600*10e3 with 0.1 step!"); + label->setText ("", dontSendNotification); } } else if (label == interburstEditLabel[i]) { Value val = label->getTextValue(); - float value = float(my_round(float(val.getValue())*10) / 10); //only multiple of 100us - if ((float(val.getValue()) >= 0 && int(val.getValue()) <= MAX_INTERVAL)) + float value = float (my_round (float (val.getValue()) * 10) / 10); //only multiple of 100us + if ((float (val.getValue()) >= 0 && int (val.getValue()) <= MAX_INTERVAL)) { - processor->setInterBurstInt(i, value); - label->setText(String(value), dontSendNotification); + processor->setInterBurstInt (i, value); + label->setText (String (value), dontSendNotification); } else { - CoreServices::sendStatusMessage("Selected values must be within 0 and 3600*10e3 with 0.1 step!"); - label->setText("", dontSendNotification); + CoreServices::sendStatusMessage ("Selected values must be within 0 and 3600*10e3 with 0.1 step!"); + label->setText ("", dontSendNotification); } } else if (label == interpulseEditLabel[i]) { Value val = label->getTextValue(); - float value = float(my_round(float(val.getValue())*10) / 10); //only multiple of 100us - if ((float(val.getValue()) >= 0 && int(val.getValue()) <= MAX_INTERVAL)) + float value = float (my_round (float (val.getValue()) * 10) / 10); //only multiple of 100us + if ((float (val.getValue()) >= 0 && int (val.getValue()) <= MAX_INTERVAL)) { - processor->setInterPulseInt(i, value); - label->setText(String(value), dontSendNotification); + processor->setInterPulseInt (i, value); + label->setText (String (value), dontSendNotification); } else { - CoreServices::sendStatusMessage("Selected values must be within 0 and 3600*10e3 with 0.1 step!"); - label->setText("", dontSendNotification); + CoreServices::sendStatusMessage ("Selected values must be within 0 and 3600*10e3 with 0.1 step!"); + label->setText ("", dontSendNotification); } } else if (label == trainDurationEditLabel[i]) { Value val = label->getTextValue(); - float value = float(my_round(float(val.getValue())*10) / 10); //only multiple of 100us - if ((float(val.getValue()) >= 0 && int(val.getValue()) <= MAX_INTERVAL)) + float value = float (my_round (float (val.getValue()) * 10) / 10); //only multiple of 100us + if ((float (val.getValue()) >= 0 && int (val.getValue()) <= MAX_INTERVAL)) { - processor->setTrainDuration(i, value); - label->setText(String(value), dontSendNotification); + processor->setTrainDuration (i, value); + label->setText (String (value), dontSendNotification); } else { - CoreServices::sendStatusMessage("Selected values must be within 0 and 3600*10e3 with 0.1 step!"); - label->setText("", dontSendNotification); + CoreServices::sendStatusMessage ("Selected values must be within 0 and 3600*10e3 with 0.1 step!"); + label->setText ("", dontSendNotification); } } else if (label == trainDelayEditLabel[i]) { Value val = label->getTextValue(); - float value = float(my_round(float(val.getValue())*10) / 10); //only multiple of 100us - if ((float(val.getValue()) >= 0 && int(val.getValue()) <= MAX_INTERVAL)) + float value = float (my_round (float (val.getValue()) * 10) / 10); //only multiple of 100us + if ((float (val.getValue()) >= 0 && int (val.getValue()) <= MAX_INTERVAL)) { - processor->setTrainDelay(i, value); - label->setText(String(value), dontSendNotification); + processor->setTrainDelay (i, value); + label->setText (String (value), dontSendNotification); } else { - CoreServices::sendStatusMessage("Selected values must be within 0 and 3600*10e3 with 0.1 step!"); - label->setText("", dontSendNotification); + CoreServices::sendStatusMessage ("Selected values must be within 0 and 3600*10e3 with 0.1 step!"); + label->setText ("", dontSendNotification); } } - if (!processor->checkParameterConsistency(i)) + if (! processor->checkParameterConsistency (i)) { - CoreServices::sendStatusMessage("Inconsistent parameters: set train duration first"); - processor->adjustParameters(i); + CoreServices::sendStatusMessage ("Inconsistent parameters: set train duration first"); + processor->adjustParameters (i); } - updateLabels(i); - processor->updatePulsePal(i); + updateLabels (i); + processor->updatePulsePal (i); } } -void PulsePalOutputCanvas::comboBoxChanged(ComboBox *combobox) +void PulsePalOutputCanvas::comboBoxChanged (ComboBox* combobox) { for (int i = 0; i < PULSEPALCHANNELS; i++) if (combobox == triggerMode[i]) - processor->setTriggerMode(i, combobox->getSelectedId() - 1); + processor->setTriggerMode (i, combobox->getSelectedId() - 1); } void PulsePalOutputCanvas::initButtons() { - for (int i = 0; i < PULSEPALCHANNELS; i++) { - ScopedPointer biph = new UtilityButton("biphasic"); - biph->setRadius(3.0f); - biph->addListener(this); - biph->setClickingTogglesState(true); + ScopedPointer biph = new UtilityButton ("biphasic"); + biph->setRadius (3.0f); + biph->addListener (this); + biph->setClickingTogglesState (true); biphasicButton[i] = biph; - addAndMakeVisible(biphasicButton[i]); + addAndMakeVisible (biphasicButton[i]); - ScopedPointer burst = new UtilityButton("burst"); - burst->setRadius(3.0f); - burst->addListener(this); - burst->setClickingTogglesState(true); + ScopedPointer burst = new UtilityButton ("burst"); + burst->setRadius (3.0f); + burst->addListener (this); + burst->setClickingTogglesState (true); burstButton[i] = burst; - addAndMakeVisible(burstButton[i]); + addAndMakeVisible (burstButton[i]); - ScopedPointer link21 = new UtilityButton("link trig 1"); - link21->setRadius(3.0f); - link21->addListener(this); - link21->setClickingTogglesState(true); + ScopedPointer link21 = new UtilityButton ("link trig 1"); + link21->setRadius (3.0f); + link21->addListener (this); + link21->setClickingTogglesState (true); link2tr1Button[i] = link21; - addAndMakeVisible(link2tr1Button[i]); + addAndMakeVisible (link2tr1Button[i]); - ScopedPointer link22 = new UtilityButton("link trig 2"); - link22->setRadius(3.0f); - link22->addListener(this); - link22->setClickingTogglesState(true); + ScopedPointer link22 = new UtilityButton ("link trig 2"); + link22->setRadius (3.0f); + link22->addListener (this); + link22->setClickingTogglesState (true); link2tr2Button[i] = link22; - addAndMakeVisible(link2tr2Button[i]); + addAndMakeVisible (link2tr2Button[i]); - ScopedPointer ttl = new UtilityButton("ttl"); - ttl->setRadius(3.0f); - ttl->addListener(this); + ScopedPointer ttl = new UtilityButton ("ttl"); + ttl->setRadius (3.0f); + ttl->addListener (this); ttlButton[i] = ttl; - addAndMakeVisible(ttlButton[i]); - - ScopedPointer continuous = new UtilityButton("continuous"); - continuous->setRadius(3.0f); - continuous->addListener(this); - continuous->setClickingTogglesState(true); - continuousButton[i] = continuous; - addAndMakeVisible(continuousButton[i]); + addAndMakeVisible (ttlButton[i]); + ScopedPointer continuous = new UtilityButton ("continuous"); + continuous->setRadius (3.0f); + continuous->addListener (this); + continuous->setClickingTogglesState (true); + continuousButton[i] = continuous; + addAndMakeVisible (continuousButton[i]); ScopedPointer mode = new ComboBox(); - mode->addListener(this); + mode->addListener (this); for (int i = 0; i < 3; i++) - mode->addItem(String(i), i+1); + mode->addItem (String (i), i + 1); // user-visible channels - mode->setSelectedId(processor->getTriggerMode(i)+1, dontSendNotification); + mode->setSelectedId (processor->getTriggerMode (i) + 1, dontSendNotification); triggerMode[i] = mode; - addAndMakeVisible(triggerMode[i]); + addAndMakeVisible (triggerMode[i]); - - if (processor->getIsBiphasic(i)) + if (processor->getIsBiphasic (i)) biphasicButton[i]->triggerClick(); - if (processor->getLinkTriggerChannel1(i)) + if (processor->getLinkTriggerChannel1 (i)) link2tr1Button[i]->triggerClick(); - if (processor->getLinkTriggerChannel2(i)) + if (processor->getLinkTriggerChannel2 (i)) link2tr2Button[i]->triggerClick(); } } -void PulsePalOutputCanvas::updateLabels(int i) +void PulsePalOutputCanvas::updateLabels (int i) { - phase1EditLabel[i]->setText(String(processor->getPhase1Duration(i)), dontSendNotification); - phase2EditLabel[i]->setText(String(processor->getPhase2Duration(i)), dontSendNotification); - voltage1EditLabel[i]->setText(String(processor->getVoltage1(i)), dontSendNotification); - voltage2EditLabel[i]->setText(String(processor->getVoltage2(i)), dontSendNotification); - interphaseEditLabel[i]->setText(String(processor->getInterPhaseInt(i)), dontSendNotification); - restingVoltageEditLabel[i]->setText(String(processor->getRestingVoltage(i)), dontSendNotification); - interpulseEditLabel[i]->setText(String(processor->getInterPulseInt(i)), dontSendNotification); - burstDurationEditLabel[i]->setText(String(processor->getBurstDuration(i)), dontSendNotification); - interburstEditLabel[i]->setText(String(processor->getInterBurstInt(i)), dontSendNotification); - trainDurationEditLabel[i]->setText(String(processor->getTrainDuration(i)), dontSendNotification); - trainDelayEditLabel[i]->setText(String(processor->getTrainDelay(i)), dontSendNotification); + phase1EditLabel[i]->setText (String (processor->getPhase1Duration (i)), dontSendNotification); + phase2EditLabel[i]->setText (String (processor->getPhase2Duration (i)), dontSendNotification); + voltage1EditLabel[i]->setText (String (processor->getVoltage1 (i)), dontSendNotification); + voltage2EditLabel[i]->setText (String (processor->getVoltage2 (i)), dontSendNotification); + interphaseEditLabel[i]->setText (String (processor->getInterPhaseInt (i)), dontSendNotification); + restingVoltageEditLabel[i]->setText (String (processor->getRestingVoltage (i)), dontSendNotification); + interpulseEditLabel[i]->setText (String (processor->getInterPulseInt (i)), dontSendNotification); + burstDurationEditLabel[i]->setText (String (processor->getBurstDuration (i)), dontSendNotification); + interburstEditLabel[i]->setText (String (processor->getInterBurstInt (i)), dontSendNotification); + trainDurationEditLabel[i]->setText (String (processor->getTrainDuration (i)), dontSendNotification); + trainDelayEditLabel[i]->setText (String (processor->getTrainDelay (i)), dontSendNotification); } void PulsePalOutputCanvas::initLabels() { - pulsePalLabel = new Label("s_pulsePal", "Pulse Pal Status: "); - pulsePalLabel->setFont(Font(40)); - pulsePalLabel->setColour(Label::textColourId, labelColour); - addAndMakeVisible(pulsePalLabel); + pulsePalLabel = new Label ("s_pulsePal", "Pulse Pal Status: "); + pulsePalLabel->setFont (Font (40)); + pulsePalLabel->setColour (Label::textColourId, labelColour); + addAndMakeVisible (pulsePalLabel); - pulsePalLabel = new Label("s_pp", "Pulse Pal:"); - pulsePalLabel->setFont(Font(40)); - pulsePalLabel->setColour(Label::textColourId, labelColour); - addAndMakeVisible(pulsePalLabel); + pulsePalLabel = new Label ("s_pp", "Pulse Pal:"); + pulsePalLabel->setFont (Font (40)); + pulsePalLabel->setColour (Label::textColourId, labelColour); + addAndMakeVisible (pulsePalLabel); for (int i = 0; i < PULSEPALCHANNELS; i++) { - ScopedPointer