From 89e9b65e19155e6e7ab5233eadf5ffc41d7acf18 Mon Sep 17 00:00:00 2001 From: Josh Siegle Date: Thu, 18 Jan 2024 10:06:24 -0800 Subject: [PATCH] Add docstrings to header files --- Source/MeanSpikeRate.cpp | 2 +- Source/MeanSpikeRate.h | 36 +++++++++++++++++++++++--------- Source/MeanSpikeRateEditor.h | 40 +++++++++++++++++++++++++++++++++++- 3 files changed, 66 insertions(+), 12 deletions(-) diff --git a/Source/MeanSpikeRate.cpp b/Source/MeanSpikeRate.cpp index 5519301..e759809 100644 --- a/Source/MeanSpikeRate.cpp +++ b/Source/MeanSpikeRate.cpp @@ -39,7 +39,7 @@ AudioProcessorEditor* MeanSpikeRate::createEditor() return editor.get(); } -void MeanSpikeRate::process(AudioSampleBuffer& continuousBuffer) +void MeanSpikeRate::process(AudioBuffer& continuousBuffer) { for (auto stream : getDataStreams()) { diff --git a/Source/MeanSpikeRate.h b/Source/MeanSpikeRate.h index 6298bb6..ee4a2ea 100644 --- a/Source/MeanSpikeRate.h +++ b/Source/MeanSpikeRate.h @@ -26,14 +26,12 @@ along with this program. If not, see . #include -/* Estimates the mean spike rate over time and channels. Uses an exponentially - * weighted moving average to estimate a temporal mean (with adjustable time - * constant), and averages the rate across selected spike channels (electrodes). - * Outputs the resulting rate onto a selected continuous channel (overwriting its contents). - * - * @see GenericProcessor - */ +/** + + Holds settings for each data stream + +*/ class MeanSpikeRateSettings { public: float timeConstMs; @@ -42,26 +40,44 @@ class MeanSpikeRateSettings { }; +/* Estimates the mean spike rate over time and channels. Uses an exponentially + * weighted moving average to estimate a temporal mean (with adjustable time + * constant), and averages the rate across selected spike channels (electrodes). + * Outputs the resulting rate onto a selected continuous channel (overwriting its contents). + * + * @see GenericProcessor + */ class MeanSpikeRate : public GenericProcessor { friend class MeanSpikeRateEditor; public: + + /** Constructor */ MeanSpikeRate(); + + /** Destructor */ ~MeanSpikeRate(); - bool hasEditor() const { return true; } + /** Creates the custom editor for this processor */ AudioProcessorEditor* createEditor() override; + /** Checks whether an incoming spike channel is selected */ bool isActive(const SpikeChannel* chan) { return spikeChannelActive[chan->getIdentifier()]; }; - void process(AudioSampleBuffer& continuousBuffer) override; + /** Overwrites continuous data with average spike rate */ + void process(AudioBuffer& continuousBuffer) override; + + /** Called when a spike is received */ void handleSpike(SpikePtr spike) override; + /** Called when a parameter is changed */ void parameterValueChanged(Parameter* param) override; - // Stores/loads spike channel selection state. Output channel and time constant are handled automatically + /** Loads spike channel selection state. */ void loadCustomParametersFromXml(XmlElement* parentElement) override; + + /** Saves spike channel selection state. */ void saveCustomParametersToXml(XmlElement* parentElement) override; private: diff --git a/Source/MeanSpikeRateEditor.h b/Source/MeanSpikeRateEditor.h index 11b06c6..def195d 100644 --- a/Source/MeanSpikeRateEditor.h +++ b/Source/MeanSpikeRateEditor.h @@ -27,47 +27,85 @@ along with this program. If not, see . #include #include "MeanSpikeRate.h" +/** + + Used to change the selection state for a particular electrode +*/ class ElectrodeStateButton : public ElectrodeButton { public: + + /** Constructor */ ElectrodeStateButton(SpikeChannel* chan) : ElectrodeButton(0) { identifier = chan->getIdentifier(); } + + /** Destructor */ ~ElectrodeStateButton() {}; + + /** Returns the identifier string for this electrode */ String getIdentifier() { return identifier; } + private: + String identifier; + JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(ElectrodeStateButton); }; +/** + + Scrollable viewport for electrode buttons + +*/ class ElectrodeViewport : public Viewport { public: + + /** Constructor */ ElectrodeViewport() {}; + + /** Destructor */ ~ElectrodeViewport() {}; + /** Called when viewport changes size*/ void resized() override {}; - //Override mouseWheelMove to prevent scrolling conflict with editor viewport + /** Override mouseWheelMove to prevent scrolling conflict with editor viewport */ void mouseWheelMove(const MouseEvent& event, const MouseWheelDetails& wheel) override {} }; +/** + + Custom editor for MeanSpikeRate processor + +*/ class MeanSpikeRateEditor : public GenericEditor, public Button::Listener { public: + /** Constructor */ MeanSpikeRateEditor(MeanSpikeRate* parentNode); + + /** Destructor */ ~MeanSpikeRateEditor(); + /** Updates the UI with the current processor state */ void updateSettings() override; + /** Called when the selected stream has changed */ void selectedStreamHasChanged() override { updateSettings(); } + /** Returns the number of currently selected electrodes */ int getNumActiveElectrodes(); + /** Call back for electrode selection buttons*/ void buttonClicked(Button* button) override; + /** Returns true if a particular electrode is enabled */ bool getSpikeChannelEnabled(int index); + + /** Sets the enabled state for a particular electrode */ void setSpikeChannelEnabled(int index, bool enabled); private: