MuteMaster should (a) use a Muteable's own ::muted_by_others_soloing() (b) not try...
[ardour.git] / libs / ardour / ardour / analysis_graph.h
1 /*
2  * Copyright (C) 2016 Robin Gareus <robin@gareus.org>
3  *
4  * This program is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU General Public License
6  * as published by the Free Software Foundation; either version 2
7  * of the License, or (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 General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
17  */
18
19 #ifndef __ardour_analysis_graph_h__
20 #define __ardour_analysis_graph_h__
21
22 #include <map>
23 #include <set>
24 #include <cstring>
25 #include <boost/shared_ptr.hpp>
26
27 #include "ardour/audioregion.h"
28 #include "ardour/audioplaylist.h"
29 #include "ardour/export_analysis.h"
30 #include "ardour/libardour_visibility.h"
31
32 namespace AudioGrapher {
33         class Analyser;
34         template <typename T> class Chunker;
35         template <typename T> class Interleaver;
36 }
37
38 namespace ARDOUR {
39 class LIBARDOUR_API AnalysisGraph {
40         public:
41                 AnalysisGraph (ARDOUR::Session*);
42                 ~AnalysisGraph ();
43
44                 void analyze_region (boost::shared_ptr<ARDOUR::AudioRegion>);
45                 void analyze_range (boost::shared_ptr<ARDOUR::Route>, boost::shared_ptr<ARDOUR::AudioPlaylist>, const std::list<AudioRange>&);
46                 const AnalysisResults& results () const { return _results; }
47
48                 void cancel () { _canceled = true; }
49                 bool canceled () const { return _canceled; }
50
51                 void set_total_frames (framecnt_t p) { _frames_end = p; }
52                 PBD::Signal2<void, framecnt_t, framecnt_t> Progress;
53
54         private:
55                 ARDOUR::Session* _session;
56                 AnalysisResults  _results;
57                 framecnt_t       _max_chunksize;
58
59                 ARDOUR::Sample*  _buf;
60                 ARDOUR::Sample*  _mixbuf;
61                 float*           _gainbuf;
62                 framecnt_t       _frames_read;
63                 framecnt_t       _frames_end;
64                 bool             _canceled;
65
66                 typedef boost::shared_ptr<AudioGrapher::Analyser> AnalysisPtr;
67                 typedef boost::shared_ptr<AudioGrapher::Chunker<float> > ChunkerPtr;
68                 typedef boost::shared_ptr<AudioGrapher::Interleaver<Sample> > InterleaverPtr;
69
70                 InterleaverPtr  interleaver;
71                 ChunkerPtr      chunker;
72                 AnalysisPtr     analyser;
73 };
74 } // namespace ARDOUR
75 #endif