Ardour  9.0-pre0-582-g084a23a80d
analysis_graph.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2016 John Emmas <john@creativepost.co.uk>
3  * Copyright (C) 2016 Robin Gareus <robin@gareus.org>
4  * Copyright (C) 2017 Paul Davis <paul@linuxaudiosystems.com>
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License along
17  * with this program; if not, write to the Free Software Foundation, Inc.,
18  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19  */
20 
21 #pragma once
22 
23 #include <map>
24 #include <memory>
25 #include <set>
26 #include <cstring>
27 
28 #include "ardour/audioregion.h"
29 #include "ardour/audioplaylist.h"
30 #include "ardour/export_analysis.h"
32 
33 namespace AudioGrapher {
34  class Analyser;
35  template <typename T> class Chunker;
36  template <typename T> class Interleaver;
37 }
38 
39 namespace PBD {
40  class Progress;
41 }
42 
43 namespace ARDOUR {
44 
46  public:
49 
50  void analyze_region (ARDOUR::AudioRegion const*, bool raw = false, PBD::Progress* = 0);
51  void analyze_region (std::shared_ptr<ARDOUR::AudioRegion>, bool raw = false);
52 
53  void analyze_range (std::shared_ptr<ARDOUR::Route>, std::shared_ptr<ARDOUR::AudioPlaylist>, const std::list<TimelineRange>&);
54 
55  const AnalysisResults& results () const { return _results; }
56 
57  void cancel () { _canceled = true; }
58  bool canceled () const { return _canceled; }
59 
60  void set_total_samples (samplecnt_t p) { _samples_end = p; }
62 
63  private:
67 
70  float* _gainbuf;
73  bool _canceled;
74 
75  typedef std::shared_ptr<AudioGrapher::Analyser> AnalysisPtr;
76  typedef std::shared_ptr<AudioGrapher::Chunker<float> > ChunkerPtr;
77  typedef std::shared_ptr<AudioGrapher::Interleaver<Sample> > InterleaverPtr;
78 
82 };
83 } // namespace ARDOUR
samplecnt_t _max_chunksize
std::shared_ptr< AudioGrapher::Analyser > AnalysisPtr
samplecnt_t _samples_read
std::shared_ptr< AudioGrapher::Chunker< float > > ChunkerPtr
void set_total_samples(samplecnt_t p)
AnalysisResults _results
samplecnt_t _samples_end
InterleaverPtr interleaver
void analyze_region(std::shared_ptr< ARDOUR::AudioRegion >, bool raw=false)
void analyze_region(ARDOUR::AudioRegion const *, bool raw=false, PBD::Progress *=0)
ARDOUR::Session * _session
AnalysisGraph(ARDOUR::Session *)
const AnalysisResults & results() const
ARDOUR::Sample * _buf
void analyze_range(std::shared_ptr< ARDOUR::Route >, std::shared_ptr< ARDOUR::AudioPlaylist >, const std::list< TimelineRange > &)
std::shared_ptr< AudioGrapher::Interleaver< Sample > > InterleaverPtr
PBD::Signal< void(samplecnt_t, samplecnt_t)> Progress
ARDOUR::Sample * _mixbuf
A class that chunks process cycles into equal sized samples.
Definition: chunker.h:19
Interleaves many streams of non-interleaved data into one interleaved stream.
Definition: interleaver.h:22
#define LIBARDOUR_API
std::map< std::string, ExportAnalysisPtr > AnalysisResults
Temporal::samplecnt_t samplecnt_t
Definition: axis_view.h:42