COCKOS
CONFEDERATED FORUMS
Cockos : REAPER : NINJAM : Forums
Forum Home : Register : FAQ : Members List : Search :
Old 05-06-2010, 06:27 PM   #1
metalhobo
Human being with feelings
 
Join Date: Apr 2010
Posts: 14
Default Multiple instance malfunction?

So with this plugin I'm working on, whenever I try and playback two different tracks (each with an instance of the plugin) I get some severe malfunctioning. Sometimes I just get this really weird digital chirping noise and other times I just get like a ridiculously loud output (scared the jesus outta me). Single instances of the plugin work exactly as they should; I'm at a loss here. Anybody got any ideas? Thanks.
metalhobo is offline   Reply With Quote
Old 05-06-2010, 07:23 PM   #2
Xenakios
Human being with feelings
 
Xenakios's Avatar
 
Join Date: Feb 2007
Location: Oulu, Finland
Posts: 7,921
Default

Quote:
Originally Posted by metalhobo View Post
So with this plugin I'm working on, whenever I try and playback two different tracks (each with an instance of the plugin) I get some severe malfunctioning. Sometimes I just get this really weird digital chirping noise and other times I just get like a ridiculously loud output (scared the jesus outta me). Single instances of the plugin work exactly as they should; I'm at a loss here. Anybody got any ideas? Thanks.
Check if you are using globally scoped variables or static variables. Those are the usual reasons for this "SynthEdit" kind of bug. (SynthEdit used to make every plugin made on it exhibit this bug.)

By the way, are you running the plugin on a multicore computer? If not, then the appearance of this kind of bug may be a bit more difficult to explain. The problem with the global and static variable is most likely to happen when running the code in a multithreaded host app on a multicore equipped computer.

If you confirm it is indeed global and/or static variables causing this, the fix is to not use those kinds of variables in the code. The usual solution is to put counters and similar things that need to persist their values between function/method runs as data members of a class.

edit : I by the way saw this in a code you posted in the other thread :
Code:
WDL_fft_init();
		WDL_fft(fftbuffer, fftbuffersize, false);
		//---------------------------------------
		
		
		//-- 
		for(int p = 0; p < fftbuffersize; p++)      //make quieter
			{
			fftbuffer[p].re /= (fftbuffersize);
			fftbuffer[p].im /= (fftbuffersize);
			}
		//--
You should not be initing the WDL FFT library at each buffer cycle. That won't be thread-safe and would probably be causing the problems you are experiencing. (Also it probably will be making your processing code run slower than necessary.)
__________________
For info on SWS Reaper extension plugin (including Xenakios' previous extension/actions) :
http://www.sws-extension.org/
https://github.com/Jeff0S/sws
--
Xenakios blog (about HourGlass, Paul(X)Stretch and λ) :
http://xenakios.wordpress.com/

Last edited by Xenakios; 05-06-2010 at 07:35 PM.
Xenakios is online now   Reply With Quote
Old 05-07-2010, 07:46 AM   #3
junioreq
Human being with feelings
 
junioreq's Avatar
 
Join Date: Aug 2008
Location: Buffalo NY
Posts: 1,091
Default

Yep, always global vars doing this in my past experience.
junioreq is offline   Reply With Quote
Old 05-08-2010, 09:12 PM   #4
metalhobo
Human being with feelings
 
Join Date: Apr 2010
Posts: 14
Default

No global variables, but I use quite a few static variables. I can't use static variables at all then?


Thanks for the info guys!
metalhobo is offline   Reply With Quote
Old 05-08-2010, 10:07 PM   #5
junioreq
Human being with feelings
 
junioreq's Avatar
 
Join Date: Aug 2008
Location: Buffalo NY
Posts: 1,091
Default

Post some code example, and it will be very apparent to us within seconds. You have a global in there somewhere, one plug is trying to change it, while the other is using it,then changing it lol..

~Rob.
junioreq is offline   Reply With Quote
Old 05-08-2010, 10:09 PM   #6
junioreq
Human being with feelings
 
junioreq's Avatar
 
Join Date: Aug 2008
Location: Buffalo NY
Posts: 1,091
Default

I do all my variable stuff in onparmchange:

Code:
void SimpleDelay::OnParamChange(int paramIdx) {

	SR =  this->GetSampleRate(); 	
	double lowpass =  GetParam(flowpass)->Value();

	bandFilter[1].calc_filter_coeffs(0,lowpass,SR,1,1,0); 
}
junioreq is offline   Reply With Quote
Old 05-09-2010, 12:16 AM   #7
bvesco
Human being with feelings
 
bvesco's Avatar
 
Join Date: Jun 2007
Posts: 125
Default

Quote:
Originally Posted by metalhobo View Post
No global variables, but I use quite a few static variables. I can't use static variables at all then?

Only use statics that are intended to be shared by all instances.
__________________
Audio tutorials and articles: http://www.benvesco.com/tonemonster/
My VST plugins: http://www.vescofx.com/
bvesco is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 05:58 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2019, vBulletin Solutions Inc.