Page 1 of 1

how to detect if work / multiwork is called ?

Posted: Mon Feb 27, 2012 10:24 pm
by UNZ
jedshiva and mixio have a problem: the vu is displaying values, then you disconnect all the input: VU stays at the same level because work() / multiwork() stops beeing called

how can we find out if work() / multiwork() is called ?

i can't use IsActive because i'm doing this on the native side, and it doesn't go well with my falloff (calulated on native side, sent over with handleguimessage). IsActive is too early for my purpose.

Image

Re: how to detect if work / multiwork is called ?

Posted: Tue Feb 28, 2012 6:26 pm
by IXix
How about something like this?

Code: Select all

Work()
{
   doneWork = true;
}

Tick()
{
   if(doneWork == true)
   {
      doneWork = false;
      /* set a timer here, only needs to be short */
   }
}

OnTimerExpired()
{
    /* reset display */
}

Re: how to detect if work / multiwork is called ?

Posted: Tue Feb 28, 2012 6:45 pm
by UNZ
IXix wrote:How about something like this?

Code: Select all

Work()
{
   doneWork = true;
}

Tick()
{
   if(doneWork == true)
   {
      doneWork = false;
      /* set a timer here, only needs to be short */
   }
}

OnTimerExpired()
{
    /* reset display */
}

i think i tried something like this, but the threading got in the way iirc. since i need to read doneWork in HandleGUIMessage. The meter started to flicker..


this is what i did:

Code: Select all

bool miex::HandleGUIMessage(CMachineDataOutput *pout, CMachineDataInput *pin)
{
	int request;
	pin->Read(request);

	switch(request)
	{
	case 0:
		{


			if (pmi->UpdateGUI == true)
			{
				for (dword t = 0; t < pmi->NumTracks; t++)
				{
					float *sw = pmi->Get_GUI_Values(t);
					pout->Write((double)*sw); sw++;
					pout->Write((double)*sw); sw++;
					pout->Write((double)*sw); sw++;
					pout->Write((double)*sw); sw++;
					pout->Write((double)*sw); sw++;
					pout->Write((double)*sw); sw++;
				}


				pmi->UpdateGUI = false;
				return true;
			}
			else
			{
				//this causes flickering on the i7

				//pout->Write(0.0);
				//pout->Write(0.0);
				//pout->Write(0.0);
				//pout->Write(0.0);
				//pout->Write(0.0);
				//pout->Write(0.0);

				//pmi->UpdateGUI = false;
				//return true;
			}

		}
	}

	return false;
};

void MultiWork(float const * const *inputs, float **outputs, int numsamples)
{
....do stuff...
UpdateGUI = true;

}
this isn't logically sound, as the flickering comes from handleguimessage beeing called before another work() is done, any ideas how to solve ?

Re: how to detect if work / multiwork is called ?

Posted: Tue Feb 28, 2012 8:11 pm
by IXix
UNZ wrote:any ideas how to solve ?
No, not really. Sorry.

Re: how to detect if work / multiwork is called ?

Posted: Fri Mar 02, 2012 1:27 am
by UNZ
maybe there could be a machine flag to tell buzz to always call work() / multiwork() / tick() even if the machine is disconnected from the graph entirely ?