-
Notifications
You must be signed in to change notification settings - Fork 4
Modifying values through scripting
Home >> Usage guide >> Modifying values through scripting
Sometimes, you may want to set some values dynamically through scripting. Juce-Feedbacks embraces that and allows you to modify any value of a feedback on code.
To get a feedback to be able to modify it, first you have to enable the 'Used by script' field, so the FeedbacksPlayer knows you will want to retrieve this feedback at some point, and it does not have to iterate over all the feedbacks to find the one you want. Next, you have to set an ID that you will use on the code to retrieve this feedback. This ID can be whatever you want, but it has to be unique on that FeedbacksPlayer.
Next, from code you just have to get the reference of the FeedbacksPlayer, and then call GetFeedback, with the type of the feedback and the ID that we set on the editor. If you don't know the type of the feedback that you want to get, just go to the editor, and it will show under the feedback name like this: Script SomeFeedback.
Keep in mind that if you don't use the proper type matching the ID that's on the editor, the GetFeedback function will return null!
From there, you have a direct reference to the feedback, and you can start changing any of its values.
Keep in mind that you need to change the values before playing the FeedbacksPlayer.