From 618ccf981bf16e848912cf8c4d72f58c7134642a Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Mon, 3 Nov 2014 18:55:03 +0100 Subject: Use Drumgizmo::setSamplerate to control resampler target samplerate. --- src/audiooutputengine.h | 5 ----- src/drumgizmo.cc | 11 +++++++---- 2 files changed, 7 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/audiooutputengine.h b/src/audiooutputengine.h index 25b6ea0..eafafe9 100644 --- a/src/audiooutputengine.h +++ b/src/audiooutputengine.h @@ -57,11 +57,6 @@ public: * Overload this method to force engine to use different buffer size. */ virtual size_t getBufferSize() { return 1024; } - - /** - * Overload this method to report output engine samplerate. - */ - virtual size_t samplerate() { return UNKNOWN_SAMPLERATE; } }; #endif/*__DRUMGIZMO_AUDIOOUTPUTENGINE_H__*/ diff --git a/src/drumgizmo.cc b/src/drumgizmo.cc index 9252afc..60ced09 100644 --- a/src/drumgizmo.cc +++ b/src/drumgizmo.cc @@ -74,14 +74,11 @@ bool DrumGizmo::loadkit(std::string file) loader.loadKit(&kit); #ifdef WITH_RESAMPLER - unsigned int output_fs = kit.samplerate(); - if(oe->samplerate() != UNKNOWN_SAMPLERATE) output_fs = oe->samplerate(); for(int i = 0; i < MAX_NUM_CHANNELS; i++) { - resampler[i].setup(kit.samplerate(), output_fs); + resampler[i].setup(kit.samplerate(), Conf::samplerate); } #endif/*WITH_RESAMPLER*/ - DEBUG(loadkit, "loadkit: Success\n"); return true; @@ -443,6 +440,12 @@ int DrumGizmo::samplerate() void DrumGizmo::setSamplerate(int samplerate) { Conf::samplerate = samplerate; +#ifdef WITH_RESAMPLER + for(int i = 0; i < MAX_NUM_CHANNELS; i++) { + resampler[i].setup(kit.samplerate(), Conf::samplerate); + } +#endif/*WITH_RESAMPLER*/ + } std::string float2str(float a) -- cgit v1.2.3