Open Ephys GUI
 All Classes Functions Variables Pages
LfpDisplayCanvas.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 #ifndef __LFPDISPLAYCANVAS_H_B711873A__
24 #define __LFPDISPLAYCANVAS_H_B711873A__
25 
26 #include "../../../JuceLibraryCode/JuceHeader.h"
27 #include "../LfpDisplayNode.h"
28 #include "Visualizer.h"
29 
30 class LfpDisplayNode;
31 
33 
34 {
35 public:
38  void newOpenGLContextCreated();
39  void renderOpenGL();
40 
41  void beginAnimation();
42  void endAnimation();
43 
44  void refreshState();
45 
46  void update();
47 
48  void setParameter(int, float);
49  void setParameter(int, int, int, float){}
50 
51 
52 private:
53 
54  int xBuffer, yBuffer;
55 
56  float sampleRate;
57  float timebase;
58  float displayGain;
59 
60  LfpDisplayNode* processor;
61  AudioSampleBuffer* displayBuffer;
62  ScopedPointer<AudioSampleBuffer> screenBuffer;
63  MidiBuffer* eventBuffer;
64 
65  void setViewport(int chan);
66  void drawBorder(bool isSelected);
67  void drawChannelInfo(int chan, bool isSelected);
68  void drawWaveform(int chan, bool isSelected);
69 
70  void drawTicks();
71 
72  bool checkBounds(int chan);
73 
74  void updateScreenBuffer();
75  int screenBufferIndex;
76  int displayBufferIndex;
77  int displayBufferSize;
78 
79  int nChans, plotHeight, totalHeight;
80  int selectedChan;
81 
82  int getTotalHeight();
83 
84  void canvasWasResized();
85  void mouseDownInCanvas(const MouseEvent& e);
86  // void mouseDrag(const MouseEvent& e);
87  // void mouseMove(const MouseEvent& e);
88  // void mouseUp(const MouseEvent& e);
89  // void mouseWheelMove(const MouseEvent&, float, float);
90 
91  JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (LfpDisplayCanvas);
92 
93 };
94 
95 
96 
97 #endif // __LFPDISPLAYCANVAS_H_B711873A__