This commit is contained in:
wangjiyu 2025-04-10 09:50:05 +08:00
parent 9ce7630be8
commit 5398231044
1 changed files with 5 additions and 0 deletions

View File

@ -43,6 +43,11 @@ int sendCustomAudioData(const int16_t destChannelIndex, py::object pyData, int32
std::cout << "step 2" << std::endl;
std::cout << "pyData ptr is:" << pyData.ptr() << std::endl;
// 2. 检查是否是 numpy 数组
if (!PyObject_Check(pyData.ptr())) {
std::cerr << "ERROR: Not a valid Python object" << std::endl;
throw std::runtime_error("Invalid Python object");
}
std::cout << "step 2.1" << std::endl;
if (!PyArray_Check(pyData.ptr())) {
std::cout << "input is notnumpy" << std::endl;
throw std::runtime_error("Input is not a numpy array");