Page 1 of 1

Parameter change event?

Posted: Tue Feb 21, 2012 4:27 pm
by IXix
I think I asked about this at the church ages ago and I think the answer may have been "use HandleGUIMessage" but maybe the answer has changed with the passing of time, so I'll ask again.

Is it possible to have the GUI be notified of parameter changes? I looked around and thought that maybe adding a handler to IParameter.PropertyChanged might be what I wanted but it doesn't seem to get called when I move the slider. I also noticed these...

Code: Select all

void SubscribeEvents(int track, Action<IParameter, int> valueChanged, Action<IParameter, int> valueDescriptionChanged);
void UnsubscribeEvents(int track, Action<IParameter, int> valueChanged, Action<IParameter, int> valueDescriptionChanged);
...but I can't see any info on how they're used.

Re: Parameter change event?

Posted: Tue Feb 21, 2012 4:47 pm
by UNZ
hi, yes propertychanged event is what you want

for example in machine.set:

Code: Select all

            
machine.AllNonInputParameters().First(p => p.Name == "Gain").SubscribeEvents(track, Gain_ValueChanged, null);
and to handle it

Code: Select all

        void Gain_ValueChanged(IParameter param, int track)
        {
        }
don't forget to unsubscribe the event too. for example in machine.set if (machine != null)

handleguimessages: i use this to get values (for example VU levels) from the (native) audio thread to the gui thread, but not for parameters as that is already solved for you with the code above.

Re: Parameter change event?

Posted: Tue Feb 21, 2012 5:01 pm
by IXix
Thanks :)

Re: Parameter change event?

Posted: Tue Feb 21, 2012 10:58 pm
by Dean
I came to this thread thinking it's gonna be about some kind of real-life event, or party...

Re: Parameter change event?

Posted: Wed Feb 22, 2012 1:02 am
by UNZ
Dean wrote:I came to this thread thinking it's gonna be about some kind of real-life event, or party...
and i came to this thread thinking we'd be safe from your babble here

Re: Parameter change event?

Posted: Wed Feb 22, 2012 5:05 am
by Dean
UNZ wrote:
Dean wrote:I came to this thread thinking it's gonna be about some kind of real-life event, or party...
and i came to this thread thinking we'd be safe from your babble here
:P