Go Back   Cockos Incorporated Forums > REAPER Forums > REAPER Bug Reports

Reply
 
Thread Tools Display Modes
Old 01-22-2022, 03:48 AM   #1
mschnell
Human being with feelings
 
mschnell's Avatar
 
Join Date: Jun 2013
Location: Krefeld, Germany
Posts: 14,793
Default Weird behavior of JSFX when Reaper re-gains Focus

Also see -> https://forum.cockos.com/showthread.php?t=261849 and -> https://forum.cockos.com/showthread.php?t=262165 for details regarding the plugin in Question (ReaPack-> Midi Fade X).

I suggest that this is not desired behavior. A potential bug introduced maybe a year ago, as it did not happen when I created the plugin (2018) nor when I tested with an older version of Reaper's.

Testing on Windows 10.

With the current version I found that a critical variable in the plugin (but seemingly not all other variables) is set to zero when Reaper regains the focus.

Moreover when Reaper regains the focus the @slider section is executed (exploiting this I could do a workaround in this JSFX).

I suppose both variable cleaning and @slider should not happen at that moment. Maybe at some point in time an optimization has been introduced to have the JSFXes redraw their GUI after re-focussing, and this is an involuntary side-effect.

Moreover I found that (other than with the old version of Reaper's), after loading the plugin the same happens (seemingly additionally to doing the correct first time @slider) and hence Midi Fade X does not work as expecting after loading the project.

-Michael

Last edited by mschnell; 01-23-2022 at 08:39 AM.
mschnell is offline   Reply With Quote
Old 01-25-2022, 03:01 PM   #2
mschnell
Human being with feelings
 
mschnell's Avatar
 
Join Date: Jun 2013
Location: Krefeld, Germany
Posts: 14,793
Default

Anybody care to comment ?

-Michael
mschnell is offline   Reply With Quote
Old 01-25-2022, 04:39 PM   #3
Justin
Administrator
 
Justin's Avatar
 
Join Date: Jan 2005
Location: NYC
Posts: 15,746
Default

Can you simplify this report by providing a simple JSFX which demonstrates the issue, and also tell us what release version the behavior changed?
Justin is offline   Reply With Quote
Old 01-25-2022, 11:24 PM   #4
mschnell
Human being with feelings
 
mschnell's Avatar
 
Join Date: Jun 2013
Location: Krefeld, Germany
Posts: 14,793
Default

ReaPack-> Midi Fade X shows the problem clearly. I'll try to come up with something more simple.

But certainly I'm not going to find the exact version where it changed.

Am I correct to assume that it is not desired behavior that variables are set to zero and @slider is run when Reaper re-gains the focus ? If that is desired, I can happily live with that (I easily did a workaround in Fade X).

-Michael
mschnell is offline   Reply With Quote
Old 01-26-2022, 01:55 AM   #5
Tale
Human being with feelings
 
Tale's Avatar
 
Join Date: Jul 2008
Location: The Netherlands
Posts: 3,653
Default

Isn't the option "Close audio device when stopped and application is inactive" under Options > Audio the reason for this behavior? Here JSFX no longer stops/resets when REAPER looses/regains focus.
Tale is offline   Reply With Quote
Old 01-26-2022, 02:28 AM   #6
mschnell
Human being with feelings
 
mschnell's Avatar
 
Join Date: Jun 2013
Location: Krefeld, Germany
Posts: 14,793
Default

That certainly would avoid the problem from showing.

But (1) IMHO it's unexpected / undesired behavior nonetheless and (2) the problem also shows when the plugin is loaded: the at some point after the initialization the variable gets reset to zero.
-Michael
mschnell is offline   Reply With Quote
Old 01-26-2022, 02:37 AM   #7
mschnell
Human being with feelings
 
mschnell's Avatar
 
Join Date: Jun 2013
Location: Krefeld, Germany
Posts: 14,793
Default

This JSFX shows that the variable is reset and @slider is run when Reaper re-gains the focus (which both does not seem to make sens to me).

@init seems to be run at that point, as well ?!?!?

It did not reproduce other aspects I mentions (that it does not happen when the project once was in in run state, and that something weird happens when the JSFX is loaded (e.g. by starting Reaper) (which does happen with Midi Fade X) ).

I'm going to check with an older version of Reapers...

Seems I can't reproduce that (less weird) behavior with the version I supposedly tested with some days ago right now any more - even with Fade X.

-Michael



Code:
desc:refocus test

slider1:set1=0<0,1,1>set to 1


@init
//a = 1;

@slider
set1 ? (
  a = 1;
);  

@sample

a != 0 ? (
  a +=1;
);  

@gfx 640 400

gfx_r=gfx_g=gfx_b=0; gfx_a=1;
gfx_x=gfx_y=0;
gfx_rectto(gfx_w,gfx_h);
gfx_x=gfx_y=10;
gfx_r=gfx_g=gfx_b=1;
gfx_printf("%d", (a/10000)|0);

Last edited by mschnell; 01-26-2022 at 03:00 AM.
mschnell is offline   Reply With Quote
Old 01-27-2022, 11:27 PM   #8
mschnell
Human being with feelings
 
mschnell's Avatar
 
Join Date: Jun 2013
Location: Krefeld, Germany
Posts: 14,793
Default

I am still eager to know if it's planned behavior that JSFXes do a kind of reset when Reaper re-gains the focus. If yes, I'll update Fade X on ReaPack, if no, I'll wait for a fix in Reaper and re-test.
Thanks,

-Michael

Last edited by mschnell; 01-29-2022 at 10:14 AM.
mschnell is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 01:30 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.