how to detect if work / multiwork is called ?

Post Reply
User avatar
UNZ
Posts: 809
Joined: Mon Nov 21, 2011 9:42 pm
Contact:

how to detect if work / multiwork is called ?

Post 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
User avatar
IXix
Posts: 1113
Joined: Wed Nov 23, 2011 3:24 pm

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

Post 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 */
}
User avatar
UNZ
Posts: 809
Joined: Mon Nov 21, 2011 9:42 pm
Contact:

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

Post 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 ?
User avatar
IXix
Posts: 1113
Joined: Wed Nov 23, 2011 3:24 pm

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

Post by IXix »

UNZ wrote:any ideas how to solve ?
No, not really. Sorry.
User avatar
UNZ
Posts: 809
Joined: Mon Nov 21, 2011 9:42 pm
Contact:

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

Post 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 ?
Post Reply