View Single Post
Old 09-01-2020, 10:57 AM   #7
Nonlinear
Human being with feelings
 
Join Date: Apr 2018
Posts: 352
Default

Quote:
Originally Posted by Tale View Post
Now, if you set mDirty to true in pControl->SetClean(), then pGraphics->IsDirty() will always return true, and so pGraphics->Draw() will be called each and every time, by default at 24 FPS.
ISwitchControl does not work reliably in Pro Tools without it so what is the correct fix? There must be something wrong in IControl, IGraphics or IPlugAAX somewhere.

I guess I don't understanding how the GUI is redrawn in iPlug. I thought the GUI was redrawn once per processing block. So, where does "FPS" come into this? Are controls constantly scanned for changes (at 24FPS) but then only updated/redrawn WHEN/by what call?

Again, the problem I'm having with ISwitchControl is only occurring when the transport is running. So apparently the processing block is "stepping on" the controls update - and perhaps "cleaning" - or otherwise interfering with - the ISwitchControls before their bitmap has been updated. How to fix that?

Quote:
Originally Posted by Tale View Post
The next time pGraphics->IsDirty() is called it will detect that one or more controls are dirty by checking IControl->IsDirty(). If dirty then pGraphics->Draw() will draw controls by calling pControl->Draw() for each of them, and then mark the control as clean by calling pControl->SetClean().
The "Draw" function in my IGraphics file (from WDL-OL) doesn't check if the control is Dirty:

Code:
  if (mStrict)
  {
    mDrawRECT = *pR;
    int n = mControls.GetSize();
    IControl** ppControl = mControls.GetList();
    for (int i = 0; i < n; ++i, ++ppControl)
    {
      IControl* pControl = *ppControl;
      if (!(pControl->IsHidden()) && pR->Intersects(pControl->GetRECT()))
      {
        pControl->Draw(this);
	pControl->SetClean();
      }
    }
  }
It DOES check IsDirty() if NOT "mstrict"

Code:
     else
    {
      for (i = 1; i < n; ++i)   // loop through all controls starting from one (not bg)
      {
        IControl* pControl = mControls.Get(i); // assign control i to pControl
        if (pControl->IsDirty())   // if pControl is dirty
        {

          // printf("control %i is Dirty\n", i);

          mDrawRECT = *(pControl->GetRECT()); // put the rect in the mDrawRect member variable
          for (j = 0; j < n; ++j)   // loop through all controls
          {
            IControl* pControl2 = mControls.Get(j); // assign control j to pControl2

            // if control1 == control2 OR control2 is not hidden AND control2's rect intersects mDrawRect
            if (!pControl2->IsHidden() && (i == j || pControl2->GetRECT()->Intersects(&mDrawRECT)))
            {
              //if ((i == j) && (!pControl2->IsHidden())|| (!(pControl2->IsHidden()) && pControl2->GetRECT()->Intersects(&mDrawRECT))) {
              //printf("control %i and %i \n", i, j);

              pControl2->Draw(this);
			  pControl2->SetClean();
            }
          }
          pControl->SetClean();
        }
      }

Last edited by Nonlinear; 09-01-2020 at 03:14 PM.
Nonlinear is offline   Reply With Quote