comparison audio/AudioCallbackRecordTarget.cpp @ 580:298d864113f0 3.0-integration

Fix flickery level meters
author Chris Cannam
date Wed, 11 Jan 2017 17:46:37 +0000
parents c2e27ad7f408
children 8cc291b13f2b
comparison
equal deleted inserted replaced
579:1a8a8980f39a 580:298d864113f0
32 m_frameCount(0), 32 m_frameCount(0),
33 m_model(0), 33 m_model(0),
34 m_buffers(0), 34 m_buffers(0),
35 m_bufferCount(0), 35 m_bufferCount(0),
36 m_inputLeft(0.f), 36 m_inputLeft(0.f),
37 m_inputRight(0.f) 37 m_inputRight(0.f),
38 m_levelsSet(false)
38 { 39 {
39 m_viewManager->setAudioRecordTarget(this); 40 m_viewManager->setAudioRecordTarget(this);
40 41
41 connect(this, SIGNAL(recordStatusChanged(bool)), 42 connect(this, SIGNAL(recordStatusChanged(bool)),
42 m_viewManager, SLOT(recordStatusChanged(bool))); 43 m_viewManager, SLOT(recordStatusChanged(bool)));
191 void 192 void
192 AudioCallbackRecordTarget::setInputLevels(float left, float right) 193 AudioCallbackRecordTarget::setInputLevels(float left, float right)
193 { 194 {
194 if (left > m_inputLeft) m_inputLeft = left; 195 if (left > m_inputLeft) m_inputLeft = left;
195 if (right > m_inputRight) m_inputRight = right; 196 if (right > m_inputRight) m_inputRight = right;
197 m_levelsSet = true;
196 } 198 }
197 199
198 bool 200 bool
199 AudioCallbackRecordTarget::getInputLevels(float &left, float &right) 201 AudioCallbackRecordTarget::getInputLevels(float &left, float &right)
200 { 202 {
201 left = m_inputLeft; 203 left = m_inputLeft;
202 right = m_inputRight; 204 right = m_inputRight;
203 m_inputLeft = 0.f; 205 m_inputLeft = 0.f;
204 m_inputRight = 0.f; 206 m_inputRight = 0.f;
205 return true; 207 return m_levelsSet;
206 } 208 }
207 209
208 void 210 void
209 AudioCallbackRecordTarget::modelAboutToBeDeleted() 211 AudioCallbackRecordTarget::modelAboutToBeDeleted()
210 { 212 {