b=898291 erase azimuth/elevation history when reset()ing HRTFPanner r=ehsan
authorKarl Tomlinson <karlt+@karlt.net>
Fri, 25 Oct 2013 14:05:42 +1300
changeset 165863 c91ae6b8208cdd9dcd87233ebc2d4debcaeca589
parent 165862 b47c1bf9683098d4ae1de9afc194ee3f33cb8948
child 165864 52abf1613764f10208513fcdbb8f4ad34e08a1fa
push id3066
push userakeybl@mozilla.com
push dateMon, 09 Dec 2013 19:58:46 +0000
treeherdermozilla-beta@a31a0dce83aa [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersehsan
bugs898291
milestone27.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
b=898291 erase azimuth/elevation history when reset()ing HRTFPanner r=ehsan so that old cross-fade info does not distort new sound when a PannerNode finishes and restarts.
content/media/webaudio/blink/HRTFPanner.cpp
--- a/content/media/webaudio/blink/HRTFPanner.cpp
+++ b/content/media/webaudio/blink/HRTFPanner.cpp
@@ -42,19 +42,18 @@ const double MaxDelayTimeSeconds = 0.002
 const int UninitializedAzimuth = -1;
 const unsigned RenderingQuantum = 128;
 
 HRTFPanner::HRTFPanner(float sampleRate, mozilla::TemporaryRef<HRTFDatabaseLoader> databaseLoader)
     : m_databaseLoader(databaseLoader)
     , m_sampleRate(sampleRate)
     , m_crossfadeSelection(CrossfadeSelection1)
     , m_azimuthIndex1(UninitializedAzimuth)
-    , m_elevation1(0)
     , m_azimuthIndex2(UninitializedAzimuth)
-    , m_elevation2(0)
+    // m_elevation1 and m_elevation2 are initialized in pan()
     , m_crossfadeX(0)
     , m_crossfadeIncr(0)
     , m_convolverL1(HRTFElevation::fftSizeForSampleRate(sampleRate))
     , m_convolverR1(m_convolverL1.fftSize())
     , m_convolverL2(m_convolverL1.fftSize())
     , m_convolverR2(m_convolverL1.fftSize())
     , m_delayLineL(ceilf(MaxDelayTimeSeconds * sampleRate),
                    WebAudioUtils::ComputeSmoothingRate(0.02, sampleRate))
@@ -72,16 +71,22 @@ HRTFPanner::HRTFPanner(float sampleRate,
 
 HRTFPanner::~HRTFPanner()
 {
     MOZ_COUNT_DTOR(HRTFPanner);
 }
 
 void HRTFPanner::reset()
 {
+    m_azimuthIndex1 = UninitializedAzimuth;
+    m_azimuthIndex2 = UninitializedAzimuth;
+    // m_elevation1 and m_elevation2 are initialized in pan()
+    m_crossfadeSelection = CrossfadeSelection1;
+    m_crossfadeX = 0.0f;
+    m_crossfadeIncr = 0.0f;
     m_convolverL1.reset();
     m_convolverR1.reset();
     m_convolverL2.reset();
     m_convolverR2.reset();
     m_delayLineL.Reset();
     m_delayLineR.Reset();
 }