Debian Codegraph @

src/trackanalyser.h

raw symbols SCIP
1 /*
2 Copyright (C) 2011 Mario Stephan <[email protected]>
3
4 This library is free software; you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License as published
6 by the Free Software Foundation; either version 2.1 of the License, or
7 (at your option) any later version.
8
9 This program 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 Lesser General Public License
15 along with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17 #ifndef TRACKANALYSER_H
18 #define TRACKANALYSER_H
19
20 #include <QtCore>
21 #include <QWidget>
22
23 #define GST_DISABLE_LOADSAVE 1
24 #define GST_DISABLE_REGISTRY 1
25 #define GST_DISABLE_DEPRECATED 1
26 #include <gst/gst.h>
27
28 class TrackAnalyser : public QWidget
29 {
30 Q_OBJECT
31 public:
32 TrackAnalyser(QWidget *parent = 0);
33 ~TrackAnalyser();
34
35 enum modeType { STANDARD, TEMPO };
36
37 bool prepare();
38 void open(QUrl url);
39 void start();
40 bool close();
41
42 double gainDB();
43 double gainFactor();
44 QTime startPosition();
45 QTime endPosition();
46 int bpm();
47 bool finished() {return m_finished;}
48 void setMode(modeType mode);
49 void setPosition(QTime position);
50
51 QTime length();
52 static const int GAIN_INVALID=-99;
53
54 void need_finish();
55 void newpad (GstElement *decodebin, GstPad *pad, gpointer data);
56 static GstBusSyncReply bus_cb (GstBus *bus, GstMessage *msg, gpointer data);
57
58 Q_SIGNALS:
59 void finishGain();
60 void finishTempo();
61
62 private slots:
63 void messageReceived(GstMessage* message);
64 void loadThreadFinished();
65
66 private:
67 struct TrackAnalyser_Private *p;
68 GstElement *pipeline;
69 GstBus *bus;
70
71 double m_GainDB;
72 QTime m_StartPosition;
73 QTime m_EndPosition;
74 QTime m_MaxPosition;
75 bool m_finished;
76
77 void detectTempo();
78 float AutoCorrelation( QList<float> buffer, int frames, int minBpm, int maxBpm, int sampleRate);
79
80 void cleanup();
81 void asyncOpen(QUrl url);
82 void sync_set_state(GstElement*, GstState);
83 };
84
85 #endif // TRACKANALYSER_H