Open Ephys GUI
 All Classes Functions Variables Pages
LfpDisplayNode.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 __LFPDISPLAYNODE_H_D969A379__
25 #define __LFPDISPLAYNODE_H_D969A379__
26 
27 #include "../../JuceLibraryCode/JuceHeader.h"
28 #include "Editors/LfpDisplayEditor.h"
29 #include "Editors/VisualizerEditor.h"
30 #include "GenericProcessor.h"
31 
32 /**
33 
34  Holds data in a displayBuffer to be used by the LfpDisplayCanvas
35  for rendering continuous data streams.
36 
37  @see GenericProcessor, LfpDisplayEditor, LfpDisplayCanvas
38 
39 */
40 
41 
42 class DataViewport;
43 
45 
46 {
47 public:
48 
50  ~LfpDisplayNode();
51 
52  AudioProcessorEditor* createEditor();
53 
54  bool isSink() {return true;}
55 
56  void process(AudioSampleBuffer &buffer, MidiBuffer &midiMessages, int& nSamples);
57 
58  void setParameter(int, float);
59 
60  void updateSettings();
61 
62  bool enable();
63  bool disable();
64 
65  AudioSampleBuffer* getDisplayBufferAddress() {return displayBuffer;}
66  int getDisplayBufferIndex() {return displayBufferIndex;}
67 
68 private:
69 
70  ScopedPointer<AudioSampleBuffer> displayBuffer;
71  ScopedPointer<MidiBuffer> eventBuffer;
72 
73  int displayBufferIndex;
74 
75  float displayGain; //
76  float bufferLength; // s
77 
78  AbstractFifo abstractFifo;
79 
80  bool resizeBuffer();
81 
82  JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (LfpDisplayNode);
83 
84 };
85 
86 
87 
88 
89 #endif // __LFPDISPLAYNODE_H_D969A379__