Old 09-20-2017, 12:15 PM   #1
eugen2777
Human being with feelings
 
eugen2777's Avatar
 
Join Date: Aug 2012
Posts: 271
Default Lua:FXChain(for Dev)

https://raw.githubusercontent.com/EU...ctions/FXChain
__________________
ReaScripts

Last edited by eugen2777; 09-20-2017 at 08:58 PM.
eugen2777 is offline   Reply With Quote
Old 09-20-2017, 07:24 PM   #2
eugen2777
Human being with feelings
 
eugen2777's Avatar
 
Join Date: Aug 2012
Posts: 271
Default

Okay, if no one wants it, I will delete this thread, had chances.Best wishes
__________________
ReaScripts

Last edited by eugen2777; 09-20-2017 at 07:31 PM.
eugen2777 is offline   Reply With Quote
Old 09-20-2017, 08:44 PM   #3
mpl
Human being with feelings
 
mpl's Avatar
 
Join Date: Oct 2013
Location: Moscow, Russia
Posts: 3,960
Default

Quote:
Originally Posted by eugen2777 View Post
Okay, if no one wants it, I will delete this thread, had chances.Best wishes
So dumb act.
mpl is offline   Reply With Quote
Old 09-20-2017, 08:53 PM   #4
eugen2777
Human being with feelings
 
eugen2777's Avatar
 
Join Date: Aug 2012
Posts: 271
Default

Michael, I'm very glad to see you!
Короче, я очень-очень рад видеть тебя!
In short, I'm very, very glad to see you!
If you need a thing - spread it back!
Just look, the thing is really cool!
__________________
ReaScripts
eugen2777 is offline   Reply With Quote
Old 09-20-2017, 09:02 PM   #5
eugen2777
Human being with feelings
 
eugen2777's Avatar
 
Join Date: Aug 2012
Posts: 271
Default

Link in first post, it's cool script.
You will see it!
__________________
ReaScripts
eugen2777 is offline   Reply With Quote
Old 09-20-2017, 09:09 PM   #6
deeb
Human being with feelings
 
deeb's Avatar
 
Join Date: Feb 2017
Posts: 4,813
Default

Hey eugen! Hope you good !

i got an error:



where can i get this required stuff?
Code:
local mouse = require "mouse"
local Button_class = require "button class"

I thought we were very limited on requiring stuff inside reaper!

Thank you
Attached Images
File Type: png Screen Shot 2017-09-21 at 05.05.35.png (41.3 KB, 834 views)
deeb is offline   Reply With Quote
Old 09-20-2017, 09:18 PM   #7
eugen2777
Human being with feelings
 
eugen2777's Avatar
 
Join Date: Aug 2012
Posts: 271
Default

You do not need this!
Just put comments
__________________
ReaScripts
eugen2777 is offline   Reply With Quote
Old 09-20-2017, 09:21 PM   #8
deeb
Human being with feelings
 
deeb's Avatar
 
Join Date: Feb 2017
Posts: 4,813
Default

Quote:
Originally Posted by eugen2777 View Post
You do not need this!
Just put comments
why do you need them?

i commented but then i get errors after errors!
deeb is offline   Reply With Quote
Old 09-20-2017, 09:23 PM   #9
eugen2777
Human being with feelings
 
eugen2777's Avatar
 
Join Date: Aug 2012
Posts: 271
Default

Well, you have to create a very simple script!
__________________
ReaScripts

Last edited by eugen2777; 09-20-2017 at 09:41 PM.
eugen2777 is offline   Reply With Quote
Old 09-20-2017, 09:29 PM   #10
eugen2777
Human being with feelings
 
eugen2777's Avatar
 
Join Date: Aug 2012
Posts: 271
Default

Now, any connection will be fine!
I'm saying exactly!
__________________
ReaScripts
eugen2777 is offline   Reply With Quote
Old 09-20-2017, 09:32 PM   #11
deeb
Human being with feelings
 
deeb's Avatar
 
Join Date: Feb 2017
Posts: 4,813
Default

Quote:
Originally Posted by eugen2777 View Post
Now, any connection will be fine!
I'm saying exactly!
i don't know i tried and something not good here! or probably you should update the initial code! just saying! i'll try tommorow!

Good night!
deeb is offline   Reply With Quote
Old 09-20-2017, 09:38 PM   #12
eugen2777
Human being with feelings
 
eugen2777's Avatar
 
Join Date: Aug 2012
Posts: 271
Default

Ok. I have very symple example usage.
Code:
----------------
function msg(m) reaper.ShowConsoleMsg("\n" .. m) end

--------------------------------------------------
function get_script_path() -- script_path and name from reaper function
  local filename = select(2, reaper.get_action_context())
  local script_path, script_name = filename:match("^(.*)[\\/](.+)")
  return script_path, script_name
end
----------
function modify_package_path(new_path) -- add new path to package.path
  package.path = package.path .. ";" .. new_path .. "/?.lua"
end

-- Get pathes -------------------------------------
local script_path, script_name = get_script_path()


-- Add script path to package.path
modify_package_path(script_path)


local FXChain = require "FXChainForTest"

----------------------------------------------------------
-- Test!!!------------------------------------------------
----------------------------------------------------------
track = reaper.GetSelectedTrack(0, 0)

function SeAllFXBypass(track)
  local fx_cnt = reaper.TrackFX_GetCount(track)
  local fx_chain = FXChain.Get(track)
  for i = 1, fx_cnt do
    local fx_chunk = FXChain.GetFXChunk(fx_chain, i)
    local bp1, bp2, bp3 = fx_chunk:match("BYPASS (%d) (%d) (%d)\n")
    if bp1 == "1" then bp1 = "0" elseif bp1 == "0" then bp1 = "1" end
    local new_state = "BYPASS ".. bp1 .. " " .. bp2 .. " " .. bp3 .. "\n"
    fx_chunk = fx_chunk:gsub("BYPASS %d %d %d\n", new_state)
    FXChain.SetFXChunk(fx_chain, fx_chunk, i)
  end
  local use_src_track_chunk = false
  FXChain.Set(track, fx_chain, use_src_track_chunk)
end

function SeAllFXOffline(track)
  local fx_cnt = reaper.TrackFX_GetCount(track)
  local fx_chain = FXChain.Get(track)
  for i = 1, fx_cnt do
    local fx_chunk = FXChain.GetFXChunk(fx_chain, i)
    local bp1, bp2, bp3 = fx_chunk:match("BYPASS (%d) (%d) (%d)\n")
    if bp2 == "1" then bp2 = "0" elseif bp2 == "0" then bp2 = "1" end
    local new_state = "BYPASS ".. bp1 .. " " .. bp2 .. " " .. bp3 .. "\n"
    fx_chunk = fx_chunk:gsub("BYPASS %d %d %d\n", new_state)
    FXChain.SetFXChunk(fx_chain, fx_chunk, i)
  end
  local use_src_track_chunk = false
  FXChain.Set(track, fx_chain, use_src_track_chunk)
end
__________________
ReaScripts
eugen2777 is offline   Reply With Quote
Old 09-20-2017, 09:43 PM   #13
eugen2777
Human being with feelings
 
eugen2777's Avatar
 
Join Date: Aug 2012
Posts: 271
Default

Are you alive there?
__________________
ReaScripts
eugen2777 is offline   Reply With Quote
Old 09-21-2017, 01:30 AM   #14
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 9,875
Default

@eugen2777
Be patient ! Scripts for developers have less feedbacks than others. Sometimes they are too specific and it takes a while before someone bump the thread. People need time to find the script, understand the code, make their experiments, and their are often from different time zones... that doesn't your work isn't appreciated. People love your stuffs !

In this case, I think just a bit more documentation is needed.
:P
X-Raym is offline   Reply With Quote
Old 09-21-2017, 08:19 AM   #15
mpl
Human being with feelings
 
mpl's Avatar
 
Join Date: Oct 2013
Location: Moscow, Russia
Posts: 3,960
Default

Quote:
Originally Posted by eugen2777 View Post
If you need a thing - spread it back!
Just look, the thing is really cool!
Sorry, I'm currently out of these things(especially chunking) and more about
developing stuff for everyday use (for example RS5k and Sequence management)
mpl is offline   Reply With Quote
Old 09-21-2017, 12:15 PM   #16
me2beats
Human being with feelings
 
me2beats's Avatar
 
Join Date: Jul 2015
Location: Yekaterinburg, Russia
Posts: 400
Default

Very cool arsenal of functions! I wıll use em in my further scripts. Thanx a lot!
Do you plan to do this for items (Items Chunks)? would be completely awesome
__________________
My Reapack Repo
Donation
me2beats is offline   Reply With Quote
Old 09-21-2017, 12:56 PM   #17
amagalma
Human being with feelings
 
amagalma's Avatar
 
Join Date: Apr 2011
Posts: 3,451
Default

Very useful functions! Thank you eugen!
__________________
Most of my scripts can be found in ReaPack.
If you find them useful, a donation would be greatly appreciated! Thank you! :)
amagalma is offline   Reply With Quote
Old 10-22-2017, 05:43 PM   #18
eugen2777
Human being with feelings
 
eugen2777's Avatar
 
Join Date: Aug 2012
Posts: 271
Default

I updated the script.
<PROGRAMENV...> section now regarging.
And all plink rebuilds when FX chain changed
__________________
ReaScripts
eugen2777 is offline   Reply With Quote
Old 10-24-2017, 12:38 PM   #19
lb0
Human being with feelings
 
Join Date: Apr 2014
Posts: 4,171
Default

Just like to pop into this thread to say good work!

I've written mostly my own dedicated functions to deal with track/fx chunk parsing - but always thought it would be neat to have a dedicated set of functions that just work and can be relied upon.

Your functions look a little neater than mine and your command of the Lua language definitely appears more advanced than my own so thanks for sharing - it's always useful to analyze others code to see where I can improve my own.

Unfortunately for my paid work I moved on from languages like C and C++ 20 years ago - and have been programming in VB and VBA for so many years now that I've developed a coding style more suited to that. It takes a while to adjust to the more efficient methods of programming in a language like Lua. I will say that since learning Lua, the switch back to VB for work each day is a painful one
__________________
Projects - Reascripts - Lua:
Smart Knobs 2 | LBX Stripper | LBX Floating FX Positioner
Donate via Paypal | LBX Tools Website
lb0 is offline   Reply With Quote
Old 11-01-2017, 12:56 PM   #20
TonE
Human being with feelings
 
Join Date: Feb 2009
Location: Reaper HAS send control via midi !!!
Posts: 4,031
Default

Thanks eugen for all your great scripts, did not check this yet, but after your initial comment, I thought I have to thank here also! Thanks a lot for great scripts and sharing them generously, like mpl and many many others! Thanks to all of you.
TonE is offline   Reply With Quote
Old 11-09-2017, 06:57 AM   #21
eugen2777
Human being with feelings
 
eugen2777's Avatar
 
Join Date: Aug 2012
Posts: 271
Default

Hello, lb0. Perhaps this small code will help other people avoid the errors associated with the chunks.
Some errors when working with the chunk are not obvious and are difficult to detect.
For example:
Combination PARENV(LFO, Links etc) + more then one FX + Allow Live FX multiprocessing on in preferences.
This is a critical error.
It is in all scripts, even in SWS extensions(Resources>FXChain)

__________________
ReaScripts

Last edited by eugen2777; 11-09-2017 at 07:09 AM.
eugen2777 is offline   Reply With Quote
Old 11-11-2017, 11:21 AM   #22
lb0
Human being with feelings
 
Join Date: Apr 2014
Posts: 4,171
Default

Quote:
Originally Posted by eugen2777 View Post
Hello, lb0. Perhaps this small code will help other people avoid the errors associated with the chunks.
Some errors when working with the chunk are not obvious and are difficult to detect.
Thanks Eugen - I shall take a look when I have a bit of time to work out what I need to do to fix. Are you saying your code here works ok - if so I shall analyse.





Thanks for the solution. No idea how you worked that one out!!

Now to implement thoughout my code :/
__________________
Projects - Reascripts - Lua:
Smart Knobs 2 | LBX Stripper | LBX Floating FX Positioner
Donate via Paypal | LBX Tools Website

Last edited by lb0; 11-11-2017 at 03:44 PM.
lb0 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 02:07 AM.


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