- // Apply the panning effect.
- double azimuth;
- double elevation;
- getAzimuthElevation(&azimuth, &elevation);
- m_panner->pan(azimuth, elevation, source, destination, framesToProcess);
-
- // Get the distance and cone gain.
- double totalGain = distanceConeGain();
-
- // Snap to desired gain at the beginning.
- if (m_lastGain == -1.0)
- m_lastGain = totalGain;
+ // The audio thread can't block on this lock, so we call tryLock() instead.
+ MutexTryLocker tryLocker(m_pannerLock);
+ if (tryLocker.locked()) {
+ // Apply the panning effect.
+ double azimuth;
+ double elevation;
+ getAzimuthElevation(&azimuth, &elevation);
+ m_panner->pan(azimuth, elevation, source, destination, framesToProcess);
+
+ // Get the distance and cone gain.
+ double totalGain = distanceConeGain();
+
+ // Snap to desired gain at the beginning.
+ if (m_lastGain == -1.0)
+ m_lastGain = totalGain;