Parameter change event?

Post Reply
User avatar
IXix
Posts: 1113
Joined: Wed Nov 23, 2011 3:24 pm

Parameter change event?

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

Re: Parameter change event?

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

Re: Parameter change event?

Post by IXix »

Thanks :)
Dean
Posts: 89
Joined: Fri Feb 10, 2012 6:11 pm

Re: Parameter change event?

Post by Dean »

I came to this thread thinking it's gonna be about some kind of real-life event, or party...
User avatar
UNZ
Posts: 808
Joined: Mon Nov 21, 2011 9:42 pm
Contact:

Re: Parameter change event?

Post 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
Dean
Posts: 89
Joined: Fri Feb 10, 2012 6:11 pm

Re: Parameter change event?

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