Skip to content
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

Controlling "Track: Set pan" with relative step size < 1% gets stuck at center #433

Closed
helgoboss opened this issue Sep 5, 2021 · 1 comment
Labels
bug Something isn't working

Comments

@helgoboss
Copy link
Owner

Experiments showed a somewhat strange behavior when it comes to setting track pan (via CSurf_OnPanChangeEx) to a value which is very close to center (0.01 ... so not many decimal places). After doing this, GetTrackUIVolPan still reports 0.0. Interestingly, this happens only with extensions, not in ReaScript (Lua). As always, I use Rust for the extension, but floating point numbers are the same as with C++ so this shouldn't matter.

Lua:

track = reaper.GetSelectedTrack(0, 0);
reaper.CSurf_OnPanChangeEx(track, 0.0, false, false);
ret, vol, panBefore = reaper.GetTrackUIVolPan(track);
reaper.CSurf_OnPanChangeEx(track, 0.01, false, false);
ret, vol, panAfter = reaper.GetTrackUIVolPan(track);

Rust:

// Given
reaper.csurf_on_pan_change_ex(track, Absolute(ReaperPanValue::new(0.0)), DenyGang);
let pan_before = reaper.get_track_ui_vol_pan(track)?.pan;
assert_eq!(pan_before.get(), 0.0);
// When
reaper.csurf_on_pan_change_ex(track, Absolute(ReaperPanValue::new(0.01)), DenyGang);
// Then
let pan_after = reaper.get_track_ui_vol_pan(track)?.pan;
assert_eq!(pan_after.get(), 0.0);
@helgoboss helgoboss added the bug Something isn't working label Sep 5, 2021
helgoboss added a commit to helgoboss/reaper-rs that referenced this issue Sep 5, 2021
@helgoboss
Copy link
Owner Author

Justin found out that the difference is not between ReaScript vs. extension but between pressing control/command vs. not pressing it (when running a Lua ReaScript, I do this by pressing Ctrl+Enter). Will be fixed on REAPER side. Nevertheless I will try to implement something that detects "getting stuck" situations like this one.

helgoboss added a commit that referenced this issue Sep 6, 2021
It reports a false positive if another mapping changed the target
back to the original target value in the meanwhile (e.g. when using
encoder push for reset).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant