bug ? value 0 parameters in user module
-
sm_jamieson
- Member
- Posts: 555
- Contact:
Before I raise as a bug, has anyone else noticed this ? I've tested with the latest HH3 (3.0.146).
When a workspace is loaded, the stored parameters are sent to the module and picked up using:
// filter only message specific to this user module and type MS_CHANGE
if (Message->message == NOTIFY_MSG_USINE_CALLBACK && Message->lParam == MSG_CHANGE)
{
// WParam contains the Param Number
switch (Message->wParam)
etc.
But it the parameter has value zero, no message is sent !
This is not usually noticed as the default value in the C++ class for many parameters is zero. So not getting a callback makes no difference. But I have a user module where the class constructor sets the parameter value to "true", but a switch is connected to the parameter is "off". The module does not get sent any message, which is not correct.
If I set the value to something like 0.00001 then the value is sent.
After loading, all parameters should be sent to the module in the callback, even if their value is zero.
Does this seem like a bug ?
When a workspace is loaded, the stored parameters are sent to the module and picked up using:
// filter only message specific to this user module and type MS_CHANGE
if (Message->message == NOTIFY_MSG_USINE_CALLBACK && Message->lParam == MSG_CHANGE)
{
// WParam contains the Param Number
switch (Message->wParam)
etc.
But it the parameter has value zero, no message is sent !
This is not usually noticed as the default value in the C++ class for many parameters is zero. So not getting a callback makes no difference. But I have a user module where the class constructor sets the parameter value to "true", but a switch is connected to the parameter is "off". The module does not get sent any message, which is not correct.
If I set the value to something like 0.00001 then the value is sent.
After loading, all parameters should be sent to the module in the callback, even if their value is zero.
Does this seem like a bug ?
I'm not sure I understand every thing, but if you set the values to 0 at init (onInitModule(MasterInfo* pMasterInfo, ModuleInfo* pModuleInfo)... that should do.
http://oli-lab.org
Win11 Ryzen9/32GB RAM - RME MADIFACE - SSL alpha link 4-16 - OSC capable interfaces
follow OLI_LAB adventures on Mastodon
@olivar_premier@mastodon.social
Win11 Ryzen9/32GB RAM - RME MADIFACE - SSL alpha link 4-16 - OSC capable interfaces
follow OLI_LAB adventures on Mastodon
@olivar_premier@mastodon.social
I might be way off, but just was interested in reading this.
So essentially instead of initializing all to the specified values, it's just ignored and accepted because it "hasn't changed" by Usine's interpretation?
It just reminded me of a project I did with Auto-Stretch samplers, where I would dynamically update, or add more devices to busses, but the value hadn't changed...so even though I re-initialized a brand-new device on the same bus.... it still wouldn't resend or update my new device....until I forced it to.
If so I would say, there are several places in Usine I've seen those types of behaviors that confused me too.
-s
So essentially instead of initializing all to the specified values, it's just ignored and accepted because it "hasn't changed" by Usine's interpretation?
It just reminded me of a project I did with Auto-Stretch samplers, where I would dynamically update, or add more devices to busses, but the value hadn't changed...so even though I re-initialized a brand-new device on the same bus.... it still wouldn't resend or update my new device....until I forced it to.
If so I would say, there are several places in Usine I've seen those types of behaviors that confused me too.
-s
"Every act of creation is first an act of destruction." -Picasso
mm there must be something elsewhere wrong, cause here i do have modules that are initiated with 1 or other values, and if i connect a swich wich is off , on recall of the wks the param value is definitely set to 0, and the ouput code reflect this, mean the callback has passed
-
sm_jamieson
- Member
- Posts: 555
- Contact:
I suspect that the parameter is updated, its just that the onCallback is not called in the module since Usine thinks it has "not changed". I have not tried a script to see if it behaves the same way as a User module.
Some modules do not use the Callback, but poll the parameter values - these would not be affected.
Perhaps senso can check Usine to make sure that it calls the onCallback() routine for parameters of value zero when the module is initialised.
Some modules do not use the Callback, but poll the parameter values - these would not be affected.
Perhaps senso can check Usine to make sure that it calls the onCallback() routine for parameters of value zero when the module is initialised.
-
sm_jamieson
- Member
- Posts: 555
- Contact:
You are on the right track. On module startup any parameter value should be seen as changed "from undefined" to some other value, and thus sent to onCallback(). This is vital as its the only way to get parameters initialised when a module starts up. I suppose you could poll all parameters after the module is initialised, but it's hard to know when the module as finished initialising.There is "onInitModule()", but not "afterInitModule()" for example.sephult wrote:I might be way off, but just was interested in reading this.
So essentially instead of initializing all to the specified values, it's just ignored and accepted because it "hasn't changed" by Usine's interpretation?
It just reminded me of a project I did with Auto-Stretch samplers, where I would dynamically update, or add more devices to busses, but the value hadn't changed...so even though I re-initialized a brand-new device on the same bus.... it still wouldn't resend or update my new device....until I forced it to.
If so I would say, there are several places in Usine I've seen those types of behaviors that confused me too.
-s
At the loading time, the loaded value is compared to the parameter's value. If they are the same, the callback is not called.
So initialization must be done in the Init procedure, not in callbacks.
senso+++
So initialization must be done in the Init procedure, not in callbacks.
senso+++
Olivier Sens
www.brainmodular.com
www.brainmodular.com
Who is online
Users browsing this forum: No registered users and 9 guests
