-
Notifications
You must be signed in to change notification settings - Fork 260
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix bad router behaviour. #891
Conversation
While passing an input event through a rule, if chan, par1, par2 fields are out of range they are silently bounded to internal valid limit. This leads to an incorrect MIDI message forwarded to the router output which could interfere with previous message forwarded on the same MIDI channel. To fix this issue, if chan, par1, par2 fields are out of range than the rule is simply skipped.
In this case, clamping the values seems slightly better than silently skipping the rule, IMO. |
The 2)Clamping the rule-changed-value produces a valid MIDI value but a value not intended by the rule.
To get the same behaviour than (1), this MIDI message y for the current rule should not be passed to the synth. Ignoring the message is an audible behaviour more predictible. That could help the user to investigate what is wrong in the router rules. |
I'm not sure. @mawe42 Do you have an opinion? |
I think I agree with JJC, message values outside of the valid ranges could have any meaning. Simply clamping them is probably not any better than ignoring them, from a musical perspective. After all, we have no idea why they are out of range... bit flip, client error, deliberate value of another software or synth? Ignoring them is much more predictable and easier to understand, in my opinion. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, then pls elaborate on the documentation of the return value. E.g.
* @return #FLUID_OK if all rules were applied successfully, #FLUID_FAILED if an error occurred while applying a rule or (since 2.2.2) a parameter was out-of-range after the rule had been applied.
In fact values (chan, par1,par2) that requires
|
Sounds good to me. |
… by a rule. After a rule had been applied on any value and the value is out of range, the event can be ignored or the value can be clamped depending of the type of the event: - To get full benefice of the rule the value is clamped and the event passed to the output. - To avoid MIDI messages conflicts at the output, the event is ignored (i.e not passed to the output). chan value: event is ignored regardless of the event type par1: event is ignored for PROG_CHANGE or CONTROL_CHANGE type, par1 is clamped otherwise. par2: par2 is clamped regardless of the event type.
Kudos, SonarCloud Quality Gate passed! |
Thanks for correction on my crappy comments ;). |
No problem :) |
Actually, while passing an input event through a rule, if
chan, par1, par2
fields are out of range they are silently bounded to internal valid limit. This leads to an incorrect MIDI message forwarded to the router output which could interfere with previous message forwarded on the same MIDI channel.To fix this issue, if
chan, par1, par2
fields are out of range than the rule is simply skipped.