@@ -58,6 +58,12 @@ class BaseSineAnalyzer : public LoopbackProcessor {
5858 return mMagnitude ;
5959 }
6060
61+ /* *
62+ * Set the amplitude of some white noise that can be added to the output signal.
63+ * This can be used to try to defeat feedback suppression that may block pure sine waves.
64+ * The default is zero because it can add phaseJitter and result in flaky tests.
65+ * @param noiseAmplitude amplitude of white noise, default is 0.0
66+ */
6167 void setNoiseAmplitude (double noiseAmplitude) {
6268 mNoiseAmplitude = noiseAmplitude;
6369 }
@@ -198,8 +204,9 @@ class BaseSineAnalyzer : public LoopbackProcessor {
198204 }
199205
200206protected:
201- // Try to get a prime period so the waveform plot changes every time.
202- static constexpr int32_t kTargetGlitchFrequency = 48000 / 113 ;
207+ // Use a frequency that will not align with the common burst sizes.
208+ // If it aligns then buffer reordering bugs could be masked.
209+ static constexpr int32_t kTargetGlitchFrequency = 857 ; // Match CTS Verifier
203210
204211 int32_t mSinePeriod = 1 ; // this will be set before use
205212 double mInverseSinePeriod = 1.0 ;
@@ -209,7 +216,7 @@ class BaseSineAnalyzer : public LoopbackProcessor {
209216 // in a callback and the output frame count may advance ahead of the input, or visa versa.
210217 double mInputPhase = 0.0 ;
211218 double mOutputPhase = 0.0 ;
212- double mOutputAmplitude = 0.75 ;
219+ double mOutputAmplitude = 0.90 ;
213220 // This is the phase offset between the mInputPhase sine wave and the recorded
214221 // signal at the tuned frequency.
215222 // If this jumps around then we are probably just hearing noise.
@@ -233,7 +240,8 @@ class BaseSineAnalyzer : public LoopbackProcessor {
233240private:
234241 float mTolerance = 0.10 ; // scaled from 0.0 to 1.0
235242
236- float mNoiseAmplitude = 0.00 ; // Used to experiment with warbling caused by DRC.
243+ // Default to zero because some phones have a high pass filter that make it too loud.
244+ float mNoiseAmplitude = 0 .0f ;
237245 PseudoRandom mWhiteNoise ;
238246};
239247
0 commit comments