I'm working on a program that is using SharedMemory to send data between processes and it would be really nice if I could have samplerate just write directly to the buffer, so I don't have to copy it from the return result.
Thinking all that would be needed is to add an optional out parameter that, if present, is used instead of the below code.
|
// allocate output array |
|
std::vector<size_t> out_shape{new_size}; |
|
if (inbuf.ndim == 2) out_shape.push_back(static_cast<size_t>(channels)); |
|
auto output = py::array_t<float, py::array::c_style>(out_shape); |
|
py::buffer_info outbuf = output.request(); |
Looks like libsamplerate already supports setting the out pointer:
typedef struct
{ float *data_in, *data_out ;
long input_frames, output_frames ;
long input_frames_used, output_frames_gen ;
int end_of_input ;
double src_ratio ;
} SRC_DATA ;
I'm working on a program that is using SharedMemory to send data between processes and it would be really nice if I could have samplerate just write directly to the buffer, so I don't have to copy it from the return result.
Thinking all that would be needed is to add an optional
outparameter that, if present, is used instead of the below code.python-samplerate/src/samplerate.cpp
Lines 164 to 168 in d737def
Looks like libsamplerate already supports setting the out pointer: