comparison PyPluginObject.cpp @ 43:36cc53aad853

Test output values a bit; fix input conversion from int
author Chris Cannam
date Wed, 03 Dec 2014 08:25:05 +0000
parents 9dd449a19004
children f12b59c022a5
comparison
equal deleted inserted replaced
42:9dd449a19004 43:36cc53aad853
399 } 399 }
400 400
401 } else { 401 } else {
402 402
403 if (!PyList_Check(pyBuffer)) { 403 if (!PyList_Check(pyBuffer)) {
404 PyErr_SetString(PyExc_TypeError, "List of NumPy Array required for process input."); 404 PyErr_SetString(PyExc_TypeError, "List of NumPy arrays or lists of numbers required for process input");
405 return data; 405 return data;
406 } 406 }
407 407
408 if (PyList_GET_SIZE(pyBuffer) != channels) { 408 if (PyList_GET_SIZE(pyBuffer) != channels) {
409 // cerr << "Wrong number of channels: got " << PyList_GET_SIZE(pyBuffer) << ", expected " << channels << endl; 409 // cerr << "Wrong number of channels: got " << PyList_GET_SIZE(pyBuffer) << ", expected " << channels << endl;
410 PyErr_SetString(PyExc_TypeError, "Wrong number of channels"); 410 PyErr_SetString(PyExc_TypeError, "Wrong number of channels");
411 return data; 411 return data;
412 } 412 }
413 413
414 for (int c = 0; c < channels; ++c) { 414 for (int c = 0; c < channels; ++c) {
415 PyObject *cbuf = PyList_GET_ITEM(pyBuffer, c); 415 PyObject *cbuf = PyList_GET_ITEM(pyBuffer, c);
416 data.push_back(conv.PyValue_To_FloatVector(cbuf)); 416 data.push_back(conv.PyValue_To_FloatVector(cbuf));
417 if (conv.error) {
418 PyErr_SetString(PyExc_TypeError, conv.getError().str().c_str());
419 return vector<vector<float> >();
420 }
417 } 421 }
418 } 422 }
419 423
420 for (int c = 0; c < channels; ++c) { 424 for (int c = 0; c < channels; ++c) {
421 if ((int)data[c].size() != blockSize) { 425 if ((int)data[c].size() != blockSize) {