File tree Expand file tree Collapse file tree
modules/yup_dsp/resampling Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -154,7 +154,7 @@ class Resampler
154154 }
155155 }
156156
157- const int outputCount = static_cast <int > (( numSamples - currentPhase) * oversampleFactor);
157+ const int outputCount = static_cast <int > (std::ceil (( numSamples - currentPhase) * oversampleFactor) );
158158 const CoeffType gainScale = (oversampleFactor < 1.0 )
159159 ? static_cast <CoeffType> (oversampleFactor)
160160 : CoeffType (1 );
@@ -202,7 +202,7 @@ class Resampler
202202 endBufs[static_cast <std::size_t > (ch)].push (xBuf[static_cast <std::size_t > (numSamples + i)]);
203203 }
204204
205- currentPhase = ( currentPhase + static_cast <double > (outputCount) / oversampleFactor) - numSamples;
205+ currentPhase = std::max ( 0.0 , ( currentPhase + static_cast <double > (outputCount) / oversampleFactor) - numSamples) ;
206206 return outputCount;
207207 }
208208
You can’t perform that action at this time.
0 commit comments