From 7833e1bff107ac1a4fbecc6fa66edd495261e0c5 Mon Sep 17 00:00:00 2001 From: Chris Cannam Date: Thu, 4 Aug 2022 12:08:15 +0100 Subject: [PATCH] Avoid kick analysis in single-window mode; comment update --- src/finer/Guide.h | 39 ++++++++++++++++++++++----------------- src/finer/R3Stretcher.cpp | 6 ++---- 2 files changed, 24 insertions(+), 21 deletions(-) diff --git a/src/finer/Guide.h b/src/finer/Guide.h index 78f685a..83667b4 100644 --- a/src/finer/Guide.h +++ b/src/finer/Guide.h @@ -289,15 +289,29 @@ public: guidance.channelLock.f1 = 600.0; } - bool kick = - (segmentation.percussiveBelow > 40.0) && - (prevSegmentation.percussiveBelow < 40.0) && - checkPotentialKick(magnitudes, prevMagnitudes); + if (!m_parameters.singleWindowMode) { + + bool kick = + (segmentation.percussiveBelow > 40.0) && + (prevSegmentation.percussiveBelow < 40.0) && + checkPotentialKick(magnitudes, prevMagnitudes); - bool futureKick = !kick && - (nextSegmentation.percussiveBelow > 40.0) && - (segmentation.percussiveBelow < 40.0) && - checkPotentialKick(nextMagnitudes, magnitudes); + bool futureKick = !kick && + (nextSegmentation.percussiveBelow > 40.0) && + (segmentation.percussiveBelow < 40.0) && + checkPotentialKick(nextMagnitudes, magnitudes); + + if (kick) { + guidance.kick.present = true; + guidance.kick.f0 = 0.0; + guidance.kick.f1 = segmentation.percussiveBelow; + } else if (futureKick) { + guidance.preKick.present = true; + guidance.preKick.f0 = 0.0; + guidance.preKick.f1 = nextSegmentation.percussiveBelow; + } + } + /* std::cout << "d:" << prevSegmentation.percussiveBelow << "," @@ -308,15 +322,6 @@ public: << (kick ? "K" : "N") << "," << (futureKick ? "F" : "N") << std::endl; */ - if (kick) { - guidance.kick.present = true; - guidance.kick.f0 = 0.0; - guidance.kick.f1 = segmentation.percussiveBelow; - } else if (futureKick) { - guidance.preKick.present = true; - guidance.preKick.f0 = 0.0; - guidance.preKick.f1 = nextSegmentation.percussiveBelow; - } if (segmentation.residualAbove > segmentation.percussiveAbove) { guidance.highUnlocked.present = true; diff --git a/src/finer/R3Stretcher.cpp b/src/finer/R3Stretcher.cpp index 160b457..0aa74ac 100644 --- a/src/finer/R3Stretcher.cpp +++ b/src/finer/R3Stretcher.cpp @@ -281,8 +281,8 @@ R3Stretcher::createResampler() if (isRealTime()) { // If we knew the caller would never change ratio, we could // supply RatioMostlyFixed - but it can have such overhead - // when the ratio *does* change that a single call would kill - // RT use, so it's not a good idea + // when the ratio *does* change (and it's not RT-safe overhead + // either) that a single call would kill RT use resamplerParameters.dynamism = Resampler::RatioOftenChanging; resamplerParameters.ratioChange = Resampler::SmoothRatioChange; } else { @@ -1193,8 +1193,6 @@ R3Stretcher::adjustFormant(int c) void R3Stretcher::adjustPreKick(int c) { - //!!! if we aren't going to do this, we should modify Guide so as - //!!! not to do the small additional work of checking for it if (isSingleWindowed()) return; Profiler profiler("R3Stretcher::adjustPreKick");