Skip to content

Commit

Permalink
Add docstrings to header files
Browse files Browse the repository at this point in the history
  • Loading branch information
jsiegle committed Jan 18, 2024
1 parent 4808c80 commit 89e9b65
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 12 deletions.
2 changes: 1 addition & 1 deletion Source/MeanSpikeRate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ AudioProcessorEditor* MeanSpikeRate::createEditor()
return editor.get();
}

void MeanSpikeRate::process(AudioSampleBuffer& continuousBuffer)
void MeanSpikeRate::process(AudioBuffer<float>& continuousBuffer)
{
for (auto stream : getDataStreams())
{
Expand Down
36 changes: 26 additions & 10 deletions Source/MeanSpikeRate.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,12 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.

#include <ProcessorHeaders.h>

/* 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;
Expand All @@ -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<float>& 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:
Expand Down
40 changes: 39 additions & 1 deletion Source/MeanSpikeRateEditor.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,47 +27,85 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <EditorHeaders.h>
#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:
Expand Down

0 comments on commit 89e9b65

Please sign in to comment.