helgoboss / helgobox

Helgobox: ReaLearn & Playtime
https://www.helgoboss.org/projects/helgobox
GNU General Public License v3.0
204 stars 20 forks source link

Feedback for Out-Of-Range=Min (bank select buttons) not working anymore in 2.10.0 pre-2 #396

Closed vonglan closed 3 years ago

vonglan commented 3 years ago

If I revert to 2.9.1., it is working again. Do you need more info/details?

helgoboss commented 3 years ago

If you could offer a test project with recorded MIDI that is routed to ReaLearn, it would be immensely helpful. Very low on time at the moment, so any preliminary work on bug author side much appreciated. Thanks!

helgoboss commented 3 years ago

Tried a bit. Can't reproduce. Definitely going to need some test project.

vonglan commented 3 years ago

Hi Benjamin, I will try to create a test project, also for the other issue. Not sure when I have time.

vonglan commented 3 years ago

Test project attached. Tested with 2.10.0. pre-3. When playing back the recorded MIDI, it works as expected! But not in "live" use. I tried "send feedback after control", but that did not make a difference. issue396 feedback out-of-range.RPP.zip

And with 2.9.1., it works correctly.

vonglan commented 3 years ago

I guess I could have a look at this with the new "log MIDI messages" option?

vonglan commented 3 years ago

I checked again. With 2.9.1., it still works fine (both with just the main mapping, as in the example project, or with my SY mapping combination controller+main).

With 2.10.pre-6, It did not work in the example project (which has just a main mapping) at first. When I changed the tuning mode in the example project to "Toggle Buttons" instead of "Normal Mode", this fixed the problem! I suspect because in this case, the 127-feedback is sent twice to the device (as I could see from the log)!

In my SY mappings (separated between Controller and Main Mappings), I use "Normal Mode" in Tuning, and the feedback is unreliable in 2.10-pre6. When I look at the Output Log, ReaLearn sends the correct messages, but X-Touch Mini does not light the LED. It does not help if I change to "Toggle" Mode in Tuning. (And I see in the log that the 127-feedback is only sent once, in either case.)

Any idea, why this problem did not occur in 2.9.1., and any workaround that I could use to make the SY mapping work correctly with feedback again in 2.10.pre?

helgoboss commented 3 years ago

Does "Send feedback after control" help? I remember this was necessary e.g. with Behringer X-Touch Compact when using "Toggle buttons" because this device overwrites the last feedback it gets when releasing the button (stupid behavior).

In any case, let's better not get down the road to find out why it worked in 2.9.1 and not anymore in 2.10 prereleases ... knowing that 2.10 sends the correct messages. It was probably a "fortunate bug" in 2.9.1 that made it work. Would be better to find out why exactly the X-Touch Mini needs 2 messages. But I strongly suspect above mentioned "feedback overwriting" to be the reason.

vonglan commented 3 years ago

"Send Feedback after control" did not make a difference

With my "SY mappings" I noticed, that feedback never worked, when I pressed the X-Touch button longer (like 1 second between note-on and note-off). It did work sometimes when I pressed very quickly. I had the impression that turning "send feedback after control" helped so it worked more often (when pressed quickly).

By the way, the feedback always works for the buttons that are not mapped with the "bank switching" method (Target min=max, and out-of-range behavior = min), but just have an ordinary VST parameter as target.

I thought "send feedback after control" would send the whole feedback round for the virtual target again, once the note-off is received. (I think this would solve the X-Touch's problem.) But this is not the case.

I made a very simple example project, attached.

Strangely, when I record two button switches, the feedback does not work. When I play it back, it works. The log output is the same both times!

During Recording:
Feedback not working
1628279718.632 | ReaLearn _buCMwLe | Control input    | [9A, 08, 7F] = [154, 8, 127] = NoteOn { channel: Channel(10), key_number: KeyNumber(8), velocity: U7(127) } (matched)
1628279718.662 | ReaLearn _buCMwLe | Feedback output  | [9A, 08, 7F] = [154, 8, 127] = NoteOn { channel: Channel(10), key_number: KeyNumber(8), velocity: U7(127) }
1628279718.663 | ReaLearn _buCMwLe | Feedback output  | [9A, 09, 00] = [154, 9, 0] = NoteOn { channel: Channel(10), key_number: KeyNumber(9), velocity: U7(0) }
1628279718.752 | ReaLearn _buCMwLe | Control input    | [8A, 08, 00] = [138, 8, 0] = NoteOff { channel: Channel(10), key_number: KeyNumber(8), velocity: U7(0) } (matched)
1628279719.562 | ReaLearn _buCMwLe | Control input    | [9A, 09, 7F] = [154, 9, 127] = NoteOn { channel: Channel(10), key_number: KeyNumber(9), velocity: U7(127) } (matched)
1628279719.592 | ReaLearn _buCMwLe | Feedback output  | [9A, 08, 00] = [154, 8, 0] = NoteOn { channel: Channel(10), key_number: KeyNumber(8), velocity: U7(0) }
1628279719.594 | ReaLearn _buCMwLe | Feedback output  | [9A, 09, 7F] = [154, 9, 127] = NoteOn { channel: Channel(10), key_number: KeyNumber(9), velocity: U7(127) }
1628279719.712 | ReaLearn _buCMwLe | Control input    | [8A, 09, 00] = [138, 9, 0] = NoteOff { channel: Channel(10), key_number: KeyNumber(9), velocity: U7(0) } (matched)

Playback
Feedback working
1628279779.891 | ReaLearn _buCMwLe | Control input    | [9A, 08, 7F] = [154, 8, 127] = NoteOn { channel: Channel(10), key_number: KeyNumber(8), velocity: U7(127) } (matched)
1628279779.921 | ReaLearn _buCMwLe | Feedback output  | [9A, 08, 7F] = [154, 8, 127] = NoteOn { channel: Channel(10), key_number: KeyNumber(8), velocity: U7(127) }
1628279779.922 | ReaLearn _buCMwLe | Feedback output  | [9A, 09, 00] = [154, 9, 0] = NoteOn { channel: Channel(10), key_number: KeyNumber(9), velocity: U7(0) }
1628279780.011 | ReaLearn _buCMwLe | Control input    | [8A, 08, 00] = [138, 8, 0] = NoteOff { channel: Channel(10), key_number: KeyNumber(8), velocity: U7(0) } (matched)
1628279780.821 | ReaLearn _buCMwLe | Control input    | [9A, 09, 7F] = [154, 9, 127] = NoteOn { channel: Channel(10), key_number: KeyNumber(9), velocity: U7(127) } (matched)
1628279780.853 | ReaLearn _buCMwLe | Feedback output  | [9A, 08, 00] = [154, 8, 0] = NoteOn { channel: Channel(10), key_number: KeyNumber(8), velocity: U7(0) }
1628279780.855 | ReaLearn _buCMwLe | Feedback output  | [9A, 09, 7F] = [154, 9, 127] = NoteOn { channel: Channel(10), key_number: KeyNumber(9), velocity: U7(127) }
1628279780.941 | ReaLearn _buCMwLe | Control input    | [8A, 09, 00] = [138, 9, 0] = NoteOff { channel: Channel(10), key_number: KeyNumber(9), velocity: U7(0) } (matched)

issue396 v3 feedback problem.RPP.zip

vonglan commented 3 years ago

I guess it would help if ReaLearn would send the feedback for "light on" again, after it receives the note-off. For a while, I thought I could achieve this by changing to character "toggle-only button". But of course, this is not available for type "note velocity", only for CC/NRPN.

helgoboss commented 3 years ago

Mmh, I would expect ReaLearn to send feedback again after it receives a "note off" for a "Note velocity" source if "Send feedback after control" is checked. That's the whole point of that option. I will look into it, maybe something doesn't work correctly.

helgoboss commented 3 years ago

Checked it in v2.10.0-pre.6. "Send feedback after control" works as expected, so it sends feedback even when receiving a "note off" that would otherwise not affect the target value (e.g. in "Toggle buttons" mode).

One minor detail: For incoming messages, ReaLearn treats "NOTE OFF" and "NOTE ON with value zero" the same way. As outgoing message for 0% feedback, it always sends "NOTE ON with value zero", never "NOTE OFF". Not sure if this could be a reason why it doesn't work in your case? But don't think so because in general it seems to work, no?

vonglan commented 3 years ago

I checked it with the example project again (v3 above). I am afraid it does not work there, there is no feedback sent after the note-off (no matter whether "controller" manually or with the recording in the project). See the log output below.

1628712619.219 | ReaLearn paW4LZtt | Control input    | [9A, 08, 7F] = [154, 8, 127] = NoteOn { channel: Channel(10), key_number: KeyNumber(8), velocity: U7(127) } (matched)
1628712619.254 | ReaLearn paW4LZtt | Feedback output  | [9A, 08, 7F] = [154, 8, 127] = NoteOn { channel: Channel(10), key_number: KeyNumber(8), velocity: U7(127) }
1628712619.254 | ReaLearn paW4LZtt | Feedback output  | [9A, 09, 00] = [154, 9, 0] = NoteOn { channel: Channel(10), key_number: KeyNumber(9), velocity: U7(0) }
1628712619.427 | ReaLearn paW4LZtt | Control input    | [8A, 08, 00] = [138, 8, 0] = NoteOff { channel: Channel(10), key_number: KeyNumber(8), velocity: U7(0) } (matched)
1628712647.837 | ReaLearn paW4LZtt | Control input    | [9A, 09, 7F] = [154, 9, 127] = NoteOn { channel: Channel(10), key_number: KeyNumber(9), velocity: U7(127) } (matched)
1628712647.867 | ReaLearn paW4LZtt | Feedback output  | [9A, 08, 00] = [154, 8, 0] = NoteOn { channel: Channel(10), key_number: KeyNumber(8), velocity: U7(0) }
1628712647.870 | ReaLearn paW4LZtt | Feedback output  | [9A, 09, 7F] = [154, 9, 127] = NoteOn { channel: Channel(10), key_number: KeyNumber(9), velocity: U7(127) }
1628712648.017 | ReaLearn paW4LZtt | Control input    | [8A, 09, 00] = [138, 9, 0] = NoteOff { channel: Channel(10), key_number: KeyNumber(9), velocity: U7(0) } (matched)
vonglan commented 3 years ago

I was wondering above

Strangely, when I record two button switches, the feedback does not work. When I play it back, it works. The log output is the same both times!

This is clear to me now. When the recording is played back, the controller is not controlling its own lights, so in this case the additional feedback after control is not required.

helgoboss commented 3 years ago

Checked it. "Send feedback after control" works as expected for "Toggle buttons" mode. You use "Normal" mode and it doesn't work expected. Interestingly, when using "Press only", it sends feedback on releases. I'll have a look what's going wrong there.

helgoboss commented 3 years ago

In any case: "Send feedback after control" is the correct option for your problem. I know another Behringer controller that doesn't behave in this annoying way when switching it to Mackie Control mode instead of custom mode. Maybe worth a try.

helgoboss commented 3 years ago

Okay, so the actual reason why it didn't send the feedback in your case was the combination of a rounding error and FX parameter polling (which is by default enabled since 2.10.0-pre.1 to make sure that automatic feedback is sent even in exotic corner cases, see #350). ReaLearn tries to omit sending feedback after control if it knows the automatic feedback will be sent anyway a moment after. However, the polling mechanism prevents automatic feedback to be sent if there's no significant value change (to not overload the controller with feedback messages) - so the automatic feedback was not sent at all.

Instead of removing the polling or the overload prevention, I adjusted the "Send feedback after control" behavior to send feedback in any case, even at the cost of having a few more messages sent out than necessary. This can be improved in future.

I also found another case where this should help to get reliable feedback when "Send feedback after control" is enabled: Retriggerable targets.

In upcoming pre7 it should work again.

vonglan commented 3 years ago

Wow, quite a combination leading to the bug. Thanks a lot for investigating and fixing this!

vonglan commented 3 years ago

is fixed