[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Traverso-commit] traverso/src/plugins/native CorrelationMeter.cpp
From: |
Nicola Doebelin |
Subject: |
[Traverso-commit] traverso/src/plugins/native CorrelationMeter.cpp |
Date: |
Thu, 07 Feb 2008 15:33:17 +0000 |
CVSROOT: /sources/traverso
Module name: traverso
Changes by: Nicola Doebelin <n_doebelin> 08/02/07 15:33:17
Modified files:
src/plugins/native: CorrelationMeter.cpp
Log message:
Fallback speed is now independent of the buffer size
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/traverso/src/plugins/native/CorrelationMeter.cpp?cvsroot=traverso&r1=1.4&r2=1.5
Patches:
Index: CorrelationMeter.cpp
===================================================================
RCS file: /sources/traverso/traverso/src/plugins/native/CorrelationMeter.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- CorrelationMeter.cpp 7 Feb 2008 11:46:09 -0000 1.4
+++ CorrelationMeter.cpp 7 Feb 2008 15:33:17 -0000 1.5
@@ -16,7 +16,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-$Id: CorrelationMeter.cpp,v 1.4 2008/02/07 11:46:09 n_doebelin Exp $
+$Id: CorrelationMeter.cpp,v 1.5 2008/02/07 15:33:17 n_doebelin Exp $
*/
@@ -25,23 +25,23 @@
#include <AudioBus.h>
#include <AudioDevice.h>
#include <Debugger.h>
-#include <QDebug>
#include <math.h>
+#include <limits.h>
// Always put me below _all_ includes, this is needed
// in case we run with memory leak detection enabled!
#include "Debugger.h"
-#define SMOOTH_FACTOR 1
#define BUFFER_READOUT_TOLERANCE 2 // recommended: 1-10
-#define METER_COLLAPSE_SPEED 4 // recommended: 1-10
+#define RINGBUFFER_SIZE 150
+#define METER_COLLAPSE_SPEED 0.05
CorrelationMeter::CorrelationMeter()
: Plugin()
{
// constructs a ringbuffer that can hold 150 CorrelationMeterData
structs
- m_databuffer = new RingBufferNPT<CorrelationMeterData>(150);
+ m_databuffer = new RingBufferNPT<CorrelationMeterData>(RINGBUFFER_SIZE);
// Initialize member variables, that need to be initialized
calculate_fract();
@@ -193,7 +193,7 @@
if (readcount == 0) {
// add another 'if' to avoid unlimited growth of the variable
- if (m_bufferreadouts <= BUFFER_READOUT_TOLERANCE) {
+ if (m_bufferreadouts < RINGBUFFER_SIZE) {
m_bufferreadouts++;
}
@@ -204,7 +204,7 @@
dummydata.r = 1.0;
dummydata.levelLeft = 0.0;
dummydata.levelRight = 0.0;
- for (int i = 0; i < METER_COLLAPSE_SPEED; ++i) {
+ for (int i = 0; i < int(METER_COLLAPSE_SPEED /
m_fract); ++i) {
m_databuffer->write(&dummydata, 1);
}
} else {
@@ -262,7 +262,7 @@
void CorrelationMeter::calculate_fract( )
{
- m_fract = ((float) audiodevice().get_buffer_size()) /
(audiodevice().get_sample_rate() * SMOOTH_FACTOR);
+ m_fract = ((float) audiodevice().get_buffer_size()) /
(audiodevice().get_sample_rate());
}
- [Traverso-commit] traverso/src/plugins/native CorrelationMeter.cpp,
Nicola Doebelin <=