Skip to content
Merged
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions src/samplerate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -183,11 +183,11 @@ class Resampler {

// create a shorter view of the array
if ((size_t)src_data.output_frames_gen < new_size) {
out_shape[0] = src_data.output_frames_gen;
output.resize(out_shape);
return output[py::slice(0, src_data.output_frames_gen, 1)]
.cast<py::array_t<float, py::array::c_style>>();
} else {
return output;
}

return output;
Comment thread
fakufaku marked this conversation as resolved.
}

void set_ratio(double new_ratio) {
Expand Down Expand Up @@ -312,11 +312,11 @@ class CallbackResampler {

// create a shorter view of the array
if (output_frames_gen < frames) {
out_shape[0] = output_frames_gen;
output.resize(out_shape);
return output[py::slice(0, output_frames_gen, 1)]
.cast<py::array_t<float, py::array::c_style>>();
Comment thread
fakufaku marked this conversation as resolved.
Outdated
} else {
return output;
}

return output;
}

void set_starting_ratio(double new_ratio) {
Expand Down Expand Up @@ -413,8 +413,8 @@ py::array_t<float, py::array::c_style> resample(

// create a shorter view of the array
if ((size_t)src_data.output_frames_gen < new_size) {
out_shape[0] = src_data.output_frames_gen;
output.resize(out_shape);
output = output[py::slice(0, src_data.output_frames_gen, 1)]
.cast<py::array_t<float, py::array::c_style>>();
Comment thread
fakufaku marked this conversation as resolved.
Outdated
}

if (verbose) {
Expand All @@ -430,7 +430,7 @@ py::array_t<float, py::array::c_style> resample(

namespace sr = samplerate;

PYBIND11_MODULE(samplerate, m) {
PYBIND11_MODULE(samplerate, m, py::mod_gil_not_used()) {
Comment thread
fakufaku marked this conversation as resolved.
Outdated
m.doc() =
"A simple python wrapper library around libsamplerate"; // optional
// module
Expand Down
Loading