Hi,
I'm not an expert by any means, but hopefully this helps....
Utilize the structure ITimeInfo in ProcessDoubleReplacing(double** inputs, double** outputs, int nFrames) to retrieve the current host tempo and compare it to a previous tempo stored in a variable. Then do whatever you want to accomplish with the new tempo.
In the private section of your main header:
Code:
double mOldTempo;
ITimeInfo mTimeInfo;
In the constructor of your Main .cpp file initialize mOldTempo with a value..
Code:
YourPlugin::YourPlugin(IPlugInstanceInfo instanceInfo)
: IPLUG_CTOR(kNumParams, kNumPrograms, instanceInfo),
mThis(1.0),
mThat(2000.),
mOldTempo(120.0),
mSomethingelse(0)
{
TRACE;//...........
In ProcessDoubleReplacing:
Code:
GetTime(&mTimeInfo);
if (GetParam(kYourSwitch)->Bool() == true) //if you want to switch temposync on and off
{
if (mOldTempo != mTimeInfo.mTempo)//compare old tempo to current tempo
{
do something tempo related;
mOldTempo = mTimeInfo.mTempo;
}
}