Jump to content

GetParameter, when is it active?


Dewdman42

Recommended Posts

On 8/29/2017 at 1:42 AM, Dewdman42 said:

Error produced is:

GetParameter() called with an argument: (test) that does not equal any registered parameter name.

I was frustrated getting that same error when trying to use GetParameter at the global level and a quick Google search led me right here! 😄 Thanks for this thread, I'll stop wasting my time trying to make it work. 

Link to comment
Share on other sites

It might work if you put it inside the Initialize callback function.  I haven't tried that yet, but if you need something fetched before any callbacks are happening, than that might work.  if not then you have to basically do it in ProcessMIDI and keep a flag for whether it was done or not yet.

Link to comment
Share on other sites

2 minutes ago, Dewdman42 said:

It might work if you put it inside the Initialize callback function.

No, I just tried it and it doesn't work, I'm getting the same error. 

2 minutes ago, Dewdman42 said:

 if not then you have to basically do it in ProcessMIDI

Yes, it works inside ProcessMIDI or HandleMIDI. Thanks! 🙂 

  • Like 1
Link to comment
Share on other sites

so just to clarify, the reason it doesn't work at the global level or inside Initialize...and only works in ProcessMIDI and HandleMIDI.....is not because its actually inside those functions.  It's the timing of when its first called.  the GetParameter function can't be called until scripter has completely bootstrapped itself.  once it is bootstrapped, then you can put GetParameter inside any function that gets calle from that point forward, which basically includes ProcessMIDI, HandleMIDI, Idle, Reset and ParameterChanged.

So when a script is loaded the following things happen to bootstrap it up, in the following order:

  1. the entire script is scanned from top to bottom to get all the function names, variables, etc
  2. all the global level code is executed from the top to the bottom.
  3. The Initialize callback function will be called (if you defined it)
  4. The PluginParameters internal structures are finalized in some way, this may be when the PluginParameters array is read and the GUI elements created, etc..
  5. Finally, Scripter goes into a waiting mode where it waits for LogicPro to call the callback functions we all know and love: ProcessMIDI, HandleMIDI, Idle, Reset, ParameterChanged

so basically you can't call GetParameter until step #4 above has completed, which unfortunately is after all the global code runs, and the initialize callback too apparently.

  • Like 1
Link to comment
Share on other sites

3 minutes ago, Dewdman42 said:

basically you can't call GetParameter until step #4 above has completed, which unfortunately is after all the global code runs, and the initialize callback too apparently.

Ok great, that makes sense now! 

Still I think I'm going to experiment with the workarounds you listed in your 2nd post. 

  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...