#include "AudioNodeInput.h"
#include "AudioNodeOutput.h"
#include "Reverb.h"
+#if ENABLE(TIZEN_WEB_AUDIO)
+#include <wtf/CurrentTime.h>
+#endif
#include <wtf/MainThread.h>
// Note about empirical tuning:
ConvolverNode::ConvolverNode(AudioContext* context, float sampleRate)
: AudioNode(context, sampleRate)
, m_normalize(true)
+#if ENABLE(TIZEN_WEB_AUDIO)
+ , m_latencyTime(0.0)
+ , m_resetCount(0)
+#endif
{
addInput(adoptPtr(new AudioNodeInput(this)));
addOutput(adoptPtr(new AudioNodeOutput(this, 2)));
AudioBus* outputBus = output(0)->bus();
ASSERT(outputBus);
+#if ENABLE(TIZEN_WEB_AUDIO)
+ if (m_resetCount > 5 * sampleRate()) {
+ // Wait for 5 sec before checking again.
+ m_resetCount = 0;
+ m_latencyTime = 0.0;
+ }
+
+ if (m_latencyTime > framesToProcess / sampleRate()) {
+ m_resetCount += framesToProcess;
+ outputBus->zero();
+ return;
+ }
+
+ double currentTime = WTF::currentTime();
+#endif
+
// Synchronize with possible dynamic changes to the impulse response.
MutexTryLocker tryLocker(m_processLock);
if (tryLocker.locked()) {
// Too bad - the tryLock() failed. We must be in the middle of setting a new impulse response.
outputBus->zero();
}
+
+#if ENABLE(TIZEN_WEB_AUDIO)
+ m_latencyTime = WTF::currentTime() - currentTime;
+#endif
}
void ConvolverNode::reset()