Mercurial > hg > sv-dependency-builds
comparison win32-mingw/include/vamp-hostsdk/PluginChannelAdapter.h @ 99:c6e1ae789cfb
Add Vamp builds
author | Chris Cannam <cannam@all-day-breakfast.com> |
---|---|
date | Wed, 20 Mar 2013 16:05:58 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
98:4188fd8db918 | 99:c6e1ae789cfb |
---|---|
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-2009 Chris Cannam and QMUL. | |
10 | |
11 Permission is hereby granted, free of charge, to any person | |
12 obtaining a copy of this software and associated documentation | |
13 files (the "Software"), to deal in the Software without | |
14 restriction, including without limitation the rights to use, copy, | |
15 modify, merge, publish, distribute, sublicense, and/or sell copies | |
16 of the Software, and to permit persons to whom the Software is | |
17 furnished to do so, subject to the following conditions: | |
18 | |
19 The above copyright notice and this permission notice shall be | |
20 included in all copies or substantial portions of the Software. | |
21 | |
22 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | |
23 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | |
24 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | |
25 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR | |
26 ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF | |
27 CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | |
28 WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | |
29 | |
30 Except as contained in this notice, the names of the Centre for | |
31 Digital Music; Queen Mary, University of London; and Chris Cannam | |
32 shall not be used in advertising or otherwise to promote the sale, | |
33 use or other dealings in this Software without prior written | |
34 authorization. | |
35 */ | |
36 | |
37 #ifndef _VAMP_PLUGIN_CHANNEL_ADAPTER_H_ | |
38 #define _VAMP_PLUGIN_CHANNEL_ADAPTER_H_ | |
39 | |
40 #include "hostguard.h" | |
41 #include "PluginWrapper.h" | |
42 | |
43 _VAMP_SDK_HOSTSPACE_BEGIN(PluginChannelAdapter.h) | |
44 | |
45 namespace Vamp { | |
46 | |
47 namespace HostExt { | |
48 | |
49 /** | |
50 * \class PluginChannelAdapter PluginChannelAdapter.h <vamp-hostsdk/PluginChannelAdapter.h> | |
51 * | |
52 * PluginChannelAdapter is a Vamp plugin adapter that implements a | |
53 * policy for management of plugins that expect a different number of | |
54 * input channels from the number actually available in the source | |
55 * audio data. | |
56 * | |
57 * A host using PluginChannelAdapter may ignore the getMinChannelCount | |
58 * and getMaxChannelCount reported by the plugin, and still expect the | |
59 * plugin to run. | |
60 * | |
61 * PluginChannelAdapter implements the following policy: | |
62 * | |
63 * - If the plugin supports the provided number of channels directly, | |
64 * PluginChannelAdapter will just run the plugin as normal. | |
65 * | |
66 * - If the plugin only supports exactly one channel but more than | |
67 * one channel is provided, PluginChannelAdapter will use the mean of | |
68 * the channels. This ensures that the resulting values remain | |
69 * within the same magnitude range as expected for mono data. | |
70 * | |
71 * - If the plugin requires more than one channel but exactly one is | |
72 * provided, the provided channel will be duplicated across all the | |
73 * plugin input channels. | |
74 * | |
75 * If none of the above apply: | |
76 * | |
77 * - If the plugin requires more channels than are provided, the | |
78 * minimum acceptable number of channels will be produced by adding | |
79 * empty (zero valued) channels to those provided. | |
80 * | |
81 * - If the plugin requires fewer channels than are provided, the | |
82 * maximum acceptable number of channels will be produced by | |
83 * discarding the excess channels. | |
84 * | |
85 * Hosts requiring a different channel policy from the above will need | |
86 * to implement it themselves, instead of using PluginChannelAdapter. | |
87 * | |
88 * Note that PluginChannelAdapter does not override the minimum and | |
89 * maximum channel counts returned by the wrapped plugin. The host | |
90 * will need to be aware that it is using a PluginChannelAdapter, and | |
91 * be prepared to ignore these counts as necessary. (This contrasts | |
92 * with the approach used in PluginInputDomainAdapter, which aims to | |
93 * make the host completely unaware of which underlying input domain | |
94 * is in fact in use.) | |
95 * | |
96 * (The rationale for this is that a host may wish to use the | |
97 * PluginChannelAdapter but still discriminate in some way on the | |
98 * basis of the number of channels actually supported. For example, a | |
99 * simple stereo audio host may prefer to reject plugins that require | |
100 * more than two channels on the grounds that doesn't actually | |
101 * understand what they are for, rather than allow the channel adapter | |
102 * to make a potentially meaningless channel conversion for them.) | |
103 * | |
104 * In every respect other than its management of channels, the | |
105 * PluginChannelAdapter behaves identically to the plugin that it | |
106 * wraps. The wrapped plugin will be deleted when the wrapper is | |
107 * deleted. | |
108 * | |
109 * \note This class was introduced in version 1.1 of the Vamp plugin SDK. | |
110 */ | |
111 | |
112 class PluginChannelAdapter : public PluginWrapper | |
113 { | |
114 public: | |
115 /** | |
116 * Construct a PluginChannelAdapter wrapping the given plugin. | |
117 * The adapter takes ownership of the plugin, which will be | |
118 * deleted when the adapter is deleted. | |
119 */ | |
120 PluginChannelAdapter(Plugin *plugin); | |
121 virtual ~PluginChannelAdapter(); | |
122 | |
123 bool initialise(size_t channels, size_t stepSize, size_t blockSize); | |
124 | |
125 FeatureSet process(const float *const *inputBuffers, RealTime timestamp); | |
126 | |
127 /** | |
128 * Call process(), providing interleaved audio data with the | |
129 * number of channels passed to initialise(). The adapter will | |
130 * de-interleave into temporary buffers as appropriate before | |
131 * calling process(). | |
132 * | |
133 * \note This function was introduced in version 1.4 of the Vamp | |
134 * plugin SDK. | |
135 */ | |
136 FeatureSet processInterleaved(const float *inputBuffer, RealTime timestamp); | |
137 | |
138 protected: | |
139 class Impl; | |
140 Impl *m_impl; | |
141 }; | |
142 | |
143 } | |
144 | |
145 } | |
146 | |
147 _VAMP_SDK_HOSTSPACE_END(PluginChannelAdapter.h) | |
148 | |
149 #endif |