Old 10-19-2017, 09:03 AM   #1
nofish
Human being with feelings
 
nofish's Avatar
 
Join Date: Oct 2007
Location: home is where the heart is
Posts: 12,107
Default Chunk Track/Take FX: BYPASS - third value ? (SOLVED)

edit:
Solved, post #12


=== original post ===



Anyone knows what the third 0 indicates ?

According to Wiki , first is bypassed, second is offline but third isn't even listed there ?
edit:
Wiki is now updated accordingly, thanks IXix.

edit:
Ok, easier question
Is it possible to get offline state from an FX without chunk parsing ?

Last edited by nofish; 10-25-2017 at 06:33 AM.
nofish is offline   Reply With Quote
Old 10-19-2017, 01:24 PM   #2
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 9,900
Default

Code:
 reaper.TakeFX_GetEnabled( take, fx )
 reaper.TrackFX_GetEnabled( track, fx )
?
X-Raym is offline   Reply With Quote
Old 10-19-2017, 03:25 PM   #3
nofish
Human being with feelings
 
nofish's Avatar
 
Join Date: Oct 2007
Location: home is where the heart is
Posts: 12,107
Default

Thanks X-Raym.

Returns false when FX is bypassed though, so I can't use it I think as I need to exclusively detect offline state or ?
nofish is offline   Reply With Quote
Old 10-22-2017, 01:25 PM   #4
FnA
Human being with feelings
 
FnA's Avatar
 
Join Date: Jun 2012
Posts: 2,173
Default

Curious... How do you suppose SWS implements these actions?

SWS/S&M: Toggle FX 1 (,2,3 etc) online/offline for selected tracks



It seems there is a bug or unfinished aspect to these actions. At 0:07 "toggle FX 3" should stay on after second track which complies is selected, no?

I'm curious how SWS implements that and actions such as

SWS/AW: Set selected items timebase to time

Something always running in the background? How do they do that?
Also REAPER's property window I guess.
FnA is offline   Reply With Quote
Old 10-22-2017, 02:29 PM   #5
nofish
Human being with feelings
 
nofish's Avatar
 
Join Date: Oct 2007
Location: home is where the heart is
Posts: 12,107
Default

Chunk manipulation for offline / online:

https://github.com/reaper-oss/sws/bl...nM_FX.cpp#L186

(note the comment in L. 216 - no dedicated API yet => state chunk update)

For some background stuff they use a fake control surface.

https://github.com/reaper-oss/sws/bl...nsion.cpp#L467

Last edited by nofish; 10-22-2017 at 02:44 PM.
nofish is offline   Reply With Quote
Old 10-22-2017, 02:48 PM   #6
heda
Human being with feelings
 
heda's Avatar
 
Join Date: Jun 2012
Location: Spain
Posts: 7,268
Default

The only way is chunk parsing
I only modify the second number in the chunk and maintain the other numbers.
We have been asking for this API function for GetSet offline/online plugins for long time, but I think devs don't read the API requests thread at all.
I think the way to request API is by emailing them directly.
heda is offline   Reply With Quote
Old 10-22-2017, 03:15 PM   #7
nofish
Human being with feelings
 
nofish's Avatar
 
Join Date: Oct 2007
Location: home is where the heart is
Posts: 12,107
Default

Quote:
Originally Posted by heda View Post
The only way is chunk parsing
I only modify the second number in the chunk and maintain the other numbers.
We have been asking for this API function for GetSet offline/online plugins for long time, but I think devs don't read the API requests thread at all.
I think the way to request API is by emailing them directly.
Chunk parsing is what I'm doing now too.
And I just requested too, maybe they see it eventually.

https://forum.cockos.com/showpost.ph...&postcount=257

heda (or anyone), you don't happen to know what the third number is either ?
(Just out of curiousity.)

edit:
btw. I've experimented with making Get/SetOffline() available to ReaScript. Also uses (SWS) chunk parsing internally but may be a bit faster (due to more optimized / compiled SWS code) and more practical than doing the parsing directly in ReaScript. Only works for track FX currently though, not item FX.
PM me if you want to have a go at testing.

Last edited by nofish; 10-22-2017 at 03:45 PM.
nofish is offline   Reply With Quote
Old 10-23-2017, 01:17 PM   #8
nofish
Human being with feelings
 
nofish's Avatar
 
Join Date: Oct 2007
Location: home is where the heart is
Posts: 12,107
Default

Here's a SWS test build (Win64) which adds the following ReaScript functions (Lua example):

Code:
boolean reaper.NF_TrackFX_GetOffline(MediaTrack track, integer fx)
reaper.NF_TrackFX_SetOffline(MediaTrack track, integer fx, boolean offline)

reaper.NF_TakeFX_GetOffline(MediaItem_Take take, integer fx)
reaper.NF_TakeFX_SetOffline(MediaItem_Take take, integer fx, boolean offline)
if anyone wants to test. Feedback appreciated.
As always, better not use in real projects (for now).

https://www.dropbox.com/s/ni8odfe2mi...sws64.dll?dl=1

(The ReaScript doc you get with action "ReaScript: Open reaScript documentation (html)..." is updated for these.)

Last edited by nofish; 10-23-2017 at 01:28 PM.
nofish is offline   Reply With Quote
Old 10-23-2017, 03:23 PM   #9
FnA
Human being with feelings
 
FnA's Avatar
 
Join Date: Jun 2012
Posts: 2,173
Default

Thanks for the links.

What kind of test do you want? Just loop over a bunch of tracks/takes, take some time precise() measurements, ... ?

I don't really have any fancy usage in mind myself. Not that it's not a good addition to script functions. I mostly stick to scripts that are a few dozen lines at most.

I have two Windows 7 x 64 machines. One is a not very good i3 laptop with a bunch of non-daw crap on it. That's the one I usually test a pre on, etc. The other is much faster i7 desktop that I hesitate to take chances with, but I guess there should be no problem trying something in a portable install there if it was helpful somehow?
FnA is offline   Reply With Quote
Old 10-23-2017, 03:31 PM   #10
nofish
Human being with feelings
 
nofish's Avatar
 
Join Date: Oct 2007
Location: home is where the heart is
Posts: 12,107
Default

Thanks for offering testing FnA.

Actually testing about speed I didn't have in mind at all. As it uses the already present SWS chunk parser/patcher it is what it is speedwise.

I was rather thinking about just using it and making sure it works correctly and doesn't break anything as chunk manipulation is a bit of a touchy thing (though as I didn't change anything of the actual SWS chunk manipulation code I'd think it's ok.)
nofish is offline   Reply With Quote
Old 10-23-2017, 03:51 PM   #11
FnA
Human being with feelings
 
FnA's Avatar
 
Join Date: Jun 2012
Posts: 2,173
Default

Do you prefer I use Lua or Eel? I mean, if you have tested one or the other less yourself or something like that. I can do Python too, I suppose, but mostly don't bother with that anymore and my Python install is old now too...
FnA is offline   Reply With Quote
Old 10-23-2017, 04:04 PM   #12
Justin
Administrator
 
Justin's Avatar
 
Join Date: Jan 2005
Location: NYC
Posts: 15,737
Default

The third value is only set if the plug-in is offline and should be floated when brought back online...
Justin is offline   Reply With Quote
Old 10-23-2017, 05:26 PM   #13
nofish
Human being with feelings
 
nofish's Avatar
 
Join Date: Oct 2007
Location: home is where the heart is
Posts: 12,107
Default

Thanks Justin. So the Wiki can now be updated.

http://wiki.cockos.com/wiki/index.ph...rack.2FTake_FX
nofish is offline   Reply With Quote
Old 10-23-2017, 05:29 PM   #14
nofish
Human being with feelings
 
nofish's Avatar
 
Join Date: Oct 2007
Location: home is where the heart is
Posts: 12,107
Default

Quote:
Originally Posted by FnA View Post
Do you prefer I use Lua or Eel? I mean, if you have tested one or the other less yourself or something like that. I can do Python too, I suppose, but mostly don't bother with that anymore and my Python install is old now too...
Whatever you see fit.
I've only tested a little using Lua.

Thanks.
nofish is offline   Reply With Quote
Old 10-23-2017, 06:29 PM   #15
FnA
Human being with feelings
 
FnA's Avatar
 
Join Date: Jun 2012
Posts: 2,173
Default

I used Eel a little with the track FX functions. So far just for switching offline. Seems ok mostly.

Except maybe complicated concerning third 0. REAPER seems to modify this only when switching Offline, not when closing window. Script (edit-I mean your extension) is obviously not modeled on that, because no one knew about it. I wonder if you will want to change the build. So I hold off on further testing a little...
FnA is offline   Reply With Quote
Old 10-24-2017, 09:20 AM   #16
nofish
Human being with feelings
 
nofish's Avatar
 
Join Date: Oct 2007
Location: home is where the heart is
Posts: 12,107
Default

I see what you mean with the third value.

The thing is when offlining a floating FX via extension / script the third value is not set to 1 automatically. Hadn't noticed this, thanks. Makes sense though now that I think about it.

It would be possible to account for this in the extension (check if FX is floating before offlining, if so set value to 1. And when onlining, check for third value, if set make it float).

But this would involve several more chunk juggling (speed). Besides if desired to make FX float when onlining it can be done in a script directly using Track/ItemFX_SetOpen() I think.

So I think I rather leave it as it is now.
Besides, using SWS actions "Set FX offline / online" also don't account for the third value it seems. If you set a floating FX offline and bring back online with these actions, the FX doesn't float either (maybe because third value wasn't introduced / known yet when these were written), so I guess that may be a reasonable excuse to have my extension act the same.

Last edited by nofish; 10-24-2017 at 10:05 AM.
nofish is offline   Reply With Quote
Old 10-24-2017, 07:51 PM   #17
FnA
Human being with feelings
 
FnA's Avatar
 
Join Date: Jun 2012
Posts: 2,173
Default

Hi, interesting pre going on now too. Unfortunately no time for that or scripts for a few days . I am on phone now...

I am ok with just the main entree meat and potatoes thing. The third integer is kind of nitpicking thing. So I don't have a really strong opinion about the following. I guess I was looking at it from perspective of recalling unexpected windows with reapers native actions because that's how I ran into it.

So it looks like you would have to do chunk twice to even return a variable for scripter to use when on lining. 1 read 1 write. Maybe best to forget that then...

But what about setting the third number when off lining? Would optional second variable be troublesome? (Edit. Maybe multiple choice int?) Seems that would not be heavy addition speed wise.

Also, would it be any good to have the Get function gets the other numbers too? I don't know if third number is really useful but seems like some scripter might want bypass info too. He wouldn't have to run a different function then. Just some ideas. Thinking out loud basically...

Last edited by FnA; 10-24-2017 at 08:29 PM.
FnA is offline   Reply With Quote
Old 10-25-2017, 10:25 AM   #18
nofish
Human being with feelings
 
nofish's Avatar
 
Join Date: Oct 2007
Location: home is where the heart is
Posts: 12,107
Default

I've now made it so:

If a FX is floating when offlining, it'll float again when bringing back online.
I think that makes the most sense to me as it matches Reaper behaviour.

Link in post #8 is updated with the new version.
nofish is offline   Reply With Quote
Old 10-25-2017, 01:00 PM   #19
heda
Human being with feelings
 
heda's Avatar
 
Join Date: Jun 2012
Location: Spain
Posts: 7,268
Default

hehe.. your excuse was good, but you couldn't avoid doing the right thing I'll try to test it. It sure does work better than chunk edits in Lua, which I am never sure if they work well.
heda is offline   Reply With Quote
Old 10-25-2017, 01:27 PM   #20
nofish
Human being with feelings
 
nofish's Avatar
 
Join Date: Oct 2007
Location: home is where the heart is
Posts: 12,107
Default

Quote:
Originally Posted by heda View Post
hehe.. your excuse was good, but you couldn't avoid doing the right thing
You so hit the nail on the head it made me laugh !

Thanks if you get round testing it.
I mainly started this because it annoyed me a bit that for such seemingly common thing as offlining / onlining FX we need to resort to chunk manipulation in scripts.
nofish is offline   Reply With Quote
Old 10-25-2017, 03:21 PM   #21
FnA
Human being with feelings
 
FnA's Avatar
 
Join Date: Jun 2012
Posts: 2,173
Default

I will poke around that with some simple scripts over next few days.

Glad if heda will test, because I don't have experience with chunk issues myself.
FnA is offline   Reply With Quote
Old 10-25-2017, 06:21 PM   #22
nofish
Human being with feelings
 
nofish's Avatar
 
Join Date: Oct 2007
Location: home is where the heart is
Posts: 12,107
Default

Thanks for the offer Veto.

I don't know how to "pass a patch" though or what this means.
(Explaination welcome)

But - I can push the branch to my SWS fork on GitHub tomorrow (gotten quite late here already.)

This should also do or ?
nofish is offline   Reply With Quote
Old 10-26-2017, 03:56 AM   #23
nofish
Human being with feelings
 
nofish's Avatar
 
Join Date: Oct 2007
Location: home is where the heart is
Posts: 12,107
Default

Ah now that you say git feature.

I've seen that feature at some point but never used it so far.
I'm using SourceTree as git client and there it seems to be as easy to create a patch (just right-click commit(s) -> Create patch).

So here it is:
https://www.dropbox.com/s/rg9rshh0t0...ions.diff?dl=1

I've now also pushed the branch (but didn't submit a PR yet).
As I know you're also doing SWS contributions I'd appreciate if you (or anyone) is motivated to have a look at the code and share your thoughts (I'm still rather a beginner when it comes to C++). I've tried to comment quite thoroughly.

https://github.com/nofishonfriday/sw...cript.cpp#L977

Last edited by nofish; 10-26-2017 at 10:41 AM.
nofish is offline   Reply With Quote
Old 10-26-2017, 07:41 AM   #24
nofish
Human being with feelings
 
nofish's Avatar
 
Join Date: Oct 2007
Location: home is where the heart is
Posts: 12,107
Default

Thanks for having a look, appreciated.

Quote:
Compiling it here with gcc 4.8.4 I got errors "invalid conversion from ‘const void*’ to ‘void*’"
It looks like ParsePatch() needs a mutable string (char foo[]="bar") as 7th argument ("foo" only is immutable).
I wasn't aware of this, as compiling with MSVC I didn't get any errors, so that's valuable info. Fixed.

Quote:
Or did you want to use Parse() instead?
Looking through it, I indeed used ParsePatch() in some places where I could have used Parse(). Changed.

Quote:
- concerning issue 913 maybe for the final version add a note to the reascript help file that this function is a no-op if recording. It could be confusing for users if before or after the call of this function other stuff is happening and a scripter did not take account for this (because he did not know).
Good point. Done.

Quote:
Otoh other functions like BR_MIDI_CCLaneRemove() or BR_MIDI_CCLaneReplace() would need that note too.
I'd think that's a bigger project to tackle when is finally decided if the check should stay or not.

Quote:
- return -1 if no fx is found at FX idx
I see the usefulness but the thought was (for consistency) to make the function signature like the similar native API functions for bypass state Track/TakeFX_GetEnabled() which also return a bool and ...SetEnabled() returning void.

The patch and git repo is updated (though I did a amend / push force to not clutter SWS commit history), so if you get round to try to compile again let me know how it goes now.

Thanks again.

Last edited by nofish; 10-26-2017 at 07:53 AM.
nofish is offline   Reply With Quote
Old 10-26-2017, 10:56 AM   #25
nofish
Human being with feelings
 
nofish's Avatar
 
Join Date: Oct 2007
Location: home is where the heart is
Posts: 12,107
Default

You're right, I missed these three you mention, now fixed.

Quote:
Maybe there's a similar option set in MSVC?
I have to keep this in mind.
Actually I just started looking for it but I gave up already again for now.
So much options, warning levels etc. to wade through.

Quote:
I see, not great (no distinction between onlined FX and simply no FX) but not a big problem.
Yeah, maybe I should have not done the "consistency" approach to start with. Actually I don't fully understand why Justin didn't make the bypass functions also more useful as you say.
But I think I'll leave it as it is for now, as there are other functions scripters can use to check for FX presence.
nofish is offline   Reply With Quote
Old 10-26-2017, 01:45 PM   #26
nofish
Human being with feelings
 
nofish's Avatar
 
Join Date: Oct 2007
Location: home is where the heart is
Posts: 12,107
Default

Thanks for digging for me.

However...



I think that's because even though I use VS 2017 the SWS project is still a VS 2013 project and '/permissive-' was introduced in VS 2015.

So I guess I'm out of luck here.
nofish 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 11:22 PM.


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