diff --git a/PitchTracker/PitchTracker.vcxproj b/PitchTracker/PitchTracker.vcxproj index ebb42e38..1b729255 100644 --- a/PitchTracker/PitchTracker.vcxproj +++ b/PitchTracker/PitchTracker.vcxproj @@ -135,6 +135,7 @@ Speed Fast false + true Windows @@ -157,6 +158,7 @@ true Speed Fast + true Windows diff --git a/PitchTracker/ptAKF.cpp b/PitchTracker/ptAKF.cpp index cb83edae..335bcde6 100644 --- a/PitchTracker/ptAKF.cpp +++ b/PitchTracker/ptAKF.cpp @@ -163,16 +163,18 @@ int PtAKF::_GetNote(float samples[_SampleCt], float* restrict maxVolume, float w float lastWeight = 1.f; float maxWeight = 0.f; + #pragma omp parallel for schedule(static) for (int toneIndex = 0; toneIndex <= _MaxHalfTone; toneIndex++){ float curWeight = _AnalyzeByTone(samples, samplesWindowed, toneIndex); + weights[toneIndex] = curWeight; + } + + for (int toneIndex = 0; toneIndex <= _MaxHalfTone; toneIndex++){ + float curWeight = weights[toneIndex]; if(curWeight > maxWeight){ maxWeight = curWeight; } - - weights[toneIndex] = curWeight; - - //Filter: if(lastWeight > curWeight || (lastWeight > 0.f && curWeight <= 0.f)) lastValidTone = toneIndex - 1; lastWeight = curWeight;