View Single Post
Old 06-24-2015, 02:01 AM   #24
Tale
Human being with feelings
 
Tale's Avatar
 
Join Date: Jul 2008
Location: The Netherlands
Posts: 3,007
Default

Quote:
Originally Posted by mviljamaa View Post
Changing Reapers buffer from 1024 -> 512 shifts the data[0]=0.0 point in the recording to the left by 512.
I have just tried myself, and changing REAPER's audio buffer size doesn't change the position of data[0], so your/mine/our code seems to be working fine. It does depend on clearing queues in Reset(), because else the posisiton of the first data[0] is semi-random. This is because immediately after loading your plug-in the host starts processing it, and most hosts will just keep on processing continuously, whether you start/stop playback or not. This is why you might want to clear queues on playback, but you don't need to. Note that probably not all hosts will call Reset() on playback. But I guess the exact position of data[0] samples isn't important anyway, as long as they are FFT_BUFFER_SIZE samples apart.

Quote:
Originally Posted by mviljamaa View Post
No, how to do it? I mean, what input, what output?
Code:
void MyPlug::Reset()
{
	TRACE; IMutexLock lock(this);

	// Clear input queue.
	processingBuffer.Clear();
	// Clear output queue.
	outputBuffer.Clear();
	// Pre-add silence to output queue.
	outputBuffer.Add(NULL, sizeof(double)*FFT_BUFFER_SIZE);
}

Last edited by Tale; 06-25-2015 at 04:39 PM. Reason: Fixed yet another typo... *sigh*
Tale is offline   Reply With Quote