comparison vamp-sdk/hostext/PluginBufferingAdapter.h @ 92:c94c066a4897

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