Open Ephys GUI
 All Classes Functions Variables Pages
SpikeDisplayNode.h
1 /*
2  ------------------------------------------------------------------
3 
4  This file is part of the Open Ephys GUI
5  Copyright (C) 2012 Open Ephys
6 
7  ------------------------------------------------------------------
8 
9  This program is free software: you can redistribute it and/or modify
10  it under the terms of the GNU General Public License as published by
11  the Free Software Foundation, either version 3 of the License, or
12  (at your option) any later version.
13 
14  This program is distributed in the hope that it will be useful,
15  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  GNU General Public License for more details.
18 
19  You should have received a copy of the GNU General Public License
20  along with this program. If not, see <http://www.gnu.org/licenses/>.
21 
22 */
23 
24 #ifndef SPIKEDISPLAYNODE_H_
25 #define SPIKEDISPLAYNODE_H_
26 
27 #include "../../JuceLibraryCode/JuceHeader.h"
28 #include "Editors/SpikeDisplayEditor.h"
29 #include "Editors/VisualizerEditor.h"
30 #include "GenericProcessor.h"
31 #include "Visualization/SpikeObject.h"
32 
33 
34 /**
35 
36  Takes in MidiEvents and extracts SpikeObjects from the MidiEvent buffers.
37  Those Events are then held in a queue until they are pulled by the SpikeDisplayCanvas.
38 
39  @see GenericProcessor, SpikeDisplayEditor, SpikeDisplayCanvas
40 
41 */
42 
43 
44 #define SPIKE_CMD_CLEAR_ALL 10000
45 #define SPIKE_CMD_CLEAR_SEL 10001
46 #define SPIKE_CMD_PAN_AXES 10002
47 #define SPIKE_CMD_ZOOM_AXES 10003
48 
49 
50 class DataViewport;
51 
53 {
54 public:
55 
58 
59  AudioProcessorEditor* createEditor();
60 
61  bool isSink() {return true;}
62 
63  void process(AudioSampleBuffer &buffer, MidiBuffer &midiMessages, int& nSamples);
64 
65  void setParameter(int, float);
66 
67  void handleEvent(int, MidiMessage&);
68 
69  //void updateSettings();
70 
71  bool enable();
72  bool disable();
73 
74  MidiBuffer* getSpikeBufferAddress() {return eventBuffer;}
75 
76 
77  int getNumberOfChannelsForElectrode(int i);
78  int getNumElectrodes();
79 
80  bool getNextSpike(SpikeObject *spike);
81 
82 private:
83 
84  int numberOfSources;
85 
86  ScopedPointer<MidiBuffer> eventBuffer;
87 
88  //std::queue<SpikeObject> spikebuffer;
89 
90  int bufferSize;
91 
92  JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (SpikeDisplayNode);
93 
94 };
95 
96 
97 #endif // SPIKEDISPLAYNODE_H_