PDA

View Full Version : Reset Control Method Not working, Mutex?


RRokkenAudio
08-07-2010, 03:26 PM
I have a reset button that just resets things back to where I want them, I created the method, and it's not working. I tried locking Mutex, Still nothing:

void Equalizer::OnReset(int paramIdx)
{
IMutexLock lock(this);

int paramReset = GetParam(kReset)->Value();

paramReset = 1; // test
if(paramReset == 1){

GetGUI()->SetParameterFromGUI(kHMFfreqSel,0.5);
}
}


virtual void OnReset(int paramIdx) ; in header.

What am I missing?

~RR.

sstillwell
10-29-2010, 04:41 PM
I have a reset button that just resets things back to where I want them, I created the method, and it's not working. I tried locking Mutex, Still nothing:

void Equalizer::OnReset(int paramIdx)
{
IMutexLock lock(this);

int paramReset = GetParam(kReset)->Value();

paramReset = 1; // test
if(paramReset == 1){

GetGUI()->SetParameterFromGUI(kHMFfreqSel,0.5);
}
}


virtual void OnReset(int paramIdx) ; in header.

What am I missing?

~RR.

What ever calls the ::Reset(int paramIdx) method? Nothing, I'm fairly sure.

If you have a button on the UI, and it has a paramIdx, then you're going to see that in the OnParamChange() method...which is where you would check the value of your control and reset everything else if necessary. If you have a button on the UI that is NOT linked to a parameter, then it will need its own class definition inheriting the existing button class to allow you to override the OnMouseUp() method (note: NOT OnMouseDown()...have you ever noticed that you can click a button and drag the mouse away from the button and release....and nothing happens in most applications?) and trigger your reset behavior.

It's mostly inside the OnParamChange() method that you'd need to mutex to avoid non-threadsafe badness during audio processing.

Scott

The Reset() method of the plugin is an entirely different thing.