Old 01-15-2024, 01:04 AM   #1121
mrelwood
Human being with feelings
 
mrelwood's Avatar
 
Join Date: Nov 2006
Location: Finland
Posts: 1,528
Default JSFX MIDI Quantize?

Just popped in my head... Why is there no MIDI Quantizer in JSFX format? Not even in ReaPack (that I found).

I'm working on a MIDI Groove Humanizator JSFX that would benefit from such a feature. The way I see it, it could be done. Read offset, read beat position (in more detailed format), add PDC, match made in heaven. No?

My first attempts were unsuccesful, but wanted to ask if there's a reason it wouldn't work, other than my bad coding.
__________________
______Announcing__mrelwood plugins______
.. MacBook Pro 16" Late '19 .. Scarlett 6i6, Saffire Pro 24 DSP (+ADA8000) .. FCA610 .. EVE SC207 .. Focal: Shape 65, Alpha 65, CMS 40, Listen Pro ..
mrelwood is offline   Reply With Quote
Old 01-24-2024, 11:24 AM   #1122
DThompson55
Human being with feelings
 
DThompson55's Avatar
 
Join Date: Mar 2015
Location: Central Connecticut
Posts: 347
Default

I wrote a little nodejs program to do this, although it's (obviously) not integrated into Reaper. So now I'd like to do it in EEL, or one of the other supported languages, adding some bells and whistles.

It seems to work just fine, after getting acquainted with EEL. I just need a few tweaks. A fun afternoon spent walking down the AIFF chunks until I found some midi, and then writing it to a file.

I was going to ask for help when I start writing this post, but it seems pretty straightforward.
__________________
It's like learning to paint with your ears.

Last edited by DThompson55; 01-25-2024 at 07:16 AM. Reason: it works now
DThompson55 is offline   Reply With Quote
Old 01-27-2024, 04:13 AM   #1123
Pratika
Human being with feelings
 
Join Date: Jan 2024
Posts: 2
Default Noob question

Hello there,
I am not even sure if I can achieve this using REAScript.

I would like to control via an API (http? osc? midi?) Reaper so that it can load samples, apply effects and play, listening to events such as sample play end.
I also would like to control a VST instrument in terms of settings and note on/off.

Do you think that's possible?

Cheers
Pratika is offline   Reply With Quote
Old 01-27-2024, 01:13 PM   #1124
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 6,621
Default

Welcome to the forum.

Regarding your question:

You must be more specific, as your description sounds like tons of different actions at once.

Where do you want to load samples and how?
How do you want to apply fx?
What do you mean by "events"?
What do you mean by "control a vst"? Play it? Set it's settings? Something else?
__________________
Use you/she/her.Ultraschall-Api Lua Api4Reaper - Donate, if you wish

On vacation for the time being...
Meo-Ada Mespotine is offline   Reply With Quote
Old 01-28-2024, 10:08 AM   #1125
Pratika
Human being with feelings
 
Join Date: Jan 2024
Posts: 2
Default

Thank you!
I am a classical musician and software developer with minimal experience on DAWs, so I am exploring the possibilities. Eventually I can code a custom OSC manager in NodeJS for sending/receiving messages. The goal is to have the DAW controlled automatically by an external intelligent piece of software without human intervention on the GUI.

Quote:
Originally Posted by Meo-Ada Mespotine View Post
Where do you want to load samples and how?
What do you mean by "events"?
I would like to play an arbitrary waveform from a path. The event would be "play end" when the waveform has finished playing. I am not sure if I can open a file inside a track with some predefined FXs or how.


Quote:
Originally Posted by Meo-Ada Mespotine View Post
How do you want to apply fx?
What do you mean by "control a vst"? Play it? Set it's settings? Something else?
For VST FX control its parameters in real time. Eventually through OSC messages?
For VST instruments send note on/off velocity events and control the instrument parameters.

Thanks!
Pratika is offline   Reply With Quote
Old 02-04-2024, 12:54 PM   #1126
Daimebag
Human being with feelings
 
Join Date: May 2014
Location: France
Posts: 24
Default

Hi,

is there any Toast Notification API/Listener in Reaper to tell to reaper to Display a temporary title and message?
Daimebag is offline   Reply With Quote
Old 02-06-2024, 09:37 PM   #1127
davrob01
Human being with feelings
 
Join Date: Feb 2024
Posts: 3
Default Run a ReaScript when a track is rec armed

Hi, is there possibly a way to trigger/run a ReaScript when any track is rec armed, without hotkeys?

I realized that one way, is to use a hotkey with a custom action that will arm a track # and then run the script. Then do the same thing for all track numbers, using a hotkey for each.

But is there a way to do this without a hotkey? For example, if any track is armed, then run the script? Even if it is armed in the UI or with a hotkey or whatever.

Thank you
davrob01 is offline   Reply With Quote
Old 02-06-2024, 11:22 PM   #1128
AZpercussion
Human being with feelings
 
Join Date: Oct 2019
Location: Moscow / Tbilisi
Posts: 909
Default

Quote:
Originally Posted by davrob01 View Post
Hi, is there possibly a way to trigger/run a ReaScript when any track is rec armed, without hotkeys?
You can make deffered script. It will checking is any track is rec armed every loop and then will run other actions/scripts etc.
So that you need to run this script on reaper start, it's possible with SWS startup actions as example.
AZpercussion is offline   Reply With Quote
Old 02-07-2024, 02:03 PM   #1129
davrob01
Human being with feelings
 
Join Date: Feb 2024
Posts: 3
Default

Quote:
Originally Posted by AZpercussion View Post
You can make deffered script. It will checking is any track is rec armed every loop and then will run other actions/scripts etc.
So that you need to run this script on reaper start, it's possible with SWS startup actions as example.
Thank you for this response. Can you possibly point me to a simple example of a deffered script?

I understand there is the reaper.defer and reaper.runloop functions, but I dont understand how I would hook into any sort of event handler. Because I want to essentially do a function, but only when a track is armed.

Attached is an example of my attempt at using the defer function, but I am clearly missing something. My example has logic to simply output the name of the first FX in the first armed track that it finds. This works fine when I run the script manually.

Thank you

EDIT: After looking around the forums, I realized I can make the target function call itself, using the defer function again INSIDE the target function itself. This seems to be the 'proper' way. But correct me if I am wrong.

After I realized I could do that, I adjusted my script so that it would only output the FX name if it was different from the previous FX name (ie if there was a change). Otherwise it was constantly outputting and that's not ideal obviously. This seems to work well. In my real use case, I will be outputting to a file instead of console, which should work fine with this approach.

I have attached my new example script (test - loop2.lua).

Thank you so much
Attached Files
File Type: lua test - loop.lua (608 Bytes, 17 views)
File Type: lua test - loop2.lua (954 Bytes, 20 views)

Last edited by davrob01; 02-07-2024 at 02:41 PM.
davrob01 is offline   Reply With Quote
Old 02-08-2024, 12:20 AM   #1130
mountwest
Human being with feelings
 
mountwest's Avatar
 
Join Date: Jun 2023
Location: Stockholm, Sweden
Posts: 34
Default

I'm looking at the possibilities of building a script with imported libraries to be able to perform HTTPS-requests, but I am not sure how it would work for a user if they decide to use my script.

Wouldn't they need to install each separate library themselves after they have gotten my script?

My primary script is in Lua and at first I tried to see if I could make the libraries "portable" (I don't know the correct term) so they could come included in my package and the user could start the script without needing to go through lots of extra steps of installing libraries.

I couldn't really see a way to do it until I looked at implementing a solution through Python which gave me my hopes back, but it does use imports in a similar fashion.

Is there a way to implement libraries in Lua and Python without requiring some extra installs and configurations on the user's end?
__________________
MWM ReaScripts for free
mountwest is offline   Reply With Quote
Old 02-08-2024, 11:37 AM   #1131
davrob01
Human being with feelings
 
Join Date: Feb 2024
Posts: 3
Default A way to get the preset name - within the VST3 plugin itself

Hello again,

Another question - I am looking for a way to get the preset name - within the VST3 plugin itself.

To be clear, I am not referring to the preset that you would get from reaper.TrackFX_GetPreset - that doesn't seem to be what I want. That is the preset managed by Reaper, but I am not using that.

I want the name of the preset within a plugin's UI - such as Amplitube 5's plugin UI. You know how there is a preset you select in the plugin UI. That's what I want - the name of that!

I realize this may be impossible, but I know that reaper knows which preset is selected within my plugins already because it restores them properly every time I load a project. But is there a way to get that value programmatically - either by reading a file or using the API ?

I tried looking in the project file, but the preset name is not stored in plain text.

I imagine this may be difficult and possibly plugin dependent. But granted that reaper saves/restores this value on project load, it must be available somewhere. Of course, I would like to get it in realtime.

Last edited by davrob01; 02-08-2024 at 01:19 PM.
davrob01 is offline   Reply With Quote
Old 02-08-2024, 01:00 PM   #1132
AudioBabble
Human being with feelings
 
AudioBabble's Avatar
 
Join Date: Dec 2021
Location: Jupiter Island
Posts: 924
Default

I could be wrong, but I suspect the best you'll get is maybe an index number or code for the preset, rather than the text of the name itself. If you were fortunate enough to have a text based list of the presets, this could possibly be cross-referenced, but it's sadly quite rare for this to be included with vst documentation. Or... maybe the presets are all present as files in a particular folder and could be index-referenced.. but even that isn't always the case either.
Pure conjecture really since I don't know much about this stuff... so maybe someone else can shed light on this.
I would be very interested to know if such a thing is possible too!
__________________
{Read This} | {FR - FX inserts on sends} | {latest drivel}
AudioBabble is offline   Reply With Quote
Old 02-16-2024, 05:33 AM   #1133
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 6,621
Default

Quote:
Originally Posted by davrob01 View Post
Thank you for this response. Can you possibly point me to a simple example of a deffered script?

I understand there is the reaper.defer and reaper.runloop functions, but I dont understand how I would hook into any sort of event handler. Because I want to essentially do a function, but only when a track is armed.

Attached is an example of my attempt at using the defer function, but I am clearly missing something. My example has logic to simply output the name of the first FX in the first armed track that it finds. This works fine when I run the script manually.

Thank you

EDIT: After looking around the forums, I realized I can make the target function call itself, using the defer function again INSIDE the target function itself. This seems to be the 'proper' way. But correct me if I am wrong.

After I realized I could do that, I adjusted my script so that it would only output the FX name if it was different from the previous FX name (ie if there was a change). Otherwise it was constantly outputting and that's not ideal obviously. This seems to work well. In my real use case, I will be outputting to a file instead of console, which should work fine with this approach.

I have attached my new example script (test - loop2.lua).

Thank you so much
Information about defer:
https://forum.cockos.com/showpost.ph...2&postcount=21
__________________
Use you/she/her.Ultraschall-Api Lua Api4Reaper - Donate, if you wish

On vacation for the time being...
Meo-Ada Mespotine is offline   Reply With Quote
Old 02-18-2024, 09:04 AM   #1134
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 6,621
Default

I'm trying to set the cursor to a specific one, which works with this code:

Code:
local B1=reaper.JS_Mouse_LoadCursor(220)
reaper.JS_Mouse_SetCursor(B1)
However, when I move the mouse, it reverts back to a different cursor until I run the code above again.
This means that, when done in a defer-script, the cursor flickers when moving mouse, like with this code:

Code:
function main()
  local B1=reaper.JS_Mouse_LoadCursor(220)
  reaper.JS_Mouse_SetCursor(B1) 
  reaper.defer(main)
end

main()
How can I prevent the flickering?
__________________
Use you/she/her.Ultraschall-Api Lua Api4Reaper - Donate, if you wish

On vacation for the time being...
Meo-Ada Mespotine is offline   Reply With Quote
Old 02-18-2024, 09:21 AM   #1135
Sexan
Human being with feelings
 
Sexan's Avatar
 
Join Date: Jun 2009
Location: Croatia
Posts: 4,597
Default

Intercep first
Code:
reaper.JS_WindowMessage_Intercept(track_window, "WM_SETCURSOR", false)
And release when done

https://github.com/GoranKovac/ReaScr...51_RW.lua#L708
Sexan is offline   Reply With Quote
Old 02-19-2024, 08:56 AM   #1136
FeedTheCat
Human being with feelings
 
FeedTheCat's Avatar
 
Join Date: May 2019
Location: Berlin
Posts: 2,164
Default

If a script is run inside a custom action, is there a way to find out which custom action it is (cmd_id)?

I thought about parsing reaper-kb.ini but the same script could be included in multiple custom actions.
__________________
Featured scripts: REAPER Update UtilityLil ChordboxGridbox/Adaptive gridMX TunerRS5K LinkMIDI Editor Magic Donate💝: PayPal|ko-fi
FeedTheCat is online now   Reply With Quote
Old 02-22-2024, 12:08 PM   #1137
nscotto
Human being with feelings
 
Join Date: Jul 2020
Posts: 84
Default

I am trying to recreate the ableton workflow where you have your fx window at the bottom that can be switched with the midi editor using a hotkey, but never the two showed at the same time.

I have activated the single FX window instance, as well as the change of FX window by selected track.
I use @FeedTheCat great docker scripts for toggling that bottom window.

Now I would like to be able to make an action toggle between the FX window or the midi editor.
How do I do that?

Last edited by nscotto; 02-25-2024 at 10:59 AM.
nscotto is offline   Reply With Quote
Old 03-01-2024, 05:05 PM   #1138
captaincurrie
Human being with feelings
 
Join Date: Mar 2022
Posts: 62
Default How do i delete an automation item in reascript

Hello, there is no DeleteAutomationItem function in the API that
i've found. Is there any hack to do it?

Also, how can i find out if my mouse is hovering over an automation item, and then get said item.

Thank you

Last edited by captaincurrie; 03-01-2024 at 06:16 PM.
captaincurrie is offline   Reply With Quote
Old 03-02-2024, 04:02 AM   #1139
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 6,621
Default

My Ultraschall-Api has a delete-function for AutomationItems:
https://mespotin.uber.space/Ultrasch...ionItem_Delete

Getting an automation item you hover above should be possible.
Use GetThingFromPoint to get the track you are hovering above and BR_PositionAtMouseCursor to get the time-position at mouse-cursor.
Then compare time with all AutomationItems on the track to find the right one.
__________________
Use you/she/her.Ultraschall-Api Lua Api4Reaper - Donate, if you wish

On vacation for the time being...

Last edited by Meo-Ada Mespotine; 03-02-2024 at 04:07 AM.
Meo-Ada Mespotine is offline   Reply With Quote
Old 03-02-2024, 04:09 AM   #1140
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 6,621
Default

Quote:
Originally Posted by FeedTheCat View Post
If a script is run inside a custom action, is there a way to find out which custom action it is (cmd_id)?

I thought about parsing reaper-kb.ini but the same script could be included in multiple custom actions.
No, there's no way to get, in which custom action your script is running currently. Probably a good FR for another retval of get_action_context.
__________________
Use you/she/her.Ultraschall-Api Lua Api4Reaper - Donate, if you wish

On vacation for the time being...
Meo-Ada Mespotine is offline   Reply With Quote
Old 03-07-2024, 12:34 PM   #1141
captaincurrie
Human being with feelings
 
Join Date: Mar 2022
Posts: 62
Default

How do you insert an automation item by name?

For example, i have an automation item saved as "Cutoff.ReaperAutoItem". I would like to
use reascript to load it into a particular place.

The only function i see is
Code:
integer reaper.InsertAutomationItem(TrackEnvelope env, integer pool_id, number position, number length)
So i would have to get the pool_id of my saved automation item? Can you do that?

Thanks

Last edited by captaincurrie; 03-07-2024 at 01:31 PM.
captaincurrie is offline   Reply With Quote
Old 03-08-2024, 04:14 AM   #1142
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 6,621
Default

No, since the saved AutomationItem is like a template that you can load into any project. Its name is not used within the project itself and therefore can't be addressed.

It would be helpful if there would be a function to insert an AutomationItem from a file but that doesn't exist either.
__________________
Use you/she/her.Ultraschall-Api Lua Api4Reaper - Donate, if you wish

On vacation for the time being...
Meo-Ada Mespotine is offline   Reply With Quote
Old 03-08-2024, 04:18 AM   #1143
RubenB
Human being with feelings
 
Join Date: Jun 2022
Posts: 3
Default Implementing a PCM sink

Hi there wonderful coders of Reaper

I'm new on the forums here and currently doing a bit of a deep dive into Reaper Plugin writing (shoutout to SWS, learning a lot from their project), and can't find any reference as to how I'd go about implementing a PCM sink.

Specifically, the pcmsink_register_t mystifies me.

Code:
typedef struct _REAPER_pcmsink_register_t // register using "pcmsink"
{
  unsigned int (*GetFmt)(const char **desc);

  const char *(*GetExtension)(const void *cfg, int cfg_l);
  HWND (*ShowConfig)(const void *cfg, int cfg_l, HWND parent);
  PCM_sink *(*CreateSink)(const char *filename, void *cfg, int cfg_l, int nch, int srate, bool buildpeaks);

} pcmsink_register_t;
I can imagine what the ShowConfig and CreateSink functions expect, altough I'm not sure what the cfg and cgf_l (length of cfg?) allow me to do / expect me to do.

I'm assuming ShowConfig provides the option to show a configuration window to the user(?) and CreateSink requires me to prepare a sink for reaper to start writing to.

Could someone enlighten me as to what the various params and functions are expected to do? ^^'
RubenB is offline   Reply With Quote
Old 03-08-2024, 07:28 AM   #1144
captaincurrie
Human being with feelings
 
Join Date: Mar 2022
Posts: 62
Default

Quote:
Originally Posted by Meo-Ada Mespotine View Post
No, since the saved AutomationItem is like a template that you can load into any project. Its name is not used within the project itself and therefore can't be addressed.

It would be helpful if there would be a function to insert an AutomationItem from a file but that doesn't exist either.
Thanks. That's disappointing. I can add track templates with the reaper.Main_openProject function, why not automation items... I'll make a request.
captaincurrie is offline   Reply With Quote
Old 03-08-2024, 03:14 PM   #1145
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 RubenB View Post
Could someone enlighten me as to what the various params and functions are expected to do? ^^'
Not me, but here's a PCM_sink example plug-in from Justin, if that helps:
https://github.com/justinfrankel/rea...dk/example_raw
nofish is offline   Reply With Quote
Old 03-11-2024, 12:29 AM   #1146
RubenB
Human being with feelings
 
Join Date: Jun 2022
Posts: 3
Default

Quote:
Originally Posted by nofish View Post
Not me, but here's a PCM_sink example plug-in from Justin, if that helps:
https://github.com/justinfrankel/rea...dk/example_raw
Ah thank you so much, gonna look in to that!
RubenB is offline   Reply With Quote
Old 03-11-2024, 09:09 AM   #1147
captaincurrie
Human being with feelings
 
Join Date: Mar 2022
Posts: 62
Default

Hello, i have a LV2 plugin, "liquidsfz", that plays SFZ files. I would
like to change the currently loaded SFZ file via reascript.

At the moment i can access the plugin and get the name of the currently
loaded SFZ file via reaper.TrackFX_GetFormattedParamValue(), however all
attempts to set the value have failed.

The problem is that i want to set the value of the parameter as a string
(the filename/name of the SFZ file), but there doesn't seem to be a
reascript function that will set a param to a string value, only an
integer.

Anyways know how to do this?
captaincurrie is offline   Reply With Quote
Old 03-11-2024, 09:53 AM   #1148
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 6,621
Default

Quote:
Originally Posted by captaincurrie View Post
Hello, i have a LV2 plugin, "liquidsfz", that plays SFZ files. I would
like to change the currently loaded SFZ file via reascript.

At the moment i can access the plugin and get the name of the currently
loaded SFZ file via reaper.TrackFX_GetFormattedParamValue(), however all
attempts to set the value have failed.

The problem is that i want to set the value of the parameter as a string
(the filename/name of the SFZ file), but there doesn't seem to be a
reascript function that will set a param to a string value, only an
integer.

Anyways know how to do this?
It's not possible. Loaded filenames can only be set to ReaSamploMatic5000, as far as I know.
A plugin would need to support it, though I don't think that Reaper's api would give any plugin the opportunity afaik.
__________________
Use you/she/her.Ultraschall-Api Lua Api4Reaper - Donate, if you wish

On vacation for the time being...
Meo-Ada Mespotine is offline   Reply With Quote
Old 03-11-2024, 10:06 AM   #1149
captaincurrie
Human being with feelings
 
Join Date: Mar 2022
Posts: 62
Default

Quote:
Originally Posted by Meo-Ada Mespotine View Post
It's not possible. Loaded filenames can only be set to ReaSamploMatic5000, as far as I know.
A plugin would need to support it, though I don't think that Reaper's api would give any plugin the opportunity afaik.
Thanks again for your feedback. Thats disappointing. With other SFZ players, like sfizz, i can't even
access the the "SFZ File" parameter, so it seemed like i would be able to with this one.
captaincurrie is offline   Reply With Quote
Old 03-11-2024, 10:20 AM   #1150
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 6,621
Default

From what it looks like, your SFZ-player adds a parameter and names it after the filename, that's why you can access it.
But it's just the name of the parameter you can access. So even if you could set it, you would just rename the parametername, not load a different file.

Maybe it's a good idea to open up a feature request for sending commands from/to a plugin via TakeFX_SetNamedConfigParm or TrackFX_SetNamedConfigParm, so plugin developers could add it to their plugin.

If added, you could ask the developer of liquidsfz to implement it.
__________________
Use you/she/her.Ultraschall-Api Lua Api4Reaper - Donate, if you wish

On vacation for the time being...
Meo-Ada Mespotine is offline   Reply With Quote
Old 03-15-2024, 02:18 AM   #1151
chmaha
Human being with feelings
 
chmaha's Avatar
 
Join Date: Feb 2021
Posts: 2,261
Default

1) Is there a way to get the current (or next) recpass value via API without iterating through the statechunk of media items? Obviously this can be problematic if a user has deleted a false start take or similar. Clearly REAPER is storing this somewhere independent of media items.

Basically, I'd like my new take counter function to be always aligned with REAPER's recpass value independent of whatever dubious actions the user takes

2) Is there a way to switch focus to a desired project tab using the output from reaper.EnumProjects()? EDIT: oh cool, found reaper.SelectProjectInstance(ReaProject proj) and it takes the ReaProject retval output of EnumProjects...
__________________
ReaClassical -- Open Source Classical Music Editing Tools for REAPER | Donate via PayPal, Liberapay or Stripe
airwindows JSFX ports | Debian & Arch Pro Audio Guides

Last edited by chmaha; 03-15-2024 at 02:45 AM.
chmaha is offline   Reply With Quote
Old 03-15-2024, 10:25 AM   #1152
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 6,621
Default

Quote:
Originally Posted by chmaha View Post
1) Is there a way to get the current (or next) recpass value via API without iterating through the statechunk of media items? Obviously this can be problematic if a user has deleted a false start take or similar. Clearly REAPER is storing this somewhere independent of media items.
No, only statechunk. There's a FR for such a functionality that got recently bumped.
In there you can find example code from me that gets the recpass-counter from all statechunks in the project.
https://forum.cockos.com/showpost.ph...3&postcount=41

It's very slow, though, especially in projects with potentially thousands of items.
__________________
Use you/she/her.Ultraschall-Api Lua Api4Reaper - Donate, if you wish

On vacation for the time being...
Meo-Ada Mespotine is offline   Reply With Quote
Old 03-15-2024, 11:08 AM   #1153
chmaha
Human being with feelings
 
chmaha's Avatar
 
Join Date: Feb 2021
Posts: 2,261
Default

Quote:
Originally Posted by Meo-Ada Mespotine View Post
No, only statechunk. There's a FR for such a functionality that got recently bumped.
In there you can find example code from me that gets the recpass-counter from all statechunks in the project.
https://forum.cockos.com/showpost.ph...3&postcount=41

It's very slow, though, especially in projects with potentially thousands of items.
Thanks, yes, as it turns out I created my own: https://raw.githubusercontent.com/ch...%20Counter.lua

I think based on looking at yours it does something very similar but I didn't bother storing window location etc. It seems your logic includes more than just stop/play vs record states. Also I'm not sure about the tonumber(statechunk:match(" .- .- .- .- .- .- .- (.-) ")) stuff as I just used a simple tonumber(statechunk:match("RECPASS%s*(%d+)")). I wonder whether some corner case will have it blow up in my face

BTW, I also have a Find Takes function that uses the number before the file extension to jump to that item: https://raw.githubusercontent.com/ch...ind%20Take.lua
__________________
ReaClassical -- Open Source Classical Music Editing Tools for REAPER | Donate via PayPal, Liberapay or Stripe
airwindows JSFX ports | Debian & Arch Pro Audio Guides
chmaha is offline   Reply With Quote
Old 03-15-2024, 02:48 PM   #1154
FeedTheCat
Human being with feelings
 
FeedTheCat's Avatar
 
Join Date: May 2019
Location: Berlin
Posts: 2,164
Default

Maybe I_RECPASSID for GetMediaItemTakeInfo_Value? (might be something else, never used it)
__________________
Featured scripts: REAPER Update UtilityLil ChordboxGridbox/Adaptive gridMX TunerRS5K LinkMIDI Editor Magic Donate💝: PayPal|ko-fi
FeedTheCat is online now   Reply With Quote
Old 03-15-2024, 04:46 PM   #1155
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 6,621
Default

Quote:
Originally Posted by FeedTheCat View Post
Maybe I_RECPASSID for GetMediaItemTakeInfo_Value? (might be something else, never used it)
Not according to the docs, unless something's undocumented.

Quote:
Also I'm not sure about the tonumber(statechunk:match(" .- .- .- .- .- .- .- (.-) ")) stuff as I just used a simple tonumber(statechunk:match("RECPASS%s*(%d+)")).
Should be fine in your case, since you probably only use the first value anyways.
The function in question I took from my Ultraschall-API, where I try to return possible future values that might be added at some point by the devs.
__________________
Use you/she/her.Ultraschall-Api Lua Api4Reaper - Donate, if you wish

On vacation for the time being...
Meo-Ada Mespotine is offline   Reply With Quote
Old 03-15-2024, 05:26 PM   #1156
bamim2
Human being with feelings
 
Join Date: Dec 2008
Posts: 35
Default What do I have to do to use Aftertouch (Channel Pressure) in a script?

Quote:
Originally Posted by Justin View Post
If anybody wants to know how to do a particular task using the plug-in extension API, ask it here and we will either tell you, or interpret it as a request for that particular API!

-Justin
For quite a while now I've been trying to find or write a program (a VST/AU plugin or MIDI Plugin?) that sees my keyboard's MIDI Out as enters the MIDI In of my computer's MIDI Interface & copies the "Aftertouch" (Channel Pressure) data in real time & uses that data to run CC1 (Mod Wheel). So I'd basically be playing the Mod Wheel with Channel Aftertouch.

Why, you may ask? More & more writers of plugins are taking the shortest way through & often that means they don't support Aftertouch. Everybody supports the Mod Wheel.

I've been attempting to modify the "MIDI CC Mapper" script because it's already able to map CC, so it's really close to being able to do what I'm trying to do. I've spent hours looking through the docs on line trying to find a coding example of how AT is used. I've looked through all the scripts that start with "MIDI" & I have come up with nothing. It would be a huge help to me if you would be kind enough to point me in the right direction or even write a simple snippet of code as an example of how to use "Aftertouch" (sometimes called "Channel Aftertouch" or "Channel Pressure") in a script.

Thank you

Last edited by bamim2; 03-15-2024 at 05:29 PM. Reason: Accidentally hit the wrong key
bamim2 is offline   Reply With Quote
Old 03-16-2024, 02:26 AM   #1157
FeedTheCat
Human being with feelings
 
FeedTheCat's Avatar
 
Join Date: May 2019
Location: Berlin
Posts: 2,164
Default

Quote:
Originally Posted by Meo-Ada Mespotine View Post
Not according to the docs, unless something's undocumented.
Not sure I understand. Do you mean that it's not in the docs? Or that record pass ID is different from record pass?

__________________
Featured scripts: REAPER Update UtilityLil ChordboxGridbox/Adaptive gridMX TunerRS5K LinkMIDI Editor Magic Donate💝: PayPal|ko-fi
FeedTheCat is online now   Reply With Quote
Old 03-16-2024, 04:58 AM   #1158
chmaha
Human being with feelings
 
chmaha's Avatar
 
Join Date: Feb 2021
Posts: 2,261
Default

See https://forum.cockos.com/showthread....265145&page=27 for my solution which doesn't require multiple iterations through recpass.

In short, it uses the highest take number it finds at filename level before the extension to set the initial take number. This runs only once. Then we completely bypass the REAPER take system and use SNM_SetStringConfigVar() to set the next filename pattern based on the number shown in the take window. On exit, the function returns the value to whatever was set previously. Here's the raw file as it stands with a few more additions to follow: https://raw.githubusercontent.com/ch...%20Counter.lua
__________________
ReaClassical -- Open Source Classical Music Editing Tools for REAPER | Donate via PayPal, Liberapay or Stripe
airwindows JSFX ports | Debian & Arch Pro Audio Guides
chmaha is offline   Reply With Quote
Old 03-16-2024, 08:02 AM   #1159
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 6,621
Default

Quote:
Originally Posted by FeedTheCat View Post
Not sure I understand. Do you mean that it's not in the docs? Or that record pass ID is different from record pass?

Hmm, it looks like I accidentally checked docs for an earlier version of Reaper 7 so it's seems like it has been added since then...
__________________
Use you/she/her.Ultraschall-Api Lua Api4Reaper - Donate, if you wish

On vacation for the time being...
Meo-Ada Mespotine is offline   Reply With Quote
Old 03-16-2024, 01:14 PM   #1160
Flashmasterson
Human being with feelings
 
Join Date: Jan 2014
Posts: 3
Default How to make Shortcuts visible and add media files to it?

I'm at about "1:25 in this video of the REAPER setup and it's focused on Media files/organization:

https://www.youtube.com/watch?v=sF-m...JZp4Xu&index=3

Shortcuts isn't currently visible to me.

Last edited by Flashmasterson; 03-16-2024 at 05:37 PM.
Flashmasterson 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:13 PM.


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