changeset 1321:ca43c4b7719c bqresample

Fixes to sample rate and latency handling
author Chris Cannam
date Fri, 09 Dec 2016 14:40:49 +0000
parents 983667969a82
children e939a365e4d2
files base/AudioPlaySource.h transform/ModelTransformerFactory.cpp
diffstat 2 files changed, 10 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/base/AudioPlaySource.h	Fri Dec 09 10:24:40 2016 +0000
+++ b/base/AudioPlaySource.h	Fri Dec 09 14:40:49 2016 +0000
@@ -70,11 +70,16 @@
     virtual sv_samplerate_t getSourceSampleRate() const = 0;
 
     /**
-     * Return the sample rate set by the target audio device (or the
-     * source sample rate if the target hasn't set one).  If the
-     * source and target sample rates differ, resampling will occur.
+     * Return the sample rate set by the target audio device (or 0 if
+     * the target hasn't told us yet).  If the source and target
+     * sample rates differ, resampling will occur.
+     *
+     * Note that we don't actually do any processing at the device
+     * sample rate. All processing happens at the source sample rate,
+     * and then a resampler is applied if necessary at the interface
+     * between application and driver layer.
      */
-    virtual sv_samplerate_t getTargetSampleRate() const = 0;
+    virtual sv_samplerate_t getDeviceSampleRate() const = 0;
 
     /**
      * Get the block size of the target audio device.  This may be an
--- a/transform/ModelTransformerFactory.cpp	Fri Dec 09 10:24:40 2016 +0000
+++ b/transform/ModelTransformerFactory.cpp	Fri Dec 09 14:40:49 2016 +0000
@@ -103,7 +103,7 @@
         int blockSize = 1024;
         int channels = 1;
         if (source) {
-            sampleRate = source->getTargetSampleRate();
+            sampleRate = source->getSourceSampleRate();
             blockSize = source->getTargetBlockSize();
             channels = source->getTargetChannelCount();
         }