Go Back   Cockos Incorporated Forums > REAPER Forums > ReaScript, JSFX, REAPER Plug-in Extensions, Developer Forum

Reply
 
Thread Tools Display Modes
Old 07-07-2015, 12:06 PM   #1
Breeder
Human being with feelings
 
Breeder's Avatar
 
Join Date: Nov 2010
Posts: 2,436
Default Lua: Load JS BPM Calculator with action (toolbar or shortcut)

Description:

The idea is quite simple. I've created JS plugin BPM Calculator, but the problem is that we usually don't want to think of it as a separate plugin loaded on some track, but as an independent tool on its own.
So I've created a simple Lua script which will load BPM Calculator on the Master track and unload it as soon as the FX window is closed (or the script is terminated):






What you will need and a few details on usage:

My JS BPM Calculator: https://stash.reaper.fm/v/7838/BPM%20Calculator
Special Lua script: https://stash.reaper.fm/v/24512/Util...e%20cursor.lua

Simply follow installation procedure for JS BPM Calculator and then import supplied Lua script into REAPER. After that, put it on your toolbar (or assign it a shortcut) and calculate away
To use this Lua scripts in REAPER, you will also need the to install SWS extension

When you try to turn off the BPM calculator by re-running the script for the first time, you will get prompted if you want to terminate or load new instance of the script. Simply terminate it and remember your answer. Like this:



Note that script depends on the name of JS BPM Calculator plugin. If by any chance you plan on renaming the plugin, script will no longer work. You can quickly fix that by chancing this line in the script so it's the same as your renamed JS BPM Calculator:
Code:
local g_fxName      = "BPM Calculator"



Change the position where BPM calculator gets loaded

If you don't like the fact that BPM Calculator is moved to mouse cursor, simply comment out (by prefixing the line with --) or delete this line from the script:
Code:
reaper.Main_OnCommand(reaper.NamedCommandLookup("_BR_MOVE_WINDOW_TO_MOUSE_H_M_V_T"), 0)
On the other hand, if you want for BPM Calculator to get loaded at different position from mouse cursor, change that line to some other SWS/BR action that moves window to mouse cursor. Like this:




A lot of effort has been invested in this. If you seriously use it, please consider supporting the developer. Thanks!

I don't mind if someone puts these in ReaPack, but please include my donation link, forum nickname and link to this thread and thread for a specific script in the description if you do so.

__________________
REAPER ReWorked: An elegant and self-sufficient all-around REAPER configuration
Other stuff

Last edited by Breeder; 09-03-2020 at 03:20 PM.
Breeder is offline   Reply With Quote
Old 07-07-2015, 04:36 PM   #2
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 9,875
Default

Nic ! and thanks for the detailed infos about it
X-Raym is offline   Reply With Quote
Old 07-07-2015, 05:46 PM   #3
daxliniere
Human being with feelings
 
daxliniere's Avatar
 
Join Date: Nov 2008
Location: London, UK
Posts: 2,581
Default

Wonderful
__________________
Puzzle Factory Sound Studios, London [Website] [Instagram]
[AMD 5800X, 32Gb RAM, Win10x64, NVidia GTX1080ti, UAD2-OCTO, FireFaceUCX, REAPER x64]
[Feature request: More details in Undo History]
daxliniere is offline   Reply With Quote
Old 11-02-2015, 12:38 PM   #4
amagalma
Human being with feelings
 
amagalma's Avatar
 
Join Date: Apr 2011
Posts: 3,451
Default

Thank you Breeder!

Win7 x64, Reaper 5.04, SWS 2.8.1 : the toggle does not work here. Have a look:



Any ideas why?
__________________
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 11-04-2015, 11:51 AM   #5
amagalma
Human being with feelings
 
amagalma's Avatar
 
Join Date: Apr 2011
Posts: 3,451
Default

I tried it on a fresh portable install of Reaper and it does not work there either. Is it some bug of v5.04?
__________________
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 11-04-2015, 06:03 PM   #6
ericzang
Human being with feelings
 
ericzang's Avatar
 
Join Date: Mar 2014
Location: Phoenix, AZ
Posts: 488
Default

So cool Breeder, thanks again! It is so simple to customize this for any plugin, such as a frequency analyzer. In the script I simply replaced BPM Calc with another uniquely named plugin (as would work when adding an effect with the Console command "x").

PS Amagalma, seems to be working properly for me. Same specs as you.

Curiously the action with a shortcut via MIDI message can only open the plugin, but not toggle it closed. Keyboard shortcut works no problem.

Last edited by ericzang; 11-04-2015 at 06:57 PM.
ericzang is offline   Reply With Quote
Old 11-05-2015, 04:20 AM   #7
amagalma
Human being with feelings
 
amagalma's Avatar
 
Join Date: Apr 2011
Posts: 3,451
Default

I tried it in all ways: via a toolbar button, via "run" in the action list and by assigning a key to it.. no luck! :/
And all this in a clean portable install of R5..
__________________
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 02-13-2020, 03:12 PM   #8
grandfougue
Human being with feelings
 
grandfougue's Avatar
 
Join Date: Sep 2016
Posts: 513
Default

toggle does not work on portable install he open many instance

Last edited by grandfougue; 02-14-2020 at 03:27 PM.
grandfougue 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:48 AM.


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