]> git.sesse.net Git - nageru/commitdiff
Support other audio sample rates than 48000 Hz from bmusb.
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Fri, 28 Apr 2017 23:45:51 +0000 (01:45 +0200)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Fri, 28 Apr 2017 23:45:51 +0000 (01:45 +0200)
audio_mixer.cpp
bmusb

index 63758f9949d4f0b7c92008a179ec0d081b2329f6..6a08f2167d62a434a1b31a7af160ff61a6378b3d 100644 (file)
@@ -274,6 +274,12 @@ bool AudioMixer::add_audio(DeviceSpec device_spec, const uint8_t *data, unsigned
                }
        }
 
+       // If we changed frequency since last frame, we'll need to reset the resampler.
+       if (audio_format.sample_rate != device->capture_frequency) {
+               device->capture_frequency = audio_format.sample_rate;
+               reset_resampler_mutex_held(device_spec);
+       }
+
        // Now add it.
        device->resampling_queue->add_input_samples(frame_time, audio.get(), num_samples, ResamplingQueue::ADJUST_RATE);
        return true;
diff --git a/bmusb b/bmusb
index c245ceb9081e412bb815480481670e295ddfc71a..b70e557a8432ca3d86c1a71837e7a10e7935d585 160000 (submodule)
--- a/bmusb
+++ b/bmusb
@@ -1 +1 @@
-Subproject commit c245ceb9081e412bb815480481670e295ddfc71a
+Subproject commit b70e557a8432ca3d86c1a71837e7a10e7935d585