summaryrefslogtreecommitdiff
path: root/src/lib/resampler.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2016-06-22 01:47:28 +0100
committerCarl Hetherington <cth@carlh.net>2016-06-22 01:47:28 +0100
commit76f83b97c401c24b3c93baee0665e84be05f43ea (patch)
tree75e7f3e87f3721c8ac4c55ac6bc9559556954987 /src/lib/resampler.cc
parent5e9e59e044fe3b51352d5dccad7f11882c6a571c (diff)
Set AudioDecoder::fast a different way.
Diffstat (limited to 'src/lib/resampler.cc')
-rw-r--r--src/lib/resampler.cc16
1 files changed, 13 insertions, 3 deletions
diff --git a/src/lib/resampler.cc b/src/lib/resampler.cc
index db5552d15..ff93d1609 100644
--- a/src/lib/resampler.cc
+++ b/src/lib/resampler.cc
@@ -37,15 +37,14 @@ using boost::shared_ptr;
/** @param in Input sampling rate (Hz)
* @param out Output sampling rate (Hz)
* @param channels Number of channels.
- * @param fast true to be fast rather than good.
*/
-Resampler::Resampler (int in, int out, int channels, bool fast)
+Resampler::Resampler (int in, int out, int channels)
: _in_rate (in)
, _out_rate (out)
, _channels (channels)
{
int error;
- _src = src_new (fast ? SRC_LINEAR : SRC_SINC_BEST_QUALITY, _channels, &error);
+ _src = src_new (SRC_SINC_BEST_QUALITY, _channels, &error);
if (!_src) {
throw runtime_error (String::compose (N_("could not create sample-rate converter (%1)"), error));
}
@@ -56,6 +55,17 @@ Resampler::~Resampler ()
src_delete (_src);
}
+void
+Resampler::set_fast ()
+{
+ 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));
+ }
+}
+
shared_ptr<const AudioBuffers>
Resampler::run (shared_ptr<const AudioBuffers> in)
{