Detects spikes in a continuous signal and outputs events containing the spike data. More...
#include <SpikeDetector.h>
Classes | |
struct | Electrode |
Public Member Functions | |
SpikeDetector () | |
constructor | |
~SpikeDetector () | |
destructor | |
void | process (AudioSampleBuffer &buffer, MidiBuffer &events, int &nSamples) |
Processes an incoming continuous buffer and places new spikes into the event buffer. | |
void | setParameter (int parameterIndex, float newValue) |
Used to alter parameters of data acquisition. | |
void | updateSettings () |
Called whenever the signal chain is altered. | |
bool | enable () |
Called prior to start of acquisition. | |
bool | disable () |
Called after acquisition is finished. | |
AudioProcessorEditor * | createEditor () |
Creates the SpikeDetectorEditor. | |
bool | addElectrode (int nChans) |
Adds an electrode with n channels to be processed. | |
bool | removeElectrode (int index) |
Removes an electrode with a given index. | |
int | getNumChannels (int index) |
Returns the number of channels for a given electrode. | |
bool | setChannel (int electrodeIndex, int channelNum, int newChannel) |
Edits the mapping between input channels and electrode channels. | |
int | getChannel (int index, int chan) |
Returns the continuous channel that maps to a given electrode channel. | |
bool | setElectrodeName (int index, String newName) |
Sets the name of a given electrode. | |
StringArray | getElectrodeNames () |
Returns a StringArray containing the names of all electrodes. | |
void | setChannelThreshold (int electrodeNum, int channelNum, float threshold) |
double | getChannelThreshold (int electrodeNum, int channelNum) |
![]() | |
GenericProcessor (const String &name_) | |
Constructor (sets the processor's name). | |
virtual | ~GenericProcessor () |
Destructor. | |
const String | getName () const |
Returns the name of the processor. | |
virtual void | prepareToPlay (double sampleRate, int estimatedSamplesPerBlock) |
Called by JUCE as soon as a processor is created, as well as before the start of audio callbacks. | |
void | releaseResources () |
Called by JUCE as soon as audio callbacks end. | |
bool | hasEditor () const |
The default is to have no editor. | |
void | reset () |
JUCE method. | |
void | setCurrentProgramStateInformation (const void *data, int sizeInBytes) |
JUCE method. | |
void | setStateInformation (const void *data, int sizeInBytes) |
JUCE method. | |
void | getCurrentProgramStateInformation (MemoryBlock &destData) |
JUCE method. | |
void | getStateInformation (MemoryBlock &destData) |
JUCE method. | |
void | changeProgramName (int index, const String &newName) |
JUCE method. | |
void | setCurrentProgram (int index) |
JUCE method. | |
const String | getInputChannelName (int channelIndex) const |
Returns the name of the input channel with a given index. | |
const String | getOutputChannelName (int channelIndex) const |
Returns the name of the output channel with a given index. | |
const String | getParameterName (int parameterIndex) |
Returns the name of the parameter with a given index. | |
const String | getParameterText (int parameterIndex) |
Returns additional details about the parameter with a given index. | |
float | getParameter (int parameterIndex) |
Returns the current value of a parameter with a given index. | |
const String | getProgramName (int index) |
JUCE method. | |
bool | isInputChannelStereoPair (int index) const |
JUCE method. | |
bool | isOutputChannelStereoPair (int index) const |
JUCE method. | |
bool | acceptsMidi () const |
All processors can accept MIDI (event) data by default. | |
bool | producesMidi () const |
All processors can produce MIDI (event) data by default. | |
bool | isParameterAutomatable (int parameterIndex) |
JUCE method. | |
bool | isMetaParameter (int parameterIndex) |
JUCE method. | |
int | getNumParameters () |
Returns the number of user-editable parameters for this processor. | |
int | getNumPrograms () |
JUCE method. | |
int | getCurrentProgram () |
JUCE method. | |
virtual float | getSampleRate () |
Returns the sample rate for a processor (assumes the same rate for all channels). | |
virtual float | getDefaultSampleRate () |
Returns the default sample rate, in case a processor has no source (or is itself a source). | |
virtual int | getNumInputs () |
Returns the number of inputs to a processor. | |
virtual int | getNumOutputs () |
Returns the number of outputs from a processor. | |
virtual int | getDefaultNumOutputs () |
Returns the default number of outputs, in case a processor has no source (or is itself a source). | |
virtual float | getDefaultBitVolts () |
Returns the default number of volts per bit, in case a processor has no source (or is itself a source). | |
virtual int | getNextChannel (bool t) |
Returns the next available channel (and increments the channel if the input is set to 'true'. | |
virtual void | resetConnections () |
Resets all inter-processor connections prior to the start of data acquisition. | |
virtual void | setCurrentChannel (int chan) |
Sets the current channel (for purposes of updating parameter). | |
int | getNodeId () |
Returns the unique integer ID for a processor. | |
void | setNodeId (int id) |
Sets the unique integer ID for a processor. | |
GenericProcessor * | getSourceNode () |
Returns a pointer to the processor immediately preceding a given processor in the signal chain. | |
GenericProcessor * | getDestNode () |
Returns a pointer to the processor immediately following a given processor in the signal chain. | |
virtual void | switchIO (int) |
Sets the input or output of a splitter or merger. | |
virtual void | switchIO () |
Switches the input or output of a splitter or merger. | |
virtual void | setPathToProcessor (GenericProcessor *p) |
Sets the input to a merger a given processor. | |
virtual void | setSourceNode (GenericProcessor *sn) |
Sets a processor's source node. | |
virtual void | setDestNode (GenericProcessor *dn) |
Sets a processor's destination node. | |
virtual void | setMergerSourceNode (GenericProcessor *sn) |
Sets one of two possible source nodes for a merger. | |
virtual void | setSplitterDestNode (GenericProcessor *dn) |
Sets one of two possible source nodes for a splitter. | |
virtual bool | isSource () |
Returns true if a processor is a source, false otherwise. | |
virtual bool | isSink () |
Returns true if a processor is a sink, false otherwise. | |
virtual bool | isSplitter () |
Returns true if a processor is a splitter, false otherwise. | |
virtual bool | isMerger () |
Returns true if a processor is a merger, false otherwise. | |
virtual bool | canSendSignalTo (GenericProcessor *) |
Returns true if a processor is able to send its output to a given processor. | |
virtual bool | isReady () |
Returns true if a processor is ready to process data (e.g., all of its parameters are initialized, and its data source is connected). | |
virtual void | enableEditor () |
Informs a processor's editor that data acquisition is about to begin. | |
virtual void | disableEditor () |
Informs a processor's editor that data acquisition has ended. | |
virtual bool | enabledState () |
Indicates whether or not a processor is currently enabled (i.e., able to process data). | |
virtual void | enabledState (bool t) |
Sets whether or not a processor is enabled (i.e., able to process data). | |
virtual void | enableCurrentChannel (bool) |
Turns a given channel on or off. | |
virtual bool | stillHasSource () |
Indicates whether a source node is connected to a processor (used for mergers). | |
virtual AudioSampleBuffer * | getContinuousBuffer () |
Returns a pointer to the processor's internal continuous buffer, if it exists. | |
virtual MidiBuffer * | getEventBuffer () |
Returns a pointer to the processor's internal event buffer, if it exists. | |
virtual int | checkForEvents (MidiBuffer &mb) |
Can be called by processors that need to respond to incoming events. | |
virtual void | addEvent (MidiBuffer &mb, uint8 type, int sampleNum, uint8 eventID=0, uint8 eventChannel=0, uint8 numBytes=0, uint8 *data=0) |
Makes it easier for processors to add events to the MidiBuffer. | |
virtual void | handleEvent (int eventType, MidiMessage &event, int samplePosition=0) |
Makes it easier for processors to respond to incoming events, such as TTLs and spikes. | |
virtual GenericEditor * | getEditor () |
Returns a pointer to the processor's editor. | |
virtual void | clearSettings () |
Resets the 'settings' struct to its default state. | |
virtual void | update () |
Default method for updating settings, called by every processor. | |
Parameter & | getParameterByName (String parameterName) |
Returns the parameter for a given name. | |
Parameter & | getParameterReference (int parameterIndex) |
Returns the parameter for a given index. | |
![]() | |
AccessClass () | |
~AccessClass () | |
void | setUIComponent (UIComponent *) |
Sets the object's UIComponent and copies all the necessary pointers from the UIComponent. | |
virtual void | updateChildComponents () |
Called within setUIComponent() to enable subclasses to update their members' pointers. | |
EditorViewport * | getEditorViewport () |
Returns a pointer to the application's EditorViewport. | |
DataViewport * | getDataViewport () |
Returns a pointer to the application's DataViewport. | |
ProcessorList * | getProcessorList () |
Returns a pointer to the application's ProcessorList. | |
ProcessorGraph * | getProcessorGraph () |
Returns a pointer to the application's ProcessorGraph. | |
ControlPanel * | getControlPanel () |
Returns a pointer to the application's DataViewport. | |
MessageCenter * | getMessageCenter () |
Returns a pointer to the application's MessageCenter. | |
UIComponent * | getUIComponent () |
Returns a pointer to the application's UIComponent. | |
AudioComponent * | getAudioComponent () |
Returns a pointer to the application's AudioComponent. |
Public Attributes | |
AudioSampleBuffer | overflowBuffer |
Extra samples are placed in this buffer to allow seamless transitions between callbacks. | |
AudioSampleBuffer & | dataBuffer |
Reference to a continuous buffer (for internal use only). | |
StringArray | electrodeTypes |
Returns a list of possible electrode types (e.g., stereotrode, tetrode). | |
![]() | |
GenericProcessor * | sourceNode |
Pointer to a processor's immediate source node. | |
GenericProcessor * | destNode |
Pointer to a processor's immediate destination. | |
bool | isEnabled |
bool | wasConnected |
int | nextAvailableChannel |
int | saveOrder |
Variable used to orchestrate saving the ProcessorGraph. | |
int | loadOrder |
Variable used to orchestrate loading the ProcessorGraph. | |
int | currentChannel |
The channel that will be updated the next time a parameter is changed. | |
ScopedPointer< GenericEditor > | editor |
Pointer to the processor's editor. | |
OwnedArray< Channel > | channels |
Array of Channel objects for all continuous channels. | |
OwnedArray< Channel > | eventChannels |
Array of Channel objects for all event channels. | |
ProcessorSettings | settings |
int | nodeId |
Each processor has a unique integer ID that can be used to identify it. | |
Array< Parameter > | parameters |
An array of parameters that the user can modify. |
Additional Inherited Members | |
![]() | |
enum | eventTypes { TIMESTAMP = 0, BUFFER_SIZE = 1, PARAMETER_CHANGE = 2, TTL = 3, SPIKE = 4, EEG = 5, CONTINUOUS = 6 } |
enum | eventChannelTypes { GENERIC_EVENT = 999, SINGLE_ELECTRODE = 1, STEREOTRODE = 2, TETRODE = 4 } |
Detects spikes in a continuous signal and outputs events containing the spike data.
SpikeDetector::SpikeDetector | ( | ) |
constructor
SpikeDetector::~SpikeDetector | ( | ) |
destructor
|
virtual |
Processes an incoming continuous buffer and places new spikes into the event buffer.
Implements GenericProcessor.
|
virtual |
Used to alter parameters of data acquisition.
Reimplemented from GenericProcessor.
|
virtual |
Called whenever the signal chain is altered.
Reimplemented from GenericProcessor.
|
virtual |
Called prior to start of acquisition.
Reimplemented from GenericProcessor.
|
virtual |
Called after acquisition is finished.
Reimplemented from GenericProcessor.
|
virtual |
Creates the SpikeDetectorEditor.
Reimplemented from GenericProcessor.
bool SpikeDetector::addElectrode | ( | int | nChans | ) |
Adds an electrode with n channels to be processed.
bool SpikeDetector::removeElectrode | ( | int | index | ) |
Removes an electrode with a given index.
int SpikeDetector::getNumChannels | ( | int | index | ) |
Returns the number of channels for a given electrode.
bool SpikeDetector::setChannel | ( | int | electrodeIndex, |
int | channelNum, | ||
int | newChannel | ||
) |
Edits the mapping between input channels and electrode channels.
int SpikeDetector::getChannel | ( | int | index, |
int | chan | ||
) |
Returns the continuous channel that maps to a given electrode channel.
bool SpikeDetector::setElectrodeName | ( | int | index, |
String | newName | ||
) |
Sets the name of a given electrode.
StringArray SpikeDetector::getElectrodeNames | ( | ) |
Returns a StringArray containing the names of all electrodes.
void SpikeDetector::setChannelThreshold | ( | int | electrodeNum, |
int | channelNum, | ||
float | threshold | ||
) |
double SpikeDetector::getChannelThreshold | ( | int | electrodeNum, |
int | channelNum | ||
) |
AudioSampleBuffer SpikeDetector::overflowBuffer |
Extra samples are placed in this buffer to allow seamless transitions between callbacks.
AudioSampleBuffer& SpikeDetector::dataBuffer |
Reference to a continuous buffer (for internal use only).
StringArray SpikeDetector::electrodeTypes |
Returns a list of possible electrode types (e.g., stereotrode, tetrode).