comparison native/vampyhost.cpp @ 60:2437c52b4d62

Add frame2RealTime
author Chris Cannam
date Wed, 14 Jan 2015 10:36:22 +0000
parents a0243984805b
children aa8491a11530
comparison
equal deleted inserted replaced
59:2809245a2fe7 60:2437c52b4d62
203 } 203 }
204 204
205 return PyPluginObject_From_Plugin(plugin); 205 return PyPluginObject_From_Plugin(plugin);
206 } 206 }
207 207
208 static PyObject *
209 frame2RealTime(PyObject *self, PyObject *args)
210 {
211 int frame;
212 int rate;
213
214 if (!PyArg_ParseTuple(args, "nn",
215 &frame,
216 &rate)) {
217 PyErr_SetString(PyExc_TypeError,
218 "frame2RealTime() takes frame (int) and sample rate (int) arguments");
219 return 0; }
220
221 RealTime rt = RealTime::frame2RealTime(frame, rate);
222 return PyRealTime_FromRealTime(rt);
223 }
224
208 // module methods table 225 // module methods table
209 static PyMethodDef vampyhost_methods[] = { 226 static PyMethodDef vampyhost_methods[] = {
210 227
211 {"listPlugins", enumeratePlugins, METH_NOARGS, 228 {"listPlugins", enumeratePlugins, METH_NOARGS,
212 "listPlugins() -> Return a list of the plugin keys of all installed Vamp plugins." }, 229 "listPlugins() -> Return a list of the plugin keys of all installed Vamp plugins." },
213 230
214 {"getPluginPath", getPluginPath, METH_NOARGS, 231 {"getPluginPath", getPluginPath, METH_NOARGS,
215 "getPluginPath() -> Return a list of directories which will be searched for Vamp plugins. This may be changed by setting the VAMP_PATH environment variable."}, 232 "getPluginPath() -> Return a list of directories which will be searched for Vamp plugins. This may be changed by setting the VAMP_PATH environment variable."},
223 {"getOutputsOf", getOutputList, METH_VARARGS, 240 {"getOutputsOf", getOutputList, METH_VARARGS,
224 "getOutputsOf(pluginKey) -> Return a list of the output identifiers of the plugin with the given key, if installed."}, 241 "getOutputsOf(pluginKey) -> Return a list of the output identifiers of the plugin with the given key, if installed."},
225 242
226 {"loadPlugin", loadPlugin, METH_VARARGS, 243 {"loadPlugin", loadPlugin, METH_VARARGS,
227 "loadPlugin(pluginKey, samplerate) -> Load the plugin that has the given key, if installed, and return the plugin object."}, 244 "loadPlugin(pluginKey, samplerate) -> Load the plugin that has the given key, if installed, and return the plugin object."},
245
246 {"frame2RealTime", frame2RealTime, METH_VARARGS,
247 "frame2RealTime() -> Convert sample frame number and sample rate to a RealTime object." },
228 248
229 {0, 0} /* sentinel */ 249 {0, 0} /* sentinel */
230 }; 250 };
231 251
232 PyDoc_STRVAR(module_doc, "Load and run Vamp audio analysis plugins."); 252 PyDoc_STRVAR(module_doc, "Load and run Vamp audio analysis plugins.");