Mercurial > hg > vamp-plugin-sdk
comparison vamp-hostsdk/PluginInputDomainAdapter.h @ 288:283e15f6e548
* The beginnings of making the shift-timestamp or shift-data behaviour
of PluginInputDomainAdapter into an option
author | cannam |
---|---|
date | Tue, 15 Sep 2009 16:24:53 +0000 |
parents | 4454843ff384 |
children | c97e70ed5abc |
comparison
equal
deleted
inserted
replaced
287:f3b1ba71a305 | 288:283e15f6e548 |
---|---|
89 */ | 89 */ |
90 PluginInputDomainAdapter(Plugin *plugin); | 90 PluginInputDomainAdapter(Plugin *plugin); |
91 virtual ~PluginInputDomainAdapter(); | 91 virtual ~PluginInputDomainAdapter(); |
92 | 92 |
93 bool initialise(size_t channels, size_t stepSize, size_t blockSize); | 93 bool initialise(size_t channels, size_t stepSize, size_t blockSize); |
94 void reset(); | |
94 | 95 |
95 InputDomain getInputDomain() const; | 96 InputDomain getInputDomain() const; |
96 | 97 |
97 size_t getPreferredStepSize() const; | 98 size_t getPreferredStepSize() const; |
98 size_t getPreferredBlockSize() const; | 99 size_t getPreferredBlockSize() const; |
99 | 100 |
100 FeatureSet process(const float *const *inputBuffers, RealTime timestamp); | 101 FeatureSet process(const float *const *inputBuffers, RealTime timestamp); |
102 | |
103 /** | |
104 * ProcessTimestampMethod determines how the | |
105 * PluginInputDomainAdapter handles timestamps for the data passed | |
106 * to the process() function of the plugin it wraps, in the case | |
107 * where the plugin is expecting frequency-domain data. | |
108 * | |
109 * | |
110 * The Vamp API mandates that the timestamp passed to the plugin | |
111 * for time-domain input should be the time of the first sample in | |
112 * the block, but the timestamp passed for frequency-domain input | |
113 * should be the timestamp of the centre of the block. | |
114 * | |
115 * Since we claim to permit the code that uses this plugin wrapper | |
116 * not to care whether the plugin itself has time or frequency | |
117 * domain input, that means that we need to ensure this timestamp | |
118 * is correctly adjusted ourselves, and the way we handle this is | |
119 * controlled by the ProcessTimestampMethod. | |
120 * | |
121 * If ProcessTimestampMethod is ShiftTimestamp (the default), then | |
122 * the data passed to the wrapped plugin will be calculated from | |
123 * the same input data block as passed to the wrapper, but the | |
124 * timestamp passed to the plugin will be advanced by half of the | |
125 * window size. | |
126 * | |
127 * If ProcessTimestampMethod is ShiftData, then the timestamp | |
128 * passed to the wrapped plugin will be the same as that passed to | |
129 * the process call of the wrapper, but the data block used to | |
130 * calculate the input will be shifted back (earlier) by half of | |
131 * the window size, with half a block of padding at the start of | |
132 * the first process call. | |
133 * | |
134 * This function must be called before the first call to | |
135 * process(). | |
136 */ | |
137 enum ProcessTimestampMethod { | |
138 ShiftTimestamp, | |
139 ShiftData | |
140 }; | |
141 | |
142 void setProcessTimestampMethod(ProcessTimestampMethod); | |
143 ProcessTimestampMethod getProcessTimestampMethod() const; | |
101 | 144 |
102 /** | 145 /** |
103 * Return the amount by which the timestamps supplied to process() | 146 * Return the amount by which the timestamps supplied to process() |
104 * are being incremented when they are passed to the plugin's own | 147 * are being incremented when they are passed to the plugin's own |
105 * process() implementation. | 148 * process() implementation. |
114 * circumstances (such as for establishing the correct timing of | 157 * circumstances (such as for establishing the correct timing of |
115 * implicitly-timed features, i.e. features without their own | 158 * implicitly-timed features, i.e. features without their own |
116 * timestamps) the host may need to be aware that this adjustment | 159 * timestamps) the host may need to be aware that this adjustment |
117 * is taking place. | 160 * is taking place. |
118 * | 161 * |
119 * If the plugin requires time-domain input, this function will | 162 * If the plugin requires time-domain input or the |
120 * return zero. The result of calling this function before | 163 * PluginInputDomainAdapter is configured with its |
121 * initialise() has been called is undefined. | 164 * ProcessTimestampMethod set to ShiftData instead of |
165 * ShiftTimestamp, then this function will return zero. | |
166 * | |
167 * The result of calling this function before initialise() has | |
168 * been called is undefined. | |
122 */ | 169 */ |
123 RealTime getTimestampAdjustment() const; | 170 RealTime getTimestampAdjustment() const; |
124 | 171 |
125 protected: | 172 protected: |
126 class Impl; | 173 class Impl; |