annotate src/vamp-plugin-sdk-2.5/vamp-hostsdk/PluginBufferingAdapter.h @ 169:223a55898ab9 tip default

Add null config files
author Chris Cannam <cannam@all-day-breakfast.com>
date Mon, 02 Mar 2020 14:03:47 +0000
parents 1813f30f2f15
children
rev   line source
cannam@108 1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
cannam@108 2
cannam@108 3 /*
cannam@108 4 Vamp
cannam@108 5
cannam@108 6 An API for audio analysis and feature extraction plugins.
cannam@108 7
cannam@108 8 Centre for Digital Music, Queen Mary, University of London.
cannam@108 9 Copyright 2006-2009 Chris Cannam and QMUL.
cannam@108 10 This file by Mark Levy and Chris Cannam, Copyright 2007-2008 QMUL.
cannam@108 11
cannam@108 12 Permission is hereby granted, free of charge, to any person
cannam@108 13 obtaining a copy of this software and associated documentation
cannam@108 14 files (the "Software"), to deal in the Software without
cannam@108 15 restriction, including without limitation the rights to use, copy,
cannam@108 16 modify, merge, publish, distribute, sublicense, and/or sell copies
cannam@108 17 of the Software, and to permit persons to whom the Software is
cannam@108 18 furnished to do so, subject to the following conditions:
cannam@108 19
cannam@108 20 The above copyright notice and this permission notice shall be
cannam@108 21 included in all copies or substantial portions of the Software.
cannam@108 22
cannam@108 23 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
cannam@108 24 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
cannam@108 25 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
cannam@108 26 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR
cannam@108 27 ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
cannam@108 28 CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
cannam@108 29 WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
cannam@108 30
cannam@108 31 Except as contained in this notice, the names of the Centre for
cannam@108 32 Digital Music; Queen Mary, University of London; and Chris Cannam
cannam@108 33 shall not be used in advertising or otherwise to promote the sale,
cannam@108 34 use or other dealings in this Software without prior written
cannam@108 35 authorization.
cannam@108 36 */
cannam@108 37
cannam@108 38 #ifndef _VAMP_PLUGIN_BUFFERING_ADAPTER_H_
cannam@108 39 #define _VAMP_PLUGIN_BUFFERING_ADAPTER_H_
cannam@108 40
cannam@108 41 #include "hostguard.h"
cannam@108 42 #include "PluginWrapper.h"
cannam@108 43
cannam@108 44 _VAMP_SDK_HOSTSPACE_BEGIN(PluginBufferingAdapter.h)
cannam@108 45
cannam@108 46 namespace Vamp {
cannam@108 47
cannam@108 48 namespace HostExt {
cannam@108 49
cannam@108 50 /**
cannam@108 51 * \class PluginBufferingAdapter PluginBufferingAdapter.h <vamp-hostsdk/PluginBufferingAdapter.h>
cannam@108 52 *
cannam@108 53 * PluginBufferingAdapter is a Vamp plugin adapter that allows plugins
cannam@108 54 * to be used by a host supplying an audio stream in non-overlapping
cannam@108 55 * buffers of arbitrary size.
cannam@108 56 *
cannam@108 57 * A host using PluginBufferingAdapter may ignore the preferred step
cannam@108 58 * and block size reported by the plugin, and still expect the plugin
cannam@108 59 * to run. The value of blockSize and stepSize passed to initialise
cannam@108 60 * should be the size of the buffer which the host will supply; the
cannam@108 61 * stepSize should be equal to the blockSize.
cannam@108 62 *
cannam@108 63 * If the internal step size used for the plugin differs from that
cannam@108 64 * supplied by the host, the adapter will modify the sample type and
cannam@108 65 * rate specifications for the plugin outputs appropriately, and set
cannam@108 66 * timestamps on the output features for outputs that formerly used a
cannam@108 67 * different sample rate specification. This is necessary in order to
cannam@108 68 * obtain correct time stamping.
cannam@108 69 *
cannam@108 70 * In other respects, the PluginBufferingAdapter behaves identically
cannam@108 71 * to the plugin that it wraps. The wrapped plugin will be deleted
cannam@108 72 * when the wrapper is deleted.
cannam@108 73 */
cannam@108 74
cannam@108 75 class PluginBufferingAdapter : public PluginWrapper
cannam@108 76 {
cannam@108 77 public:
cannam@108 78 /**
cannam@108 79 * Construct a PluginBufferingAdapter wrapping the given plugin.
cannam@108 80 * The adapter takes ownership of the plugin, which will be
cannam@108 81 * deleted when the adapter is deleted.
cannam@108 82 */
cannam@108 83 PluginBufferingAdapter(Plugin *plugin);
cannam@108 84 virtual ~PluginBufferingAdapter();
cannam@108 85
cannam@108 86 /**
cannam@108 87 * Return the preferred step size for this adapter.
cannam@108 88 *
cannam@108 89 * Because of the way this adapter works, its preferred step size
cannam@108 90 * will always be the same as its preferred block size. This may
cannam@108 91 * or may not be the same as the preferred step size of the
cannam@108 92 * underlying plugin, which may be obtained by calling
cannam@108 93 * getPluginPreferredStepSize().
cannam@108 94 */
cannam@108 95 size_t getPreferredStepSize() const;
cannam@108 96
cannam@108 97 /**
cannam@108 98 * Return the preferred block size for this adapter.
cannam@108 99 *
cannam@108 100 * This may or may not be the same as the preferred block size of
cannam@108 101 * the underlying plugin, which may be obtained by calling
cannam@108 102 * getPluginPreferredBlockSize().
cannam@108 103 *
cannam@108 104 * Note that this adapter may be initialised with any block size,
cannam@108 105 * not just its supposedly preferred one.
cannam@108 106 */
cannam@108 107 size_t getPreferredBlockSize() const;
cannam@108 108
cannam@108 109 /**
cannam@108 110 * Initialise the adapter (and therefore the plugin) for the given
cannam@108 111 * number of channels. Initialise the adapter for the given step
cannam@108 112 * and block size, which must be equal.
cannam@108 113 *
cannam@108 114 * The step and block size used for the underlying plugin will
cannam@108 115 * depend on its preferences, or any values previously passed to
cannam@108 116 * setPluginStepSize and setPluginBlockSize.
cannam@108 117 */
cannam@108 118 bool initialise(size_t channels, size_t stepSize, size_t blockSize);
cannam@108 119
cannam@108 120 /**
cannam@108 121 * Return the preferred step size of the plugin wrapped by this
cannam@108 122 * adapter.
cannam@108 123 *
cannam@108 124 * This is included mainly for informational purposes. This value
cannam@108 125 * is not likely to be a valid step size for the adapter itself,
cannam@108 126 * and it is not usually of any use in interpreting the results
cannam@108 127 * (because the adapter re-writes OneSamplePerStep outputs to
cannam@108 128 * FixedSampleRate so that the hop size no longer needs to be
cannam@108 129 * known beforehand in order to interpret them).
cannam@108 130 */
cannam@108 131 size_t getPluginPreferredStepSize() const;
cannam@108 132
cannam@108 133 /**
cannam@108 134 * Return the preferred block size of the plugin wrapped by this
cannam@108 135 * adapter.
cannam@108 136 *
cannam@108 137 * This is included mainly for informational purposes.
cannam@108 138 */
cannam@108 139 size_t getPluginPreferredBlockSize() const;
cannam@108 140
cannam@108 141 /**
cannam@108 142 * Set the step size that will be used for the underlying plugin
cannam@108 143 * when initialise() is called. If this is not set, the plugin's
cannam@108 144 * own preferred step size will be used. You will not usually
cannam@108 145 * need to call this function. If you do call it, it must be
cannam@108 146 * before the first call to initialise().
cannam@108 147 */
cannam@108 148 void setPluginStepSize(size_t stepSize);
cannam@108 149
cannam@108 150 /**
cannam@108 151 * Set the block size that will be used for the underlying plugin
cannam@108 152 * when initialise() is called. If this is not set, the plugin's
cannam@108 153 * own preferred block size will be used. You will not usually
cannam@108 154 * need to call this function. If you do call it, it must be
cannam@108 155 * before the first call to initialise().
cannam@108 156 */
cannam@108 157 void setPluginBlockSize(size_t blockSize);
cannam@108 158
cannam@108 159 /**
cannam@108 160 * Return the step and block sizes that were actually used when
cannam@108 161 * initialising the underlying plugin.
cannam@108 162 *
cannam@108 163 * This is included mainly for informational purposes. You will
cannam@108 164 * not usually need to call this function. If this is called
cannam@108 165 * before initialise(), it will return 0 for both values. If it
cannam@108 166 * is called after a failed call to initialise(), it will return
cannam@108 167 * the values that were used in the failed call to the plugin's
cannam@108 168 * initialise() function.
cannam@108 169 */
cannam@108 170 void getActualStepAndBlockSizes(size_t &stepSize, size_t &blockSize);
cannam@108 171
cannam@108 172 void setParameter(std::string, float);
cannam@108 173 void selectProgram(std::string);
cannam@108 174
cannam@108 175 OutputList getOutputDescriptors() const;
cannam@108 176
cannam@108 177 void reset();
cannam@108 178
cannam@108 179 FeatureSet process(const float *const *inputBuffers, RealTime timestamp);
cannam@108 180
cannam@108 181 FeatureSet getRemainingFeatures();
cannam@108 182
cannam@108 183 protected:
cannam@108 184 class Impl;
cannam@108 185 Impl *m_impl;
cannam@108 186 };
cannam@108 187
cannam@108 188 }
cannam@108 189
cannam@108 190 }
cannam@108 191
cannam@108 192 _VAMP_SDK_HOSTSPACE_END(PluginBufferingAdapter.h)
cannam@108 193
cannam@108 194 #endif