comparison vamp-hostsdk/PluginInputDomainAdapter.h @ 298:5940dd0a399f

* Add NoShift option to PluginInputDomainAdapter as well, for completeness * Minor & doc updates
author cannam
date Tue, 22 Sep 2009 13:01:56 +0000
parents c97e70ed5abc
children 5cb298435765
comparison
equal deleted inserted replaced
297:f3db7ba66fea 298:5940dd0a399f
104 * ProcessTimestampMethod determines how the 104 * ProcessTimestampMethod determines how the
105 * PluginInputDomainAdapter handles timestamps for the data passed 105 * PluginInputDomainAdapter handles timestamps for the data passed
106 * to the process() function of the plugin it wraps, in the case 106 * to the process() function of the plugin it wraps, in the case
107 * where the plugin is expecting frequency-domain data. 107 * where the plugin is expecting frequency-domain data.
108 * 108 *
109 * The Vamp specification requires that the timestamp passed to
110 * the plugin for frequency-domain input should be that of the
111 * centre of the processing block, rather than the start as is the
112 * case for time-domain input.
109 * 113 *
110 * The Vamp API mandates that the timestamp passed to the plugin 114 * Since PluginInputDomainAdapter aims to be transparent in use,
111 * for time-domain input should be the time of the first sample in 115 * it needs to handle this timestamp adjustment itself. However,
112 * the block, but the timestamp passed for frequency-domain input 116 * some control is available over the method used for adjustment,
113 * should be the timestamp of the centre of the block. 117 * by means of the ProcessTimestampMethod setting.
114 * 118 *
115 * Since we claim to permit the code that uses this plugin wrapper 119 * If ProcessTimestampMethod is set to ShiftTimestamp (the
116 * not to care whether the plugin itself has time or frequency 120 * default), then the data passed to the wrapped plugin will be
117 * domain input, that means that we need to ensure this timestamp 121 * calculated from the same input data block as passed to the
118 * is correctly adjusted ourselves, and the way we handle this is 122 * wrapper, but the timestamp passed to the plugin will be
119 * controlled by the ProcessTimestampMethod. 123 * advanced by half of the window size.
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 * 124 *
127 * If ProcessTimestampMethod is ShiftData, then the timestamp 125 * If ProcessTimestampMethod is set to ShiftData, then the
128 * passed to the wrapped plugin will be the same as that passed to 126 * timestamp passed to the wrapped plugin will be the same as that
129 * the process call of the wrapper, but the data block used to 127 * passed to the process call of the wrapper, but the data block
130 * calculate the input will be shifted back (earlier) by half of 128 * used to calculate the input will be shifted back (earlier) by
131 * the window size, with half a block of padding at the start of 129 * half of the window size, with half a block of zero padding at
132 * the first process call. 130 * the start of the first process call. This has the advantage of
131 * preserving the first half block of audio without any
132 * deterioration from window shaping.
133 *
134 * If ProcessTimestampMethod is set to NoShift, then no adjustment
135 * will be made and the timestamps will be incorrect.
136 */
137 enum ProcessTimestampMethod {
138 ShiftTimestamp,
139 ShiftData,
140 NoShift
141 };
142
143 /**
144 * Set the method used for timestamp adjustment in plugins taking
145 * frequency-domain input. See the ProcessTimestampMethod
146 * documentation for details.
133 * 147 *
134 * This function must be called before the first call to 148 * This function must be called before the first call to
135 * process(). 149 * process().
136 */ 150 */
137 enum ProcessTimestampMethod { 151 void setProcessTimestampMethod(ProcessTimestampMethod);
138 ShiftTimestamp,
139 ShiftData
140 };
141 152
142 void setProcessTimestampMethod(ProcessTimestampMethod); 153 /**
154 * Retrieve the method used for timestamp adjustment in plugins
155 * taking frequency-domain input. See the ProcessTimestampMethod
156 * documentation for details.
157 */
143 ProcessTimestampMethod getProcessTimestampMethod() const; 158 ProcessTimestampMethod getProcessTimestampMethod() const;
144 159
145 /** 160 /**
146 * Return the amount by which the timestamps supplied to process() 161 * Return the amount by which the timestamps supplied to process()
147 * are being incremented when they are passed to the plugin's own 162 * are being incremented when they are passed to the plugin's own