Ardour  9.0-pre0-582-g084a23a80d
audioanalyser.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2008-2010 David Robillard <d@drobilla.net>
3  * Copyright (C) 2008-2017 Paul Davis <paul@linuxaudiosystems.com>
4  * Copyright (C) 2015-2016 Robin Gareus <robin@gareus.org>
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 <vector>
24 #include <string>
25 #include <vamp-hostsdk/Plugin.h>
27 #include "ardour/types.h"
28 
29 namespace ARDOUR {
30 
31 class AudioReadable;
32 class Session;
33 
35 
36  public:
37  typedef Vamp::Plugin AnalysisPlugin;
38  typedef std::string AnalysisPluginKey;
39 
40  AudioAnalyser (float sample_rate, AnalysisPluginKey key);
41  AudioAnalyser (const AudioAnalyser&) = delete;
42  AudioAnalyser& operator= (const AudioAnalyser&) = delete;
43  virtual ~AudioAnalyser();
44 
45  /* analysis object should provide a run method
46  that accepts a path to write the results to (optionally empty)
47  a AudioReadable* to read data from
48  and a reference to a type-specific container to return the
49  results.
50  */
51 
52  void reset ();
53 
54  protected:
55  float sample_rate;
58 
61 
62  int initialize_plugin (AnalysisPluginKey name, float sample_rate);
63  int analyse (const std::string& path, AudioReadable*, uint32_t channel);
64 
65  /* instances of an analysis object will have this method called
66  whenever there are results to process. if out is non-null,
67  the data should be written to the stream it points to.
68  */
69 
70  virtual int use_features (Vamp::Plugin::FeatureSet&, std::ostream*) = 0;
71 };
72 
73 } /* namespace */
74 
AnalysisPluginKey plugin_key
Definition: audioanalyser.h:57
int initialize_plugin(AnalysisPluginKey name, float sample_rate)
std::string AnalysisPluginKey
Definition: audioanalyser.h:38
AnalysisPlugin * plugin
Definition: audioanalyser.h:56
AudioAnalyser(float sample_rate, AnalysisPluginKey key)
int analyse(const std::string &path, AudioReadable *, uint32_t channel)
AudioAnalyser(const AudioAnalyser &)=delete
virtual int use_features(Vamp::Plugin::FeatureSet &, std::ostream *)=0
Vamp::Plugin AnalysisPlugin
Definition: audioanalyser.h:37
GtkImageIconNameData name
Definition: gtkimage.h:6
#define LIBARDOUR_API
Temporal::samplecnt_t samplecnt_t