comparison PyPlugin.cpp @ 32:a8231788216c vampy2

Vampy2: accept numpy array return types.
author fazekasgy
date Mon, 21 Sep 2009 13:56:28 +0000
parents 4f1894c7591b
children
comparison
equal deleted inserted replaced
31:4f1894c7591b 32:a8231788216c
362 362
363 //create a list of buffers 363 //create a list of buffers
364 PyObject *pyChannelList = PyList_New((Py_ssize_t) m_channels); 364 PyObject *pyChannelList = PyList_New((Py_ssize_t) m_channels);
365 for (size_t i=0; i < m_channels; ++i) { 365 for (size_t i=0; i < m_channels; ++i) {
366 //Expose memory using the Buffer Interface of C/API 366 //Expose memory using the Buffer Interface of C/API
367 //This will virtually pass a pointer which can be 367 //This will pass a pointer which can be recasted
368 //recasted in Python code as float or complex array 368 //in Python code as float or complex array
369 PyObject *pyBuffer = PyBuffer_FromMemory 369 PyObject *pyBuffer = PyBuffer_FromMemory
370 ((void *) (float *) inputBuffers[i], 370 ((void *) (float *) inputBuffers[i],
371 (Py_ssize_t) sizeof(float) * m_blockSize); 371 (Py_ssize_t) sizeof(float) * m_blockSize);
372 372
373 PyList_SET_ITEM(pyChannelList, (Py_ssize_t) i, pyBuffer); 373 PyList_SET_ITEM(pyChannelList, (Py_ssize_t) i, pyBuffer);