+ src_delete (_src);
+ int error;
+ _src = src_new (SRC_LINEAR, _channels, &error);
+ if (!_src) {
+ throw runtime_error (String::compose (N_("could not create sample-rate converter (%1)"), error));
+ }
+}
+
+pair<shared_ptr<const AudioBuffers>, Frame>
+Resampler::run (shared_ptr<const AudioBuffers> in, Frame frame)
+{
+ if (!_next_in || !_next_out || _next_in.get() != frame) {
+ /* Either there was a discontinuity in the input or this is the first input;
+ reset _next_out.
+ */
+ _next_out = lrintf (frame * _out_rate / _in_rate);
+ }
+
+ /* Expected next input frame */
+ _next_in = frame + in->frames ();
+