summaryrefslogtreecommitdiff
path: root/src/lib/resampler.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2015-09-09 09:50:48 +0100
committerCarl Hetherington <cth@carlh.net>2015-09-09 09:50:48 +0100
commitf26af8112b03b5233eb5239defd11a7428b705ad (patch)
treea7385c484829f531bbbc35b3f38235035e160a92 /src/lib/resampler.cc
parent272ce54d159a53be22f592922913901cfc673097 (diff)
Use SRC_LINEAR for speed when analysing audio (#685).
Diffstat (limited to 'src/lib/resampler.cc')
-rw-r--r--src/lib/resampler.cc9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/lib/resampler.cc b/src/lib/resampler.cc
index b12b549bf..ba57deb63 100644
--- a/src/lib/resampler.cc
+++ b/src/lib/resampler.cc
@@ -31,13 +31,18 @@ using std::pair;
using std::make_pair;
using boost::shared_ptr;
-Resampler::Resampler (int in, int out, int channels)
+/** @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)
: _in_rate (in)
, _out_rate (out)
, _channels (channels)
{
int error;
- _src = src_new (SRC_SINC_BEST_QUALITY, _channels, &error);
+ _src = src_new (fast ? SRC_LINEAR : SRC_SINC_BEST_QUALITY, _channels, &error);
if (!_src) {
throw StringError (String::compose (N_("could not create sample-rate converter (%1)"), error));
}