Open Ephys GUI
 All Classes Functions Variables Pages
FileReaderThread.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 __FILEREADERTHREAD_H_82594504__
25 #define __FILEREADERTHREAD_H_82594504__
26 
27 
28 #include "../../../JuceLibraryCode/JuceHeader.h"
29 
30 #include <stdio.h>
31 #include <time.h>
32 #include "DataThread.h"
33 
34 /**
35 
36  --UNDER CONSTRUCTION--
37 
38  Similar to FileReader, but works within its own thread.
39 
40  @see DataThread, FileReader
41 
42 */
43 
44 
45 class SourceNode;
46 
48 
49 {
50 public:
53 
54  bool foundInputSource();// {return true;}
55  bool startAcquisition();
56  bool stopAcquisition();
57  int getNumChannels();// {return 16;}
58  float getSampleRate();// {return 40000.0;}
59  float getBitVolts();
60 
61 private:
62 
63  int samplesPerBlock;
64 
65  int lengthOfInputFile;
66 
67  int playHead;
68 
69  FILE* input;
70 
71  //FileInputStream* input;
72 
73  float thisSample[16];
74  int16 readBuffer[1600];
75 
76  int bufferSize;
77 
78  bool updateBuffer();
79 
80  JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (FileReaderThread);
81 };
82 
83 
84 
85 #endif // __FILEREADERTHREAD_H_82594504__