Copiste  0.1
 All Classes Functions Variables Enumerations Friends Pages
spectrumrecorder.h
1 /*
2  * This file is part of Copiste.
3  *
4  * Copiste is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation, either version 3 of the License, or
7  * (at your option) any later version.
8  *
9  * Copiste is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with Copiste. If not, see <http://www.gnu.org/licenses/>.
16  */
17 
18 
19 #ifndef INCLUDED_SPECTRUMRECORDERH
20 #define INCLUDED_SPECTRUMRECORDERH
21 
22 #include <QImage>
23 #include <boost/thread.hpp>
24 
25 #include "core/streamplayer.h"
26 #include "features/spectrum.h"
27 
34 {
35  public:
37  SpectrumRecorder(int windowSize = 1024, int sampleFrequency = -1, int maxHeight = 1024, int scale = 1);
38 
41 
43  void setup(int windowSize = 1024, int sampleFrequency = -1, int maxHeight = 1024, int scale = 1);
44 
46  bool compute(string file);
47 
49  void useBuffer();
50  void sequenceEnds();
51 
53  void writeToFile(string file);
54 
55  private:
56  QImage mOut;
57  SpectrumExtr mExtr;
58 
59  int mWindowSize;
60  int mSampleFrequency;
61  int mMaxHeight;
62  int mScale;
63 
64  //boost::mutex mSwitchLock;
65  int mCurrentRow;
66  bool mComputed;
67 };
68 
69 #endif