changeset 107:c3ac34b2e45b

correct bugs after DAN review
author lbajardsilogic
date Thu, 13 Sep 2007 12:42:44 +0000
parents d94ee3e8dfe1
children c107866fd387
files sv/filter/TimeStretchFilter.cpp
diffstat 1 files changed, 5 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/sv/filter/TimeStretchFilter.cpp	Wed Sep 12 08:47:36 2007 +0000
+++ b/sv/filter/TimeStretchFilter.cpp	Thu Sep 13 12:42:44 2007 +0000
@@ -61,7 +61,7 @@
 {
 	m_hop = m_framesize/4;
 
-	m_inputBuffer = (float *)calloc((m_framesize*2+1), sizeof(float));
+	m_inputBuffer = (float *)calloc(((m_framesize-1)*2 + 1 + m_hop), sizeof(float));
 	
 	/**********malloc***********/
 	FFTframe=(float *)calloc((m_framesize), sizeof(float));
@@ -73,7 +73,7 @@
 	processedframe=(float *)calloc((m_framesize), sizeof(float));			//The current frame
 	synthframe=(float *)calloc((m_framesize), sizeof(float));
 	outbuffer=(float *)calloc((m_framesize/4), sizeof(float));			//The current output segment which is 1/4 framesize for 75% overlap		
-			
+	
 	holdbuffer3=(float *)calloc((m_framesize*0.75), sizeof(float));	//The hold buffer for the previous frame segment
 	holdbuffer2=(float *)calloc((m_framesize/2), sizeof(float));		//The fold buffer for the frame segment 2 frames ago
 	holdbuffer1=(float *)calloc((m_framesize/4), sizeof(float));
@@ -245,9 +245,9 @@
 	bool drum = 0;
 	float drumthresh = 65;
 
-	int currentposition = m_hop+1;
+	int currentposition = m_hop;
 
-	if (samples < floor((m_framesize-1)*m_interpfactor + 1 + 1025))
+	if (samples < floor((m_framesize-1)*m_interpfactor + 1 + m_hop))
 		return;
 
 	int channel = getSourceChannelCount();
@@ -379,7 +379,7 @@
 
 size_t TimeStretchFilter::getRequiredInputSamples(size_t outputSamplesNeeded)
 {
-	size_t need = floor((m_framesize-1)*m_interpfactor + 1 + m_hop + 1);
+	size_t need = floor((m_framesize-1)*m_interpfactor + 1 + m_hop);
 	return need;
 }