View Single Post
Old 09-03-2020, 11:59 AM   #11
Human being with feelings
Join Date: Apr 2018
Posts: 354

Originally Posted by Tale View Post
BTW, is this with a stock ISwitchControl, or a control derived from ISwitchControl? How many states does the switch have?
Yes, stock ISwitchControl with 2 states (On/Off). When Pro Tool's transport is running the control's VALUE toggles but the bitmap sometimes does not causing it to become out of sync. When transport is paused the control works perfectly every time.

       GetParam(kProcessControl)->InitBool("Effect", Process, "Process");
       bitmap = pGraphics->LoadIBitmap(PROCESSBTN_ID, PROCESSBTN_FN, kBtnFrames);
       mProcessControlIdx = new ISwitchControl(this, 297, 69, kProcessControl, &bitmap);
       GetParam(kProcessControl)->SetDisplayText(0, "Bypass");
       GetParam(kProcessControl)->SetDisplayText(1, "Process");
case kProcessControl:
	Process = GetParam(kProcessControl)->Value();
	mProcessControlIdx->Redraw();//--- needed for Pro Tools Mac - don't know why!!
And those are the only places I touch this control!

Originally Posted by Tale View Post
I don't know... But I do know it actually works the other way around: When you click on a switch OnMouseDown() is called, which updates the control value, and then forwards this value to parameter by calling SetDirty(), which in turn calls SetParameterFromGUI().
I don't know if it's the bitmap or the control value itself that is not updating - but the parameter value IS changing - I can see and/or hear it's effect when toggled.

Originally Posted by Tale View Post
This always happens, so it should always work, but SetParameterFromGUI() is protected by a mutex lock, so maybe this could be a race condition in Pro Tools? If so, then I would expect this to also happen with other controls, also with other WDL-OL AAX plug-ins.
Yes, I suspect it is a race condition/conflict somewhere however I have been unable to debug it as Pro Tools is refusing to play audio while in debug mode. I have seen this ISwitch problem happen in other AAX plugins I have built - that's why I finally brought it up here. It very well could be something derelict in my code but then why does VST/VST3 and AU work properly as well as AAX on Windows? All other controls work as intended.

I have changed SetClean() back to what it was and temporarily fixed the problem by forcing a Redraw after updating the parameter's value in OnParamChange(). I don't know WHY I have to do that but it works and is a better solution than constant redraw.

Yes, it is strange and certainly troubling. I know there is something wrong somewhere.

Last edited by Nonlinear; 09-05-2020 at 09:34 AM.
Nonlinear is offline   Reply With Quote