cannam@92
|
1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
|
cannam@92
|
2
|
cannam@92
|
3 /*
|
cannam@92
|
4 Vamp
|
cannam@92
|
5
|
cannam@92
|
6 An API for audio analysis and feature extraction plugins.
|
cannam@92
|
7
|
cannam@92
|
8 Centre for Digital Music, Queen Mary, University of London.
|
cannam@92
|
9 Copyright 2006-2007 Chris Cannam and QMUL.
|
cannam@92
|
10 This file by Mark Levy, Copyright 2007 QMUL.
|
cannam@92
|
11
|
cannam@92
|
12 Permission is hereby granted, free of charge, to any person
|
cannam@92
|
13 obtaining a copy of this software and associated documentation
|
cannam@92
|
14 files (the "Software"), to deal in the Software without
|
cannam@92
|
15 restriction, including without limitation the rights to use, copy,
|
cannam@92
|
16 modify, merge, publish, distribute, sublicense, and/or sell copies
|
cannam@92
|
17 of the Software, and to permit persons to whom the Software is
|
cannam@92
|
18 furnished to do so, subject to the following conditions:
|
cannam@92
|
19
|
cannam@92
|
20 The above copyright notice and this permission notice shall be
|
cannam@92
|
21 included in all copies or substantial portions of the Software.
|
cannam@92
|
22
|
cannam@92
|
23 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
cannam@92
|
24 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
cannam@92
|
25 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
cannam@92
|
26 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR
|
cannam@92
|
27 ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
|
cannam@92
|
28 CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
cannam@92
|
29 WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
cannam@92
|
30
|
cannam@92
|
31 Except as contained in this notice, the names of the Centre for
|
cannam@92
|
32 Digital Music; Queen Mary, University of London; and Chris Cannam
|
cannam@92
|
33 shall not be used in advertising or otherwise to promote the sale,
|
cannam@92
|
34 use or other dealings in this Software without prior written
|
cannam@92
|
35 authorization.
|
cannam@92
|
36 */
|
cannam@92
|
37
|
cannam@92
|
38 #ifndef _VAMP_PLUGIN_BUFFERING_ADAPTER_H_
|
cannam@92
|
39 #define _VAMP_PLUGIN_BUFFERING_ADAPTER_H_
|
cannam@92
|
40
|
cannam@92
|
41 #include "PluginWrapper.h"
|
cannam@92
|
42
|
cannam@92
|
43 namespace Vamp {
|
cannam@92
|
44
|
cannam@92
|
45 namespace HostExt {
|
cannam@92
|
46
|
cannam@92
|
47 /**
|
cannam@92
|
48 * \class PluginBufferingAdapter PluginBufferingAdapter.h <vamp-sdk/hostext/PluginBufferingAdapter.h>
|
cannam@92
|
49 *
|
cannam@92
|
50 * PluginBufferingAdapter is a Vamp plugin adapter that allows plugins
|
cannam@92
|
51 * to be used by a host supplying an audio stream in non-overlapping
|
cannam@92
|
52 * buffers of arbitrary size.
|
cannam@92
|
53 *
|
cannam@92
|
54 * A host using PluginBufferingAdapter may ignore the preferred step
|
cannam@92
|
55 * and block size reported by the plugin, and still expect the plugin
|
cannam@92
|
56 * to run. The value of blockSize and stepSize passed to initialise
|
cannam@92
|
57 * should be the size of the buffer which the host will supply; the
|
cannam@92
|
58 * stepSize should be equal to the blockSize.
|
cannam@92
|
59 *
|
cannam@92
|
60 * If the internal step size used for the plugin differs from that
|
cannam@92
|
61 * supplied by the host, the adapter will modify the sample rate
|
cannam@92
|
62 * specifications for the plugin outputs (setting them all to
|
cannam@92
|
63 * VariableSampleRate) and set timestamps on the output features for
|
cannam@92
|
64 * outputs that formerly used a different sample rate specification.
|
cannam@92
|
65 * This is necessary in order to obtain correct time stamping.
|
cannam@92
|
66 *
|
cannam@92
|
67 * In other respects, the PluginBufferingAdapter behaves identically
|
cannam@92
|
68 * to the plugin that it wraps. The wrapped plugin will be deleted
|
cannam@92
|
69 * when the wrapper is deleted.
|
cannam@92
|
70 */
|
cannam@92
|
71
|
cannam@92
|
72 class PluginBufferingAdapter : public PluginWrapper
|
cannam@92
|
73 {
|
cannam@92
|
74 public:
|
cannam@92
|
75 PluginBufferingAdapter(Plugin *plugin); // I take ownership of plugin
|
cannam@92
|
76 virtual ~PluginBufferingAdapter();
|
cannam@92
|
77
|
cannam@92
|
78 bool initialise(size_t channels, size_t stepSize, size_t blockSize);
|
cannam@92
|
79
|
cannam@92
|
80 size_t getPreferredStepSize() const;
|
cannam@92
|
81
|
cannam@92
|
82 OutputList getOutputDescriptors() const;
|
cannam@92
|
83
|
cannam@104
|
84 void reset();
|
cannam@104
|
85
|
cannam@92
|
86 FeatureSet process(const float *const *inputBuffers, RealTime timestamp);
|
cannam@92
|
87
|
cannam@92
|
88 FeatureSet getRemainingFeatures();
|
cannam@92
|
89
|
cannam@92
|
90 protected:
|
cannam@92
|
91 class Impl;
|
cannam@92
|
92 Impl *m_impl;
|
cannam@92
|
93 };
|
cannam@92
|
94
|
cannam@92
|
95 }
|
cannam@92
|
96
|
cannam@92
|
97 }
|
cannam@92
|
98
|
cannam@92
|
99 #endif
|