changeset 229:7d5d51145b81

support stereo in MultiRealTimeFilter and integrate Equalizer filter
author lbajardsilogic
date Wed, 05 Mar 2008 14:08:57 +0000
parents a6b881972a62
children 3c473495403f
files base/PropertyContainer.cpp base/PropertyContainer.h sv/filter/DSP.cpp sv/filter/DSP.h sv/filter/EqualizerFilter.cpp sv/filter/EqualizerFilter.h sv/filter/MultiRealTimeFilter.cpp sv/filter/MultiRealTimeFilter.h widgets/Plotter.cpp widgets/Plotter.h widgets/PropertyBox.cpp widgets/PropertyBox.h
diffstat 12 files changed, 902 insertions(+), 160 deletions(-) [+]
line wrap: on
line diff
--- a/base/PropertyContainer.cpp	Fri Feb 29 11:08:09 2008 +0000
+++ b/base/PropertyContainer.cpp	Wed Mar 05 14:08:57 2008 +0000
@@ -83,7 +83,7 @@
     CommandHistory::getInstance()->addCommand
 	(new SetPropertyCommand(this, name, value), true, true); // bundled
 }
- 
+
 void
 PropertyContainer::setProperty(QString nameString, QString valueString)
 {
@@ -257,4 +257,3 @@
 {
     return tr("Set %1 Property").arg(m_pn);
 }
-
--- a/base/PropertyContainer.h	Fri Feb 29 11:08:09 2008 +0000
+++ b/base/PropertyContainer.h	Wed Mar 05 14:08:57 2008 +0000
@@ -20,7 +20,9 @@
 
 #include <QString>
 #include <QObject>
-#include <vector>
+#include <QVector>
+
+//#include <vector>
 
 class PlayParameters;
 class RangeMapper;
@@ -105,10 +107,12 @@
 
 	virtual void emitPropertiesChanged() { emit propertiesChanged(this); }
 
+	virtual void setProperty(const PropertyName &, QVector<int> value){return;}
+
 signals:
     void propertyChanged(PropertyContainer::PropertyName);
 	void propertiesChanged(PropertyContainer*);
-
+	
 public slots:
     /**
      * Set a property.  This is used for all property types.  For
--- a/sv/filter/DSP.cpp	Fri Feb 29 11:08:09 2008 +0000
+++ b/sv/filter/DSP.cpp	Wed Mar 05 14:08:57 2008 +0000
@@ -21,13 +21,22 @@
 extern int currentposition;
 extern float lastfactor;
 extern float hopfactor;
-
-
 //These variables are only required for find peaks...the same variables are passed in to other functions
 extern int numpeaks;
 extern float *peak_locations; 
-extern float *p_mags; 
-extern float *c_mags;
+//extern float *p_mags; 
+//extern float *c_mags;
+
+extern float *L_mags;		///CURRENT FRAME MAGNITUDES
+extern float *R_mags;		///CURRENT FRAME MAGNITUDES
+extern float *pL_mags;		///PREVIOUS FRAME MAGNITUDES
+extern float *pR_mags;		///PREVIOUS FRAME MAGNITUDES
+
+extern float *band1;
+extern float *band2;
+extern float *band3;
+extern float *band4;
+extern float *band5;
 
 void intobyte(int num, char* pbyte1 ,char* pbyte2)
 {
@@ -61,7 +70,7 @@
 	mags[f]=sqrt((cart[f]*cart[f])+(cart[length+f]*cart[length+f]));
 	
 
-	phases[f]=atan2((double)(-1*cart[f+length]),(double)(cart[f]));
+	phases[f]=atan2((float)(-1*cart[f+length]),(float)(cart[f]));
 	
 	
 
@@ -87,17 +96,21 @@
 
 void hanning(float* window, int framesize)
 {
+	
 	for (int f = 0; f<framesize; f++)
 	{
 		
-		window[f]= (0.5*(1-cos(2*PI*(f+1)/(framesize+1))));
+		window[f]= (float) (0.5*(1-cos(2*PI*(f+1)/(framesize+1))));
+	
 	}
+
+
 }
 
 void updatephases(float* c_phase,float* p_phase,float* c_synthphase,float* p_synthphase, int framesize,float hopfactor,float interpfactor)
 {
 
-	float synth_hopsize=framesize/4;
+	float synth_hopsize=((float) framesize) /4;
 	float actual_anhop=floor(hopfactor*synth_hopsize);
 	float anhop = floor((hopfactor*synth_hopsize)/interpfactor);
 	float inst_freq;
@@ -112,15 +125,15 @@
 
 		interpfactor;
 
-		omega_k=(2*PI*f)/float(framesize);			//This is the predicted angular freqency rads/sec of the centre frequency
+		omega_k=(float) ((2*PI*f)/float(framesize));			//This is the predicted angular freqency rads/sec of the centre frequency
 		
 		delta_phi=(c_phase[f]-p_phase[f])-(anhop*omega_k);
 
-		a = delta_phi/(2*PI);
+		a = (float) (delta_phi/(2*PI));
 		
-		k = floor(a+0.5);
+		k =  (float) (floor(a+0.5));
 		
-		delta_phi = delta_phi-k*2*PI;
+		delta_phi = (float) (delta_phi-k*2*PI);
 		
 		inst_freq=omega_k+delta_phi/anhop; 
 	
@@ -145,7 +158,7 @@
 void updatephases2(float* c_phase,float* p_phase,float* c_synthphase,float* p_synthphase, int framesize,float hopfactor,float interpfactor)
 {
 
-	float synth_hopsize=framesize/4;
+	float synth_hopsize=((float) framesize)/4;
 	float actual_anhop=actual_anhop=floor(hopfactor*synth_hopsize);
 	float anhop = floor((hopfactor*synth_hopsize)/interpfactor);
 	float inst_freq;
@@ -160,15 +173,15 @@
 
 		interpfactor;
 
-		omega_k=(2*PI*f)/float(framesize);			//This is the predicted angular freqency rads/sec of the centre frequency
+		omega_k=(float) ((2*PI*f)/float(framesize));			//This is the predicted angular freqency rads/sec of the centre frequency
 		
 		delta_phi=(c_phase[f]-p_phase[f])-(anhop*omega_k);
 
-		a = delta_phi/(2*PI);
+		a = (float) (delta_phi/(2*PI));
 		
-		k = floor(a+0.5);
+		k = (float) (floor(a+0.5));
 		
-		delta_phi = delta_phi-k*2*PI;
+		delta_phi = (float) (delta_phi-k*2*PI);
 		
 		inst_freq=omega_k+delta_phi/anhop; 
 	
@@ -216,15 +229,15 @@
 		
 		phase_diff=(c_phase[i]-p_phase[i]);
 		
-		omega_k=(2*PI*i)/float(framesize);
+		omega_k=(float) ((2*PI*i)/float(framesize));
 
 		delta_phi=(phase_diff)-(anhop*omega_k);
 
-		a = delta_phi/(2*PI);
+		a = (float) (delta_phi/(2*PI));
 		
-		k = floor(a+0.5);
+		k = (float) (floor(a+0.5));
 		
-		delta_phi = delta_phi-k*2*PI;
+		delta_phi = (float) (delta_phi-k*2*PI);
 		
 		inst_freq=omega_k+delta_phi/anhop; 
 					
@@ -235,7 +248,7 @@
 		//c_synthphase[i]=p_synthphase[i]+((phase_diff*diffhop)*interpfactor);
 		
 		//if (currentposition<framesize/2 || (!(lastfactor==hopfactor))){c_synthphase[i] = c_phase[i];}
-		//if (currentposition<framesize/2){c_synthphase[i] = c_phase[i];}
+		if (currentposition<framesize/2){c_synthphase[i] = c_phase[i];}
 		
 		p_synthphase[i]=c_synthphase[i];
 	}
@@ -243,7 +256,7 @@
 	lastfactor=hopfactor;
 }
 
-void rotatephases_peaklocked(float* c_phase, float* p_phase, float* c_synthphase, float* p_synthphase, int framesize, float interpfactor)
+void rotatephases_peaklocked(float* c_phase, float* p_phase, float* c_synthphase, float* p_synthphase, float* c_mags, int framesize, float interpfactor)
 {
 	float phase_diff;
 	int diffhop = framesize/4;
@@ -261,14 +274,14 @@
 
 	cutoff = floor(cutoff/(44100/framesize));
 
-	numpeaks = findpeaks(c_mags, p_mags, framesize, peak_locations);
+	numpeaks = findpeaks(c_mags, pL_mags,(float) framesize, peak_locations);
 	
 	int p=1;
 	//while(peak_locations[p]<cutoff)
 		while(p<=numpeaks)
 	{
 		
-		i=peak_locations[p];
+		i=(int) peak_locations[p];
 
 		original_peak_phase=c_phase[i];
 		
@@ -278,32 +291,32 @@
 		
 		if (p==1){
 			start=0;
-			end=floor(peak_locations[p]+((peak_locations[p+1]-peak_locations[p])/2));
+			end=(int) floor(peak_locations[p]+((peak_locations[p+1]-peak_locations[p])/2));
 		}
 
 		else{
 		if (p==numpeaks){
-			start=floor(peak_locations[p-1]+((peak_locations[p]-peak_locations[p-1])/2));
+			start=(int) floor(peak_locations[p-1]+((peak_locations[p]-peak_locations[p-1])/2));
 			end=(framesize/2);
 		}
 		else {
-			start=floor(peak_locations[p-1]+((peak_locations[p]-peak_locations[p-1])/2));
-			end=floor(peak_locations[p]+((peak_locations[p+1]-peak_locations[p])/2));
+			start=(int) floor(peak_locations[p-1]+((peak_locations[p]-peak_locations[p-1])/2));
+			end=(int) floor(peak_locations[p]+((peak_locations[p+1]-peak_locations[p])/2));
 		}
 		}
 			
 		phase_diff=(c_phase[i]-p_phase[i]);
-		omega_k=(2*PI*i)/float(framesize);
+		omega_k=(float) ((2*PI*i)/float(framesize));
 		delta_phi=(phase_diff)-(anhop*omega_k);
-		a = delta_phi/(2*PI);
-		k = floor(a+0.5);
-		delta_phi = delta_phi-k*2*PI;
+		a = (float) (delta_phi/(2*PI));
+		k = (float) (floor(a+0.5));
+		delta_phi = (float) (delta_phi-k*2*PI);
 		inst_freq=omega_k+delta_phi/anhop; 
 		c_synthphase[i]=p_synthphase[i]+(inst_freq*diffhop);
 		//c_synthphase[i]=p_synthphase[i]+(phase_diff);
 		//c_synthphase[i]=p_synthphase[i]+((phase_diff*diffhop)*interpfactor);
 		//if (currentposition<framesize/2 || (!(lastfactor==hopfactor))){c_synthphase[i] = c_phase[i];}
-		//if (currentposition<framesize/2){c_synthphase[i] = c_phase[i];}
+		if (currentposition<framesize/2){c_synthphase[i] = c_phase[i];}
 		p_synthphase[i]=c_synthphase[i];
 
 		int j;
@@ -347,7 +360,42 @@
 	lastfactor=hopfactor;
 }
 
+void cur2last(float* c_phase, float* c_synthphase, float* p_synthphase, int framesize)
+{
 
+for (int i=0; i<framesize/2; i++)
+	{
+		
+		c_synthphase[i]=c_phase[i];
+						
+		p_synthphase[i]=c_synthphase[i];
+	}
+
+
+}
+
+
+int findpeaks(float* c_mags, float* p_mags, float framesize, float* peak_locations)
+
+{
+	numpeaks=0;
+	peak_locations[0]=0;
+	float peakthreshold=0;
+
+	for (int i=2; i<(framesize/4)-10; i++)
+	{
+		
+		if(c_mags[i]>c_mags[i-1] && c_mags[i]>c_mags[i+1] && c_mags[i]>c_mags[i-2] && c_mags[i]>c_mags[i+2] && c_mags[i]>peakthreshold)
+		{
+			numpeaks++;
+			peak_locations[numpeaks]=(float) i;
+			
+		}
+		
+		
+	}
+	return numpeaks;
+}
 
 bool transient_detect(float* L_mags, float* R_mags, float* pL_mags, float* pR_mags, float drumthresh, float framesize)
 {
@@ -358,7 +406,7 @@
 	for (int f = 0; f<(framesize/2); f++)
 	{
 		
-			if	((R_mags[f]-pR_mags[f])>0 &&
+			if	((R_mags[f]-pR_mags[f])>0 ||
 				(L_mags[f]-pL_mags[f])>0){trans++;}
 				
 				
@@ -378,53 +426,380 @@
 	else{return false;}
 }
 
-void sintable(float* sinewave, float length, float sr)
+
+
+
+
+void log10plot(float* L_mags, float* plotFFTarray, int framesize, int plotsize)
 {
-	double pi=3.14179;
-	double time;
-	double amp, freq;
+	float interpfactor1 = 10/100;	//1 - 100hz		bin 1 - 10
+	float interpfactor2 = 90/100;	//100 - 1000hz		bin 10 - 100
+	float interpfactor3 = 900/100;	//1000 - 10000hz		bin 100 - 1000
+	float interpfactor4 = 1048/100;	//10000 - 20000hz			bin 1000 - 2048
+	int temp;
+	int i;
+	float p;
+	float ratio,dec;
 	
-	for (int i = 0; i<sr; i++)
+	for (i=0 ; i<plotsize/4; i++)
+	{
+		p=(float) i;
+		
+		temp=(int) floor((((1+p)/100)*9)+1);
+		ratio=((((1+p)/100)*9)+1)-floor((float) temp);
+		
+		plotFFTarray[i]=log((((L_mags[temp+1]-L_mags[temp])*ratio)+L_mags[temp])/1000);
+		//plotFFTarray[i]=dec*plotFFTarray[i]+0.5*log((((L_mags[temp+1]-L_mags[temp])*ratio)+L_mags[temp])/1000);
+	}
 
+	for (i=plotsize/4 ; i<(plotsize/4)*2; i++)
 	{
-		time=double(i*(1/sr));
-		sinewave[i]=(amp)*(cos(2*pi*freq*(time)));
+		p=(float) i;
+		temp= (int) floor((((1+p-plotsize/4)/100)*90)+10);
+		plotFFTarray[i]=log(L_mags[temp]/1000);
+		//plotFFTarray[i]=dec*plotFFTarray[i]+0.5*log(L_mags[temp]/1000);
+	}
+
+	for (i=(plotsize/4)*2 ; i<(plotsize/4)*3; i++)
+	{
+		p=(float) i;
+		temp=(int) floor((((1+p-(plotsize/4)*2)/100)*900)+100);
+		
+		plotFFTarray[i]=log(L_mags[temp]/1000);
+		//plotFFTarray[i]=dec*plotFFTarray[i]+0.5*log(L_mags[temp]/1000);
+	}
+
+	for (i=(plotsize/4)*3 ; i<(plotsize/4)*4; i++)
+	{
+		p=(float) i;
+		temp=(int) floor((((1+p-(plotsize/4)*3)/100)*1048)+1000);
+		
+		plotFFTarray[i]=log(L_mags[temp]/1000);
+		//plotFFTarray[i]=dec*plotFFTarray[i]+0.5*log(L_mags[temp]/1000);
 	}
 }
 
-void cur2last(float* c_phase, float* c_synthphase, float* p_synthphase, int framesize)
+
+void log10plot2(float* L_mags, float* plotFFTarray, int framesize, int plotsize)
 {
+	float interpfactor1 = 10/100;	//1 - 100hz		bin 1 - 10
+	float interpfactor2 = 90/100;	//100 - 1000hz		bin 10 - 100
+	float interpfactor3 = 900/100;	//1000 - 10000hz		bin 100 - 1000
+	float interpfactor4 = 1048/100;	//10000 - 20000hz			bin 1000 - 2048
+	int temp;
+	int i;
+	float p;
+	float ratio,dec;
 
-for (int i=0; i<framesize/2; i++)
+	
+		
+	for (i=0 ; i<plotsize/4; i++)
+	{
+		p=(float) i;
+		
+		temp=(int) floor((((1+p)/100)*9)+1);
+		ratio=((((1+p)/100)*9)+1)-floor((float) temp);
+		
+		
+		plotFFTarray[i]=((((L_mags[temp+1]-L_mags[temp])*ratio)+L_mags[temp]));
+		//plotFFTarray[i]=dec*plotFFTarray[i]+0.5*log((((L_mags[temp+1]-L_mags[temp])*ratio)+L_mags[temp])/1000);
+	}
+
+	for (i=plotsize/4 ; i<(plotsize/4)*2; i++)
+	{
+		p=i;
+		temp=floor((((1+p-plotsize/4)/100)*90)+10);
+		plotFFTarray[i]=(L_mags[temp]);
+		//plotFFTarray[i]=dec*plotFFTarray[i]+0.5*log(L_mags[temp]/1000);
+	}
+
+	for (i=(plotsize/4)*2 ; i<(plotsize/4)*3; i++)
+	{
+		p=i;
+		temp=floor((((1+p-(plotsize/4)*2)/100)*900)+100);
+		
+		plotFFTarray[i]=(L_mags[temp]);
+		//plotFFTarray[i]=dec*plotFFTarray[i]+0.5*log(L_mags[temp]/1000);
+	}
+
+	for (i=(plotsize/4)*3 ; i<(plotsize/4)*4; i++)
+	{
+		p=i;
+		temp=floor((((1+p-(plotsize/4)*3)/100)*1048)+1000);
+		
+		plotFFTarray[i]=(L_mags[temp]);
+		//plotFFTarray[i]=dec*plotFFTarray[i]+0.5*log(L_mags[temp]/1000);
+	}
+}
+
+void applyEQ(float* L_mags, float* R_mags, int framesize, int plotsize, QVector<int> eqcurve)
+{
+	//(80,85,400,120,0) Screen Coordinates
+	float gain, interpfactor, p,result;
+	int i, ind;
+
+	for(i=0; i<10; i++)
+	{
+		gain=(110-(eqcurve.at(i*10)-85))/120;  // eqcurve is the array filled when the user draws on the canvas
+		if (gain < 0){gain=0;}
+		L_mags[i]*=gain;
+		R_mags[i]*=gain;
+			
+	}
+
+	for(i=10; i<100; i++)
 	{
 		
-		c_synthphase[i]=c_phase[i];
-						
-		p_synthphase[i]=c_synthphase[i];
+		p=i;
+		interpfactor=1.1;
+		result=100+((interpfactor*(p-10)));
+		ind=int(result);
+		gain=(110-(eqcurve.at(ind)-85))/120;
+		//gain=(110-(eqcurve[i+90]-85))/120;
+		
+		if (gain < 0){gain=0;}
+		L_mags[i]*=gain;
+		R_mags[i]*=gain;
+			
+			
+
 	}
 
+	for(i=100; i<1000; i++)
+	{
+		p=i;
+		interpfactor=0.11;
+		result=200+((interpfactor*(p-100)));
+		ind=int(result);
+		gain=(110-(eqcurve.at(ind)-85))/120;
+		if (gain < 0){gain=0;}
+		L_mags[i]*=gain;
+		R_mags[i]*=gain;
+			
+			
+
+	}
+	
+	for(i=1000; i<2048; i++)
+	{
+		p=i;
+		interpfactor=.09;
+		result=300+((interpfactor*(p-1000)));
+		ind=int(result);
+		gain=(110-(eqcurve.at(ind)-85))/120;
+		if (gain < 0){gain=0;}
+		L_mags[i]*=gain;
+		R_mags[i]*=gain;
+			
+			
+
+	}
+}
+
+
+
+void stereo2ms(float* left, float* right, int framesize)
+{
+	float m, s;
+	for (int i=0;i<framesize;i++)
+	{
+		m=(left[i]+right[i])/2;
+		s=(left[i]-right[i])/2;
+		left[i]=m;
+		right[i]=s;
+	}
+}
+
+void ms2stereo(float* left, float* right, int framesize)
+{
+	float m, s;
+	for (int i=0;i<framesize;i++)
+	{
+		m=(left[i]+right[i]);
+		s=(left[i]-right[i]);
+		left[i]=m;
+		right[i]=s;
+	}
+}
+
+
+void bandeq(float* L_mags, float* R_mags, int gainband1, int gainband2, int gainband3, int gainband4, int gainband5, float* bandcurve, int framesize)
+{
+	float maxcut=190; //18db of attenuation
+	float inc_cut=(1-(1/maxcut))/100;
+	
+	float maxboost=2; //6 db of gain
+	float inc_boost=(maxboost-1)/100;
+	float g1=1,g2=1,g3=1,g4=1,g5=1,instgain=1;
+
+	if (gainband1 < 0){g1=(1/maxcut)+((100+ (float)gainband1)*inc_cut);} //not finished!!!!
+	if (gainband1 == 0){g1=1;}
+	if (gainband1 > 0){g1=1+(((float)gainband1)*inc_boost);}
+	//cout(g1);
+	if (gainband2 < 0){g2=(1/maxcut)+((100+ (float)gainband2)*inc_cut);} //not finished!!!!
+	if (gainband2 == 0){g2=1;}
+	if (gainband2 > 0){g2=1+(((float)gainband2)*inc_boost);}
+
+	if (gainband3 < 0){g3=(1/maxcut)+((100+ (float)gainband3)*inc_cut);} //not finished!!!!
+	if (gainband3 == 0){g3=1;}
+	if (gainband3 > 0){g3=1+(((float)gainband3)*inc_boost);}
+
+	if (gainband4 < 0){g4=(1/maxcut)+((100+ (float)gainband4)*inc_cut);} //not finished!!!!
+	if (gainband4 == 0){g4=1;}
+	if (gainband4 > 0){g4=1+(((float)gainband4)*inc_boost);}
+
+	if (gainband5 < 0){g5=(1/maxcut)+((100+ (float)gainband5)*inc_cut);} //not finished!!!!
+	if (gainband5 == 0){g5=1;}
+	if (gainband5 > 0){g5=1+(((float)gainband5)*inc_boost);}
+
+
+	for (int i=0;i<framesize/2;i++)
+	{
+		instgain=(g1*band1[i])+(g2*band2[i])+(g3*band3[i])+(g4*band4[i])+(g5*band5[i]);
+		bandcurve[i]=instgain;
+		L_mags[i]*=instgain;
+		R_mags[i]*=instgain;	
+	}
+
+
+
 
 }
 
 
-int findpeaks(float* c_mags, float* p_mags, float framesize, float* peak_locations)
+void create_filterbands(int framesize)
 
 {
-	numpeaks=0;
-	peak_locations[0]=0;
-	float peakthreshold=0;
+	float binwidth = 44100/4096;
+	
+	float xover1 = 80; //100
+	float xover2 = 700; //700
+	float xover3 = 3000; //3000
+	float xover4 = 9000; //9000
 
-	for (int i=2; i<(framesize/2)-2; i++)
+	float width1 = 50; //50
+	float width2 = 300; //100
+	float width3 = 3000; //300
+	float width4 = 1900; //900
+
+	int w;
+
+	xover1=(xover1/binwidth);
+	xover2=(xover2/binwidth);
+	xover3=(xover3/binwidth);
+	xover4=(xover4/binwidth);
+
+	width1=(width1/binwidth);
+	width2=(width2/binwidth);
+	width3=(width3/binwidth);
+	width4=(width4/binwidth);
+
+	int p1 = 0;
+	int p2 = floor(xover1-(width1/2));
+	int p3 = floor(xover1+(width1/2));
+	int p4 = floor(xover2-(width2/2));
+	int p5 = floor(xover2+(width2/2));
+	int p6 = floor(xover3-(width3/2));
+	int p7 = floor(xover3+(width3/2));
+	int p8 = floor(xover4-(width4/2));
+	int p9 = floor(xover4+(width4/2));
+	int p10 = 2048;
+
+	
+	//cout(p1);
+	
+	for (int i=0;i<framesize/2;i++)
 	{
+		if (i < p2)
+		{
+			band1[i]=1;
+			band2[i]=0;
+			band3[i]=0;
+			band4[i]=0;
+			band5[i]=0;
+		}
+
+		if (i >= p2 && i <= p3)
+		{	
+			w = p3-p2+1;
+			band1[i]= (0.5*(1-cos(2*PI*((i-p2+w)+1)/((2*w)))));
+			band2[i]= (0.5*(1-cos(2*PI*((i-p2)+1)/((2*w)))));
+			band3[i]=0;
+			band4[i]=0;
+			band5[i]=0;
+		}
+
+
+		if (i > p3 && i < p4)
+		{
+			band1[i]=0;
+			band2[i]=1;
+			band3[i]=0;
+			band4[i]=0;
+			band5[i]=0;
+		}
+
+		if (i >= p4 && i <= p5)
+		{	
+			w = p4-p5+1;
+			band1[i]=0;
+			band2[i]= (0.5*(1-cos(2*PI*((i-p4+w)+1)/((2*w)))));
+			band3[i]= (0.5*(1-cos(2*PI*((i-p4)+1)/((2*w)))));
+			band4[i]=0;
+			band5[i]=0;
+		}
+
+		if (i > p5 && i < p6)
+		{
+			band1[i]=0;
+			band2[i]=0;
+			band3[i]=1;
+			band4[i]=0;
+			band5[i]=0;
+		}
+
+		if (i >= p6 && i <= p7)
+		{	
+			w = p6-p7+1;
+			band1[i]=0;
+			band2[i]=0;
+			band3[i]= (0.5*(1-cos(2*PI*((i-p6+w)+1)/((2*w)))));
+			band4[i]= (0.5*(1-cos(2*PI*((i-p6)+1)/((2*w)))));
+			band5[i]=0;
+		}
+
+		if (i > p7 && i < p8)
+		{
+			band1[i]=0;
+			band2[i]=0;
+			band3[i]=0;
+			band4[i]=1;
+			band5[i]=0;
+		}
+
+		if (i >= p8 && i <= p9)
+		{	
+			w = p8-p9+1;
+			band1[i]=0;
+			band2[i]=0;
+			band3[i]=0;
+			band4[i]= (0.5*(1-cos(2*PI*((i-p8+w)+1)/((2*w)))));
+			band5[i]= (0.5*(1-cos(2*PI*((i-p8)+1)/((2*w)))));
 		
-		if(c_mags[i]>c_mags[i-1] && c_mags[i]>c_mags[i+1] && c_mags[i]>c_mags[i-2] && c_mags[i]>c_mags[i+2] && c_mags[i]>peakthreshold)
+		}
+	
+		if (i > p9 && i < p10)
 		{
-			numpeaks++;
-			peak_locations[numpeaks]=i;
-			
+			band1[i]=0;
+			band2[i]=0;
+			band3[i]=0;
+			band4[i]=0;
+			band5[i]=1;
 		}
-		
-		
+
 	}
-	return numpeaks;
-}
+
+	
+	
+	
+}
\ No newline at end of file
--- a/sv/filter/DSP.h	Fri Feb 29 11:08:09 2008 +0000
+++ b/sv/filter/DSP.h	Wed Mar 05 14:08:57 2008 +0000
@@ -12,6 +12,8 @@
 	License, or (at your option) any later version.  See the file    
 	COPYING included with this distribution for more information.
 */
+
+#include <QVector>
 
 #define PI 3.14179
 
@@ -23,27 +25,36 @@
 
 void hanning(float* window, int framesize);
 
-//This function is the standard phase vocoder propagation technique using the hetrodyned phase increment.
-//The previous frame and phases is always assumed to be the last 'current' frame. This is fine in when the TSM factor is 
-//is not changed. If you change the TSM factor the instantaneous frequency estimates will be wrong since the actual difference 
-//in time between the 2 analysis frames will have changed when the factor changed. This will propagate a phase error 
 void updatephases(float* c_phase,float* p_phase,float* c_synthphase, float* p_synthphase, int framesize,float hopfactor,float interpfactor);
 
-//This function is almost identical to updatephases(). The only difference is that automatically resets the current synthesis phases 
-//to the analysis phases when any change in TSM is invoked. This inhibits the projection of the phase error
-//but causes some grinding on whenever the TSM slider is tweeked.
 void updatephases2(float* c_phase,float* p_phase,float* c_synthphase, float* p_synthphase, int framesize,float hopfactor,float interpfactor);
 
-
-void rotatephases_peaklocked(float* c_phase, float* p_phase, float* c_synthphase, float* p_synthphase, int framesize, float interpfactor);
-
 void rotatephases(float* c_phase, float* p_phase, float* c_synthphase, float* p_synthphase, int framesize, float interpfactor);
 
+void rotatephases_peaklocked(float* c_phase, float* p_phase, float* c_synthphase, float* p_synthphase, float* cmags, int framesize, float interpfactor);
+
+void cur2last(float* c_phase, float* c_synthphase, float* p_synthphase, int framesize);
+
+int findpeaks(float* c_mags, float* p_mags, float framesize, float* peak_locations);
+
+//void batchADRess();
+
+//void ADRess(float* L_mags, float* L_phase, float* R_mags, float* R_phase, float azimuthvalue, float range, float cutfreq, float bleedthresh, int framesize, bool softbypass);
 
 bool transient_detect(float* L_mags, float* R_mags, float* pL_mags, float* pR_mags, float drumthresh, float framesize);
 
 void sintable(float* sinewave, float length, float sr);
 
-void cur2last(float* c_phase, float* c_synthphase, float* p_synthphase, int framesize);
+void log10plot(float* L_mags, float* plotFFTarray, int framesize, int plotsize);
 
-int findpeaks(float* c_mags, float* p_mags, float framesize, float* peak_locations);
\ No newline at end of file
+void log10plot2(float* L_mags, float* plotFFTarray, int framesize, int plotsize);
+
+void applyEQ(float* L_mags, float* R_mags, int framesize, int plotsize, QVector<int> eqcurve);
+
+void stereo2ms(float* left, float* right, int framesize);
+
+void ms2stereo(float* left, float* right, int framesize);
+
+void bandeq(float* L_mags, float* R_mags, int gainband1, int gainband2, int gainband3, int gainband4, int gainband5, float* bandcurve, int framesize);
+
+void create_filterbands(int framesize);
--- a/sv/filter/EqualizerFilter.cpp	Fri Feb 29 11:08:09 2008 +0000
+++ b/sv/filter/EqualizerFilter.cpp	Wed Mar 05 14:08:57 2008 +0000
@@ -27,15 +27,24 @@
 #include "system/System.h"
 #include "main/MainWindow.h"
 
+
 EqualizerFilter::EqualizerFilter() : PropertyContainer()
 {
 	setObjectName("Equalizer");
 
-	setFilterEnabled(false);
+	for(int i = 0 ; i < 400 ; i++){
+		m_eqcurve.push_back(0);
+	}
+
+	m_curve = (float *) calloc(400, sizeof(float));
+
+	setFilterEnabled(false);		
 }
 
 EqualizerFilter::~EqualizerFilter()
-{}
+{
+	m_eqcurve.clear();
+}
 
 EqualizerFilter::PropertyList EqualizerFilter::getProperties() const
 {
@@ -109,6 +118,18 @@
 
 }
 
+void EqualizerFilter::setProperty(const PropertyName &name , QVector<int> value)
+{
+	if (name == "Equalizer"){
+		m_eqcurve.clear();
+		for (int i = 0; i < value.size(); i++)
+		{
+			//if (i < m_eqcurve.size())
+			m_eqcurve.push_back(value.at(i));
+		}
+	}
+}
+
 void EqualizerFilter::setFilterEnabled(bool b){
 	m_enabled=b;
 	emit filterEnabled(m_enabled);
@@ -119,4 +140,10 @@
 	emit filterEnabled(m_enabled);
 }
 
-
+void EqualizerFilter::emitPlotFFTArray(float *signal, int framesize)
+{
+	log10plot(signal, m_curve, framesize, m_eqcurve.size());	
+
+	emit signalChanged(m_curve);	
+}
+	
\ No newline at end of file
--- a/sv/filter/EqualizerFilter.h	Fri Feb 29 11:08:09 2008 +0000
+++ b/sv/filter/EqualizerFilter.h	Wed Mar 05 14:08:57 2008 +0000
@@ -21,6 +21,8 @@
 
 #include "base/PropertyContainer.h"
 
+typedef QVector<int> VectorOfInt;
+
 class EqualizerFilter : public PropertyContainer
 {
 	Q_OBJECT
@@ -42,18 +44,29 @@
 					  int value) const;
 
 	virtual void setProperty(const PropertyName &, int value);
+	virtual void setProperty(const PropertyName &, QVector<int> value);
 
 	inline bool isEnabled() {return m_enabled;}
 
+	inline bool bypass() {return !m_enabled;}
+	
+	inline QVector<int> curve() {return m_eqcurve;}
+	
+	void emitPlotFFTArray(float *signal, int framesize);
+
 signals: 
 	void filterEnabled(bool);
-
+	void signalChanged(float *);
+	
 public slots :
 	void setFilterEnabled(bool b);
 	void setFilterEnabled(int b);
-
+	
 protected:
 	
+	QVector<int> m_eqcurve;
+	float* m_curve;
+	
 	bool m_enabled;
 
 };
--- a/sv/filter/MultiRealTimeFilter.cpp	Fri Feb 29 11:08:09 2008 +0000
+++ b/sv/filter/MultiRealTimeFilter.cpp	Wed Mar 05 14:08:57 2008 +0000
@@ -42,10 +42,26 @@
 float *p_synthphase;
 float *synthframe;*/
 
+/* DAN removed
 float *c_mags;		///CURRENT FRAME MAGNITUDES
 float *p_mags;		///PREVIOUS FRAME MAGNITUDES
+float *FFTframe;
+*/
 
-float *FFTframe;
+// DAN added
+float *L_mags;		///CURRENT FRAME MAGNITUDES
+float *R_mags;		///CURRENT FRAME MAGNITUDES
+float *pL_mags;		///PREVIOUS FRAME MAGNITUDES
+float *pR_mags;		///PREVIOUS FRAME MAGNITUDES
+
+float *L_FFTframe;			//Left FFT Frame
+float *R_FFTframe;			//Right FFT Frame
+
+float *band1;
+float *band2;
+float *band3;
+float *band4;
+float *band5;
 
 extern float hopfactor;
 
@@ -74,29 +90,80 @@
 	connect(m_timeStretchFilter, SIGNAL(filterEnabled(bool)), this, SLOT(setFilterEnabled(bool)));
 	connect(m_equalizerFilter, SIGNAL(filterEnabled(bool)), this, SLOT(setFilterEnabled(bool)));
 
-	m_inputBuffer = (float *)calloc(m_framesize*(m_timeStretchFilter->getMaxPitchFactor()+1), sizeof(float));
+	m_inputBufferL = (float *)calloc(m_framesize*(m_timeStretchFilter->getMaxPitchFactor()+1), sizeof(float));
+	m_inputBufferR = (float *)calloc(m_framesize*(m_timeStretchFilter->getMaxPitchFactor()+1), sizeof(float));
+	/**********malloc***********/
 	
-	/**********malloc***********/
-	FFTframe=(float *)calloc((m_framesize), sizeof(float));
+		
+	//This block specifically sets up the buffers required to do a 75% overlap scheme
+	window=(float *)calloc((m_framesize), sizeof(float));				//Window	
+	
+	L_FFTframe=(float *)calloc((m_framesize), sizeof(float));
+	R_FFTframe=(float *)calloc((m_framesize), sizeof(float));
+		
+	L_audioframe=(float *)calloc((m_framesize), sizeof(float));			//The current frame
+	R_audioframe=(float *)calloc((m_framesize), sizeof(float));
+	pL_audioframe=(float *)calloc((m_framesize), sizeof(float));		//
+	pR_audioframe=(float *)calloc((m_framesize), sizeof(float));
+	L_processedframe=(float *)calloc((m_framesize), sizeof(float));	//The current frame
+	R_processedframe=(float *)calloc((m_framesize), sizeof(float));
+	
+	//FFTframe=(float *)calloc((m_framesize), sizeof(float));
+	//audioframe=(float *)calloc((m_framesize), sizeof(float));			//The current frame
+	//prev_audioframe=(float *)calloc((m_framesize), sizeof(float));
+	//processedframe=(float *)calloc((m_framesize), sizeof(float));			//The current frame
+	//synthframe=(float *)calloc((m_framesize), sizeof(float));
+	
+	L_outbuffer=(float *)calloc((m_framesize/4), sizeof(float));		//The current output segment which is 1/4 framesize for 75% overlap
+	L_holdbuffer3=(float *)calloc((m_framesize*0.75), sizeof(float));	//The hold buffer for the previous frame segment
+	L_holdbuffer2=(float *)calloc((m_framesize/2), sizeof(float));		//The fold buffer for the frame segment 2 frames ago
+	L_holdbuffer1=(float *)calloc((m_framesize/4), sizeof(float));		//The fold buffer for the frame segment 3 frames ago
 			
-	//This block specifically sets up the buffers required to do a 75% overlap scheme
-	audioframe=(float *)calloc((m_framesize), sizeof(float));			//The current frame
-	prev_audioframe=(float *)calloc((m_framesize), sizeof(float));
-	window=(float *)calloc((m_framesize), sizeof(float));				//Window
-	processedframe=(float *)calloc((m_framesize), sizeof(float));			//The current frame
-	synthframe=(float *)calloc((m_framesize), sizeof(float));
+	R_outbuffer=(float *)calloc((m_framesize/4), sizeof(float));			//The current output segment which is 1/4 framesize for 75% overlap
+	R_holdbuffer3=(float *)calloc((m_framesize*0.75), sizeof(float));	//The hold buffer for the previous frame segment
+	R_holdbuffer2=(float *)calloc((m_framesize/2), sizeof(float));		//The fold buffer for the frame segment 2 frames ago
+	R_holdbuffer1=(float *)calloc((m_framesize/4), 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));
+	*/
 
+	L_mags=(float *)calloc((m_framesize/2), sizeof(float));			//The magnitude and phase arrays
+	R_mags=(float *)calloc((m_framesize/2), sizeof(float));
+	L_phase=(float *)calloc((m_framesize/2), sizeof(float));
+	R_phase=(float *)calloc((m_framesize/2), sizeof(float));
+	pL_mags=(float *)calloc((m_framesize/2), sizeof(float));			//The magnitude and phase arrays
+	pR_mags=(float *)calloc((m_framesize/2), sizeof(float));
+	pL_phase=(float *)calloc((m_framesize/2), sizeof(float));			//The magnitude and phase arrays
+	pR_phase=(float *)calloc((m_framesize/2), sizeof(float));
+	cL_synthphase=(float *)calloc((m_framesize/2), sizeof(float));
+	cR_synthphase=(float *)calloc((m_framesize/2), sizeof(float));
+	pL_synthphase=(float *)calloc((m_framesize/2), sizeof(float));
+	pR_synthphase=(float *)calloc((m_framesize/2), sizeof(float));
+	
+	/*
 	c_mags=(float *)calloc((m_framesize/2), sizeof(float));			//The magnitude and phase arrays
 	p_mags=(float *)calloc((m_framesize/2), sizeof(float));
 	c_phase=(float *)calloc((m_framesize/2), sizeof(float));
 	p_phase=(float *)calloc((m_framesize/2), sizeof(float));
 	c_synthphase=(float *)calloc((m_framesize/2), sizeof(float));
 	p_synthphase=(float *)calloc((m_framesize/2), sizeof(float));
+	*/
+
+	band1=(float *)calloc((m_framesize/2), sizeof(float));
+	band2=(float *)calloc((m_framesize/2), sizeof(float));
+	band3=(float *)calloc((m_framesize/2), sizeof(float));
+	band4=(float *)calloc((m_framesize/2), sizeof(float));
+	band5=(float *)calloc((m_framesize/2), sizeof(float));
+
+			
+	bandcurve=(float *)calloc((m_framesize/2), sizeof(float));
+	plotFFTarray=(float *)calloc((400), sizeof(float));
+	plotbandcurve=(float *)calloc((400), sizeof(float));
+	//eqcurve=(float *)calloc((400), sizeof(float));
 
 	peak_locations=(float *)calloc((m_framesize/2), sizeof(float));
 
@@ -112,29 +179,79 @@
 MultiRealTimeFilter::~MultiRealTimeFilter()
 {
 	/**********de-alloc***********/
-	delete m_inputBuffer;
-	delete FFTframe;
+	delete m_inputBufferL;
+	delete m_inputBufferR;
+	delete L_mags;		///CURRENT FRAME MAGNITUDES
+	delete R_mags;		///CURRENT FRAME MAGNITUDES
+	delete pL_mags;		///PREVIOUS FRAME MAGNITUDES
+	delete pR_mags;		///PREVIOUS FRAME MAGNITUDES
+
+	delete L_FFTframe;			//Left FFT Frame
+	delete R_FFTframe;
+	
+	
+	//delete FFTframe;
 			
+	delete L_audioframe;		//
+	delete R_audioframe;		//
+	delete pL_audioframe;		//
+	delete pR_audioframe;		//
+	delete L_processedframe;	//
+	delete R_processedframe;
+	
+	/* DAN Removed
 	delete audioframe;		
 	delete prev_audioframe;
-	delete window;			
 	delete processedframe;	
 	delete synthframe;
-			
 	delete holdbuffer3;
 	delete holdbuffer2;
 	delete holdbuffer1;
-			
+	delete outbuffer;
+	*/
+	
+	delete window;		
+	
+	delete L_outbuffer;
+	delete L_holdbuffer3;
+	delete L_holdbuffer2;
+	delete L_holdbuffer1;
+	delete R_outbuffer;
+	delete R_holdbuffer3;
+	delete R_holdbuffer2;
+	delete R_holdbuffer1;
+	
+	/*
 	delete c_mags;
 	delete p_mags;
 	delete c_phase;
 	delete p_phase;
 	delete c_synthphase;
-	delete p_synthphase;
+	delete p_synthphase;*/
+
+	delete L_phase;		
+	delete R_phase;		
+	delete pL_phase;		
+	delete pR_phase;		
+	delete cL_synthphase;
+	delete cR_synthphase;
+	delete pL_synthphase;
+	delete pR_synthphase;
 
 	delete peak_locations;
 
-	delete outbuffer;	
+	delete band1;
+	delete band2;
+	delete band3;
+	delete band4;
+	delete band5;
+
+	delete bandcurve;
+	delete plotbandcurve;
+	//delete eqcurve;
+	delete plotFFTarray; 
+
+		
 
 	hopfactor = 1;
 
@@ -160,13 +277,21 @@
 
 	int channel = getSourceChannelCount();
 
+	
+	
 	for (int i=0; i< ((int) samples); i++){
 		if (channel > 1)
-			m_inputBuffer[i] = input[0][i];// + input[1][i]) /2;
-		else
-			m_inputBuffer[i] = input[0][i];
+		{
+			m_inputBufferL[i] = input[0][i];	//real-time biffer taken from left ring buffer
+			m_inputBufferR[i] = input[1][i];	//real-time biffer taken from right ring buffer
+		} else {
+			m_inputBufferL[i] = input[0][i];	//If file is mono we copy same channel into both buffers into both buffers
+			m_inputBufferR[i] = input[0][i];
+		}
 	}
 	
+	
+	
 	for (int i = 0; i< ((int) m_framesize); i++)
 	{
 			
@@ -174,100 +299,179 @@
 		//if it's not being used the audioframe line after the else should be used which is also used in bypass mode
 		//At
 		
-		if (m_timeStretchFilter->bypass() == false) {
+		if (m_timeStretchFilter->bypass() == false) 
+		{
 			dd = floor(double(i*m_timeStretchFilter->getPitchFactor()));
 			difratio = (double(i*m_timeStretchFilter->getPitchFactor())) - floor(double(i*m_timeStretchFilter->getPitchFactor()));
 			
 			// this block loads a frame as normal
-			sampdiff=m_inputBuffer[dd+delta+1]-m_inputBuffer[dd+delta];
-			interpsample = (difratio*sampdiff)+m_inputBuffer[dd+delta];
-			audioframe[i] = interpsample*window[i];
+			sampdiff=m_inputBufferL[dd+delta+1]-m_inputBufferL[dd+delta];
+			interpsample = (difratio*sampdiff)+m_inputBufferL[dd+delta];
+			L_audioframe[i] = interpsample*window[i];
 
-			sampdiff=m_inputBuffer[dd+delta+1-m_hop]-m_inputBuffer[dd+delta-m_hop];
-			interpsample = (difratio*sampdiff)+m_inputBuffer[dd+delta-m_hop];
-			prev_audioframe[i] = interpsample*window[i];
+			sampdiff=m_inputBufferL[dd+delta+1-m_hop]-m_inputBufferL[dd+delta-m_hop];
+			interpsample = (difratio*sampdiff)+m_inputBufferL[dd+delta-m_hop];
+			pL_audioframe[i] = interpsample*window[i];
+
+
+			sampdiff=m_inputBufferR[dd+delta+1]-m_inputBufferR[dd+delta];
+			interpsample = (difratio*sampdiff)+m_inputBufferR[dd+delta];
+			R_audioframe[i] = interpsample*window[i];
+
+			sampdiff=m_inputBufferR[dd+delta+1-m_hop]-m_inputBufferR[dd+delta-m_hop];
+			interpsample = (difratio*sampdiff)+m_inputBufferR[dd+delta-m_hop];
+			pR_audioframe[i] = interpsample*window[i];
+
 		}
 		else {
-			audioframe[i] = m_inputBuffer[i+delta+1]*window[i];
-			processedframe[i] = audioframe[i]*window[i];
+			L_audioframe[i] = m_inputBufferL[i+delta+1]*window[i];
+			R_audioframe[i] = m_inputBufferR[i+delta+1]*window[i];
+			
+			L_processedframe[i] = L_audioframe[i]*window[i];
+			R_processedframe[i] = R_audioframe[i]*window[i];
+			
 		}
 	}
 	
 	FFTReal fft_object(m_framesize);
 			
-	if (m_timeStretchFilter->bypass() == false)
+	if (m_timeStretchFilter->bypass() == false)//DAN This bypass would stop all processing...need to replace this with a master bypass instead of just timestretch bypass
+	//if (filterEnabled)
 	{ 
-		fft_object.do_fft(FFTframe,audioframe);
+		
+		//CURRENT FRAME LEFT AND RIGHT TIME 2 FREQUENCY ***** THIS IS REQUIRED BY ALL PROCESSES	
+		fft_object.do_fft(L_FFTframe,L_audioframe);
+		fft_object.do_fft(R_FFTframe,R_audioframe);
 	
-		cart2pol(FFTframe, c_mags, c_phase, m_framesize);
+		cart2pol(L_FFTframe, L_mags, L_phase, m_framesize);
+		cart2pol(R_FFTframe, R_mags, R_phase, m_framesize);
 
+		//CURRENT FRAME LEFT AND RIGHT TIME 2 FREQUENCY ***** THIS IS REQUIRED BY ALL PROCESSES	
+		fft_object.do_fft (L_FFTframe,pL_audioframe);
+		fft_object.do_fft (R_FFTframe,pR_audioframe);
+
+		cart2pol(L_FFTframe, pL_mags, pL_phase, m_framesize);
+		cart2pol(R_FFTframe, pR_mags, pR_phase, m_framesize);
+		
 		//--------------------------------------------
-	
-		fft_object.do_fft(FFTframe,prev_audioframe);
+		
+		
+		//EQUALISER CALLS - 
+		//Will need a bypass " m_equalizerFilter->bypass()" as below
+		//Will need a simplemode " m_equalizerFilter->simplemode_bypass() " to switch between draw and slider control
+		if (m_equalizerFilter->bypass() == false)
+		{
+		
+			/*if (m_equalizerFilter->simplemode_bypass() == false)
+			{
+				create_filterbands();	//Creates each filter band and creates "bandcurve"
+				bandeq(L_mags, R_mags, gainband1, gainband2, gainband3, gainband4, gainband5, bandcurve); //Gainband 1 - 5 values from EQ sliders
+				log10plot2(bandcurve,plotbandcurve, m_framesize, 400);	//Converts linear band curve to log band curve only for plot
+			}
+			else
+			{*/
+				applyEQ(L_mags, R_mags, m_framesize, m_equalizerFilter->curve().size(), m_equalizerFilter->curve()); //Takes "eqcurve" which is what user draws in advanced mode 
+			//}
 
-		cart2pol(FFTframe, p_mags, p_phase, m_framesize);
+			m_equalizerFilter->emitPlotFFTArray(L_mags, m_framesize);
+			//log10plot(L_mags,plotFFTarray, m_framesize, 400);	//Plots FFT for either eq 
 		
-		drum = transient_detect(c_mags, c_mags, p_mags, p_mags, drumthresh, m_framesize);
-	
-	
-		if (m_timeStretchFilter->transcheck())
+		}
+				
+		if (m_timeStretchFilter->bypass() == false) 
 		{
-	
-			if (drum && m_transhold==0){
-				cur2last(c_phase, c_synthphase, p_synthphase, m_framesize);
-				m_transhold=4;
-			}
-			else{
-				if(m_timeStretchFilter->peakcheck()){
-					rotatephases_peaklocked(c_phase, p_phase, c_synthphase, p_synthphase, m_framesize, m_timeStretchFilter->getPitchFactor());
+			//TRANSIENT DETECTION FOR TIME STRETCHER
+			drum=transient_detect(L_mags, R_mags, pL_mags, pR_mags, drumthresh, m_framesize);
+		
+			if (m_timeStretchFilter->transcheck())
+			{
+		
+				if (drum && m_transhold==0){
+					// FOR TIME STRETCHER
+					cur2last(L_phase, cL_synthphase, pL_synthphase, m_framesize);
+					cur2last(R_phase, cR_synthphase, pR_synthphase, m_framesize);
+					
+					m_transhold=4;
 				}
 				else{
-					rotatephases(c_phase, p_phase, c_synthphase, p_synthphase, m_framesize, m_timeStretchFilter->getPitchFactor());
+					if(m_timeStretchFilter->peakcheck()){
+						// FOR TIME STRETCHER
+						rotatephases_peaklocked(L_phase, pL_phase, cL_synthphase, pL_synthphase, L_mags, m_framesize, m_timeStretchFilter->getPitchFactor());
+						rotatephases_peaklocked(R_phase, pR_phase, cR_synthphase, pR_synthphase, R_mags, m_framesize, m_timeStretchFilter->getPitchFactor());
+						
+					}
+					else{
+						// FOR TIME STRETCHER
+						rotatephases(L_phase, pL_phase, cL_synthphase, pL_synthphase, m_framesize, m_timeStretchFilter->getPitchFactor());
+						rotatephases(R_phase, pR_phase, cR_synthphase, pR_synthphase, m_framesize, m_timeStretchFilter->getPitchFactor());
+						
+					}
 				}
 			}
-		}
-		else
-		{
-			if(m_timeStretchFilter->peakcheck()){
-				rotatephases_peaklocked(c_phase, p_phase, c_synthphase, p_synthphase, m_framesize, m_timeStretchFilter->getPitchFactor());
+			else
+			{
+				if(m_timeStretchFilter->peakcheck()){
+					// FOR TIME STRETCHER
+					rotatephases_peaklocked(L_phase, pL_phase, cL_synthphase, pL_synthphase, L_mags, m_framesize, m_timeStretchFilter->getPitchFactor());
+					rotatephases_peaklocked(R_phase, pR_phase, cR_synthphase, pR_synthphase, R_mags, m_framesize, m_timeStretchFilter->getPitchFactor());
+						
+				}
+				else{
+					// FOR TIME STRETCHER
+					rotatephases(L_phase, pL_phase, cL_synthphase, pL_synthphase, m_framesize, m_timeStretchFilter->getPitchFactor());
+					rotatephases(R_phase, pR_phase, cR_synthphase, pR_synthphase, m_framesize, m_timeStretchFilter->getPitchFactor());
+				}
 			}
-			else{
-				rotatephases(c_phase, p_phase, c_synthphase, p_synthphase, m_framesize, m_timeStretchFilter->getPitchFactor());
+		
+			// FOR TIME STRETCHER
+			if(m_transhold != 0){
+				m_transhold = m_transhold - 1;
 			}
 		}
 	
-		if(m_transhold != 0){
-			m_transhold = m_transhold - 1;
-		}
-	
 		drum = 0;
 		
-		pol2cart(FFTframe, c_mags, c_synthphase, m_framesize);
 		
-		fft_object.do_ifft(FFTframe, processedframe);
-		fft_object.rescale(processedframe); //VIP######## I have edited this function to do rewindowing also######
+		
+		// INVERSE FFTS REQUIRED BY ALL PROCESSES	
+		pol2cart(L_FFTframe, L_mags, cL_synthphase, m_framesize);
+		pol2cart(R_FFTframe, R_mags, cR_synthphase, m_framesize);
+	
+		fft_object.do_ifft (L_FFTframe,L_processedframe);
+		fft_object.do_ifft (R_FFTframe,R_processedframe);
+		fft_object.rescale (L_processedframe); 
+		fft_object.rescale (R_processedframe);
+		
+		
 	}
 
 	for (int p = 0; p < ((int) m_framesize); p++){
-		processedframe[p]=processedframe[p]*window[p];
+		L_processedframe[p]=L_processedframe[p]*window[p];
+		R_processedframe[p]=R_processedframe[p]*window[p];
 	}
 	
 	for (int j = 0; j< ((int) m_framesize); j++)
 	{		
-		//This block deals with the buffers for a 75% overlap scheme		
-		
+		//This block deals with the buffers for a 75% overlap scheme AND IS NOW STEREO		
 		if (j < ((int) m_framesize)/4){
-			outbuffer[j]=(processedframe[j]+holdbuffer1[j]+holdbuffer2[j]+holdbuffer3[j])*0.5;
-			holdbuffer1[j]=holdbuffer2[j+(m_framesize/4)];
+		L_outbuffer[j]=(L_processedframe[j]+L_holdbuffer1[j]+L_holdbuffer2[j]+L_holdbuffer3[j])*0.5;
+		L_holdbuffer1[j]=L_holdbuffer2[j+(m_framesize/4)];
+
+		R_outbuffer[j]=(R_processedframe[j]+R_holdbuffer1[j]+R_holdbuffer2[j]+R_holdbuffer3[j])*0.5;
+		R_holdbuffer1[j]=R_holdbuffer2[j+(m_framesize/4)];
 		}
 
 		if (j < ((int) m_framesize)/2){
-			holdbuffer2[j]=holdbuffer3[j+(m_framesize/4)];
+		L_holdbuffer2[j]=L_holdbuffer3[j+(m_framesize/4)];
+		R_holdbuffer2[j]=R_holdbuffer3[j+(m_framesize/4)];
 		}
 
 		if (j < ((int) m_framesize)*0.75){
-			holdbuffer3[j]=processedframe[j+(m_framesize/4)];
+		L_holdbuffer3[j]=L_processedframe[j+(m_framesize/4)];
+		R_holdbuffer3[j]=R_processedframe[j+(m_framesize/4)];
 		}
+
+	
 	}
 }
 
@@ -278,12 +482,24 @@
 
 	int channel = getSourceChannelCount();
 
-	for (int ch = 0; ch < channel; ++ch) 
+	for (size_t i = 0; i < samples; ++i)		// Now that there are 2 out buffers, the output is filled according to channel count 
+	{
+			
+		output[0][i] = L_outbuffer[i];
+			
+			if (channel > 1)
+			{
+				output[1][i] = R_outbuffer[i];
+			}
+	}
+	
+	////DAN - REMOVED REPLACED ABOVE
+	/*for (int ch = 0; ch < channel; ++ch) 
 	{
 		for (size_t i = 0; i < samples; ++i) {
 			output[ch][i] = outbuffer[i];
 		}
-	}
+	}*/
 }
 
 size_t MultiRealTimeFilter::getRequiredInputSamples(size_t outputSamplesNeeded)
--- a/sv/filter/MultiRealTimeFilter.h	Fri Feb 29 11:08:09 2008 +0000
+++ b/sv/filter/MultiRealTimeFilter.h	Wed Mar 05 14:08:57 2008 +0000
@@ -53,22 +53,79 @@
 
 	int		m_transhold;
 
-	float *m_inputBuffer;
+	float *m_inputBufferL;
+	float *m_inputBufferR;
 
+	/* DAN Removed
 	float *audioframe;
 	float *prev_audioframe;
+	float *processedframe;
+	*/ 
+	
 	float *window;
-	float *processedframe;
+	
+	// DAN Added
+	float *L_audioframe;		//
+	float *R_audioframe;		//
+	float *pL_audioframe;		//
+	float *pR_audioframe;		//
+	float *L_processedframe;	//
+	float *R_processedframe;
+	
+	
+	/* DAN Removed
 	float *outbuffer;
 	float *holdbuffer3;
 	float *holdbuffer2;
 	float *holdbuffer1;
+	*/
 
+	// DAN Added
+	float *L_outbuffer;
+	float *L_holdbuffer3;
+	float *L_holdbuffer2;
+	float *L_holdbuffer1;
+	float *R_outbuffer;
+	float *R_holdbuffer3;
+	float *R_holdbuffer2;
+	float *R_holdbuffer1;
+
+	
+	float *L_phase;		///CURRENT FRAME phases
+	float *R_phase;		///CURRENT FRAME phases
+	float *pL_phase;		///PREVIOUS FRAME phases
+	float *pR_phase;		///PREVIOUS FRAME phases
+	float *cL_synthphase;
+	float *cR_synthphase;
+	float *pL_synthphase;
+	float *pR_synthphase;
+	
+	/* DAN Removed
 	float *c_phase;		///CURRENT FRAME phases
 	float *p_phase;		///PREVIOUS FRAME phases
 	float *c_synthphase;
 	float *p_synthphase;
 	float *synthframe;
+	*/
+
+	// DAN Added - Following variables for EQ tool
+	int gainband1;
+	int gainband2;
+	int gainband3;
+	int gainband4;
+	int gainband5;
+
+	/*float *band1;
+	float *band2;
+	float *band3;
+	float *band4;
+	float *band5;*/
+
+	// DAN Added - Following variables for graphical plots in EQ tool
+	float *bandcurve;
+	float *plotbandcurve;
+	//float *eqcurve;
+	float *plotFFTarray; 
 
 	TimeStretchFilter * m_timeStretchFilter;
 	EqualizerFilter *	m_equalizerFilter;
--- a/widgets/Plotter.cpp	Fri Feb 29 11:08:09 2008 +0000
+++ b/widgets/Plotter.cpp	Wed Mar 05 14:08:57 2008 +0000
@@ -20,9 +20,9 @@
 m_margin(5),
 m_curveMaskActive(false)
 {
-	m_curveMask = new int[m_signalWidth];
+	//m_curveMask = new int[m_signalWidth];
 	for(int i = 0 ; i < m_signalWidth ; i++){
-		m_curveMask[i] = 0;
+		m_curveMask.push_back(0);
 	}
 
 
@@ -43,6 +43,16 @@
 	refreshPixmap();
 }
 
+void Plotter::setCurve(float * curve)
+{
+	m_curve.clear();
+	for (int i=0; i< 400; i++)
+	{
+		m_curve.push_back(QPoint(i, curve[i]));
+	}
+	refreshPixmap();
+}
+
 void Plotter::clearCurve(){
 	m_curve.clear();
 	refreshPixmap();
@@ -135,6 +145,7 @@
 	 if ((event->button() == Qt::LeftButton) && m_curveMaskActive) {
         m_curveMaskActive = false;
         unsetCursor();
+		emit curveChanged(m_curveMask);
 	 }
 }
 
--- a/widgets/Plotter.h	Fri Feb 29 11:08:09 2008 +0000
+++ b/widgets/Plotter.h	Wed Mar 05 14:08:57 2008 +0000
@@ -33,6 +33,12 @@
 	void setSignalSize(int m_signalWidth, int m_signalHeight);
 	void setMargin(int margin);
 
+signals:
+	void curveChanged(QVector<int>&);
+
+public slots:
+	void setCurve(float *);
+
 protected:
     void paintEvent(QPaintEvent *event);
     void resizeEvent(QResizeEvent *event);
@@ -46,7 +52,7 @@
     void drawCurve(QPainter *painter);
 	void drawMaskCurve(QPainter *painter);
 	QVector<QPoint> m_curve;
-	int *m_curveMask;
+	QVector<int> m_curveMask;
     QPixmap m_pixmap;
 	int m_signalHeight;
 	int m_signalWidth;
--- a/widgets/PropertyBox.cpp	Fri Feb 29 11:08:09 2008 +0000
+++ b/widgets/PropertyBox.cpp	Wed Mar 05 14:08:57 2008 +0000
@@ -28,6 +28,7 @@
 #include "plugin/PluginXml.h"
 
 #include "main/MainWindow.h"
+#include "filter/EqualizerFilter.h"
 
 #include "AudioDial.h"
 #include "Slider.h"
@@ -573,8 +574,9 @@
         }*/
 
         if (!have) {
-			connect(cb, SIGNAL(activated(int)), this, SLOT(propertyControllerChanged(int)));
-            connect(cb, SIGNAL(mouseEntered()), this, SLOT(mouseEnteredWidget()));
+			connect(cb, SIGNAL(curveChanged(QVector<int>&)), this, SLOT(propertyControllerChanged(QVector<int>&)));
+            connect(m_container, SIGNAL(signalChanged(float*)), cb, SLOT(setCurve(float*)));
+			connect(cb, SIGNAL(mouseEntered()), this, SLOT(mouseEnteredWidget()));
             connect(cb, SIGNAL(mouseLeft()), this, SLOT(mouseLeftWidget()));
 
 			if (inGroup) {
@@ -689,6 +691,26 @@
     
     updateContextHelp(obj);
 }
+
+void
+PropertyBox::propertyControllerChanged(QVector<int> &value)
+{
+    QObject *obj = sender();
+    QString name = obj->objectName();
+
+#ifdef DEBUG_PROPERTY_BOX
+    std::cerr << "PropertyBox::propertyControllerChanged(" << name.toStdString()
+	      << ", " << value << ")" << std::endl;
+#endif
+    
+    PropertyContainer::PropertyType type = m_container->getPropertyType(name);
+
+	if (type == PropertyContainer::PlotProperty) {
+        m_container->setProperty(name, value);
+    } 
+
+    updateContextHelp(obj);
+}
     
 void
 PropertyBox::playGainChanged(float gain)
--- a/widgets/PropertyBox.h	Fri Feb 29 11:08:09 2008 +0000
+++ b/widgets/PropertyBox.h	Wed Mar 05 14:08:57 2008 +0000
@@ -57,7 +57,8 @@
 
 protected slots:
     void propertyControllerChanged(int);
-
+	void propertyControllerChanged(QVector<int>&);
+	
     void playGainChanged(float);
     void playGainDialChanged(int);
     void playPanChanged(float);