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

Reply
 
Thread Tools Display Modes
Old 09-20-2021, 07:51 AM   #1
airon
Human being with feelings
 
airon's Avatar
 
Join Date: Aug 2006
Location: Berlin
Posts: 11,817
Default Reporting a Focused FX via API for CSI not working?

Bit of a problem here and I can't say what it is. Bug, API change, programming error on our part(CSI project), but it's worth taking a look at because so many of us are using this functionality.

CSI does not always know when an insert effect window/view, docked or undocked is focused.

This is in reference to these two posts in the CSI thread.

My initial report
https://forum.cockos.com/showpost.ph...ostcount=14967

The result is that the plugin is not controlled unless you first make another plugin the focus, then back to the plugin you actually wish to focus, as Funkybot explains below.

Funkybots response which lead to this report
https://forum.cockos.com/showpost.ph...ostcount=14971

A technical limitation of the API ?

Maybe looking at the Github project will help. Maybe just telling Geoff what needs improving. Or maybe the API can be improved or added to.

Hope you can help here within what time you can spare.
__________________
Using Latch Preview (Video) - Faderport 16 setup for CSI 1.1 , CSI 3.10
Website
"My ego comes pre-shrunk" - Randy Thom

Last edited by airon; 09-20-2021 at 10:14 AM.
airon is offline   Reply With Quote
Old 09-24-2021, 04:19 AM   #2
airon
Human being with feelings
 
airon's Avatar
 
Join Date: Aug 2006
Location: Berlin
Posts: 11,817
Default

Is it a feature request when a control surface plugin can't always tell when a plugin is in focus ?

Should I ask to move this in the Feature Request section ?
__________________
Using Latch Preview (Video) - Faderport 16 setup for CSI 1.1 , CSI 3.10
Website
"My ego comes pre-shrunk" - Randy Thom
airon is offline   Reply With Quote
Old 09-24-2021, 05:59 AM   #3
nofish
Human being with feelings
 
nofish's Avatar
 
Join Date: Oct 2007
Location: home is where the heart is
Posts: 12,096
Default

Maybe Geoff could chime in and link to the specific code section where there's a problem with?
May make it easier for the Reaper devs to look into I'd think.
nofish is offline   Reply With Quote
Old 09-25-2021, 05:50 AM   #4
Geoff Waddington
Human being with feelings
 
Geoff Waddington's Avatar
 
Join Date: Mar 2009
Location: Dartmouth, Nova Scotia
Posts: 11,184
Default

Quote:
Originally Posted by nofish View Post
Maybe Geoff could chime in and link to the specific code section where there's a problem with?
May make it easier for the Reaper devs to look into I'd think.
It's more a behaviour than a section -- @Funkybots's post explains it well.

https://forum.cockos.com/showpost.ph...ostcount=14971

I suspect, this is a product of "last focused plugin" behaviour -- even when the Window loses focus, it remains the "last focused plugin" in Reaper, we had to do some tricks to ascertain when the plugin window actually loses focus, and we don't get a notification when the newly focused plugin is the same as the "last focused plugin", so it's in around there somewhere.

Maybe there's a more reliable way to do this, I'm certainly open to anything anyone has, this has been problematic since day one
__________________
To install you need the CSI Software and Support Files
For installation instructions and documentation see the Wiki
Donate -- via PayPal to waddingtongeoff@gmail.com
Geoff Waddington is offline   Reply With Quote
Old 09-25-2021, 07:02 AM   #5
nofish
Human being with feelings
 
nofish's Avatar
 
Join Date: Oct 2007
Location: home is where the heart is
Posts: 12,096
Default

From GetFocusedFX2 doc:

Quote:
Return value has 1 set if track FX, 2 if take/item FX, 4 set if FX is no longer focused but still open. tracknumber==0 means the master track, 1 means track 1, etc. itemnumber is zero-based (or -1 if not an item). For interpretation of fxnumber, see GetLastTouchedFX.
Maybe I'm misunderstanding, but wouldn't that be what to use?
Seems to work here:


Test code (Lua, but I think you get the ghist):
Code:
function msg(m)
  return reaper.ShowConsoleMsg(tostring(m) .. "\n")
end

lastRetval = -1

function GetFocusedFX()
  retval, tracknumber, itemnumber, fxnumber = reaper.GetFocusedFX2()
  

  if lastRetval ~= retval then
    if (retval & 4) == 4 then
      msg("focus lost")
    else
      msg("has focus")
    end
  end
  lastRetval = retval
  reaper.defer(GetFocusedFX)
end

GetFocusedFX()
edit:
I'm using polling here, are you using a callback?
Then I wouldn't know.

Last edited by nofish; 09-25-2021 at 07:53 AM.
nofish is offline   Reply With Quote
Old 09-25-2021, 08:36 AM   #6
Geoff Waddington
Human being with feelings
 
Geoff Waddington's Avatar
 
Join Date: Mar 2009
Location: Dartmouth, Nova Scotia
Posts: 11,184
Default

Quote:
Originally Posted by nofish View Post
From GetFocusedFX2 doc:



Maybe I'm misunderstanding, but wouldn't that be what to use?
Seems to work here:


Test code (Lua, but I think you get the ghist):
Code:
function msg(m)
  return reaper.ShowConsoleMsg(tostring(m) .. "\n")
end

lastRetval = -1

function GetFocusedFX()
  retval, tracknumber, itemnumber, fxnumber = reaper.GetFocusedFX2()
  

  if lastRetval ~= retval then
    if (retval & 4) == 4 then
      msg("focus lost")
    else
      msg("has focus")
    end
  end
  lastRetval = retval
  reaper.defer(GetFocusedFX)
end

GetFocusedFX()
edit:
I'm using polling here, are you using a callback?
Then I wouldn't know.
Right now, I'm using a callback via CSURF_EXT_SETFOCUSEDFX, methinks I'm going to switch to polling, thanks
__________________
To install you need the CSI Software and Support Files
For installation instructions and documentation see the Wiki
Donate -- via PayPal to waddingtongeoff@gmail.com
Geoff Waddington is offline   Reply With Quote
Old 09-25-2021, 09:10 AM   #7
nofish
Human being with feelings
 
nofish's Avatar
 
Join Date: Oct 2007
Location: home is where the heart is
Posts: 12,096
Default

Quote:
Originally Posted by Geoff Waddington View Post
Right now, I'm using a callback via CSURF_EXT_SETFOCUSEDFX
Just tried out of curiousity.
I think I see the issue now, can confirm that when having a plugin focused, clicking somewhere else so it gets unfocused, than focusing same plugin again, CSURF_EXT_SETFOCUSEDFX doesn't get fired.
Is that it?
nofish is offline   Reply With Quote
Old 09-25-2021, 09:29 AM   #8
Geoff Waddington
Human being with feelings
 
Geoff Waddington's Avatar
 
Join Date: Mar 2009
Location: Dartmouth, Nova Scotia
Posts: 11,184
Default

Quote:
Originally Posted by nofish View Post
Just tried out of curiousity.
I think I see the issue now, can confirm that when having a plugin focused, clicking somewhere else so it gets unfocused, than focusing same plugin again, CSURF_EXT_SETFOCUSEDFX doesn't get fired.
Is that it?
Yup, that's the one
__________________
To install you need the CSI Software and Support Files
For installation instructions and documentation see the Wiki
Donate -- via PayPal to waddingtongeoff@gmail.com
Geoff Waddington is offline   Reply With Quote
Old 09-25-2021, 09:33 AM   #9
nofish
Human being with feelings
 
nofish's Avatar
 
Join Date: Oct 2007
Location: home is where the heart is
Posts: 12,096
Default

Hm..not sure if bug of FR to be honest, I think one could say focused plugin hasn't changed, so no need to fire it again.
But that's not up to me to decide anyway.
nofish is offline   Reply With Quote
Old 09-25-2021, 09:45 AM   #10
Geoff Waddington
Human being with feelings
 
Geoff Waddington's Avatar
 
Join Date: Mar 2009
Location: Dartmouth, Nova Scotia
Posts: 11,184
Default

Quote:
Originally Posted by nofish View Post
Hm..not sure if bug of FR to be honest, I think one could say focused plugin hasn't changed, so no need to fire it again.
Agree, that's what I was trying to say earlier in the thread, it's not a wrong Reaper behaviour, it's just not of much help for us in our use case
__________________
To install you need the CSI Software and Support Files
For installation instructions and documentation see the Wiki
Donate -- via PayPal to waddingtongeoff@gmail.com
Geoff Waddington is offline   Reply With Quote
Old 09-29-2021, 04:48 AM   #11
airon
Human being with feelings
 
airon's Avatar
 
Join Date: Aug 2006
Location: Berlin
Posts: 11,817
Default

2-5 Hz polling would be fine for me. It's not like I can flip my hands to another control in less than 200 milliseconds, or would rather wish to do so.
__________________
Using Latch Preview (Video) - Faderport 16 setup for CSI 1.1 , CSI 3.10
Website
"My ego comes pre-shrunk" - Randy Thom
airon 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 04:08 PM.


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