Old 02-21-2022, 12:10 AM   #921
mrelwood
Human being with feelings
 
mrelwood's Avatar
 
Join Date: Nov 2006
Location: Finland
Posts: 1,528
Default

Quote:
Originally Posted by Six View Post
Apologies, I posted this as a new thread in the dev forum like a dunce.

I want to create a very minimal tuner GUI that can be docked at the top of the screen.
Count me in for a sure user of such plugin!

I’m not familiar with the LUA restrictions, but if it can’t receive audio, I would think that you could have an EEL plugin doing the heavy lifting and only sending the tuning offset as gmem to the LUA to be drawn in the GUI.

Either way, please let us know if you get it to work. Mee wants!
__________________
______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 02-21-2022, 06:09 PM   #922
AvianWaves
Human being with feelings
 
Join Date: Nov 2017
Posts: 12
Default Retrieve and set the "active" track

LUA script, creating a custom action to do some UI shortcuts.

How do I get and set the active track? By "active" I mean the current track that has input focus, which would be the last track that the user clicked on or used arrow keys to move to. This is different from the selected track(s) which is just which tracks currently have selection.

I tried reaper.GetTrackSelected and reaper.SetTrackSelected (as mentioned above). I also fiddled with reaper.GetLastTouchedTrack (which just seems to only show the top-most selected track, not the same as the "active" track).

Thank you, you wonderful people!
AvianWaves is offline   Reply With Quote
Old 02-24-2022, 01:19 AM   #923
Six
Human being with feelings
 
Six's Avatar
 
Join Date: Jan 2012
Posts: 18
Default

Quote:
Originally Posted by mrelwood View Post
Count me in for a sure user of such plugin!

I’m not familiar with the LUA restrictions, but if it can’t receive audio, I would think that you could have an EEL plugin doing the heavy lifting and only sending the tuning offset as gmem to the LUA to be drawn in the GUI.

Either way, please let us know if you get it to work. Mee wants!

Didn't even need gmem, just read the frequency out from a parameter slider

It's not perfect but it's usable
DockTuner
Six is offline   Reply With Quote
Old 03-12-2022, 07:10 PM   #924
toddkc
Human being with feelings
 
Join Date: Dec 2011
Posts: 11
Default

How do I learn more about plugin UI? For example I would like to do what ReaEQ has with the "Add Band" button that adds a new tab. I can't seem to find the code for ReaEQ to see how it's done. Thanks!
toddkc is offline   Reply With Quote
Old 03-12-2022, 07:22 PM   #925
cfillion
Human being with feelings
 
cfillion's Avatar
 
Join Date: May 2015
Location: Québec, Canada
Posts: 4,968
Default

ReaEQ is a closed-source VST plugin. It uses a standard Windows control for its tabbar. (Using SWELL's implementation on macOS/Linux.)

https://docs.microsoft.com/en-us/win...s/tab-controls
cfillion is offline   Reply With Quote
Old 03-13-2022, 06:07 AM   #926
toddkc
Human being with feelings
 
Join Date: Dec 2011
Posts: 11
Default

Quote:
Originally Posted by cfillion View Post
ReaEQ is a closed-source VST plugin. It uses a standard Windows control for its tabbar. (Using SWELL's implementation on macOS/Linux.)

https://docs.microsoft.com/en-us/win...s/tab-controls
Thanks! That may be a bit advanced for my first foray into reaper plugin dev, I might see what I can do with just JSFX for now.
toddkc is offline   Reply With Quote
Old 03-13-2022, 05:38 PM   #927
mrelwood
Human being with feelings
 
mrelwood's Avatar
 
Join Date: Nov 2006
Location: Finland
Posts: 1,528
Default

Quote:
Originally Posted by toddkc View Post
Thanks! That may be a bit advanced for my first foray into reaper plugin dev, I might see what I can do with just JSFX for now.
JSFX is surprisingly powerful for all kinds of UIs! Although you might need to have some imagination for more advanced things… But almost anything can be done.

Check out my plugins EQAll, MotherComp and BAMP for a few examples/ideas:

https://mrelwood5.wixsite.com/plugins
__________________
______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 03-14-2022, 08:02 AM   #928
toddkc
Human being with feelings
 
Join Date: Dec 2011
Posts: 11
Default

Quote:
Originally Posted by mrelwood View Post
JSFX is surprisingly powerful for all kinds of UIs! Although you might need to have some imagination for more advanced things… But almost anything can be done.

Check out my plugins EQAll, MotherComp and BAMP for a few examples/ideas:

https://mrelwood5.wixsite.com/plugins
Your plugins look great! Do you do all the things yourself or is there some UI/GUI library you wouldn't mind sharing? I found jsfx-ui-lib but that's the only option I can see. My first attempt is pretty basic but does almost exactly what I need, so yay!

https://github.com/toddkc/JSFX_MIDI_Snapshots
toddkc is offline   Reply With Quote
Old 03-14-2022, 02:07 PM   #929
adu89
Human being with feelings
 
Join Date: Mar 2019
Posts: 8
Default

Hello, I have a a couple of questions:

1) Is there any way to get the final paths of files that are to be rendered with the most recent rendering settings before the actual render is performed (including silent renaming that is going to be done)?

I know I can get the info after the render using "GetSetProjectInfo_String" with desc "RENDER_STATS". This doesn't suit my needs as I would need to show the user before the render is performed (as a sort of preview).

2) Is it possible to know if a render run has failed via the extension api? I trigger a render using action "File: Render project, using the most recent render settings, auto-close render dialog" via "Main_OnCommand(42230, 1)". Is it possible to know (programatically) if there where any failures during the render?
adu89 is offline   Reply With Quote
Old 03-14-2022, 07:06 PM   #930
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 6,630
Default

Quote:
Originally Posted by adu89 View Post
Hello, I have a a couple of questions:

1) Is there any way to get the final paths of files that are to be rendered with the most recent rendering settings before the actual render is performed (including silent renaming that is going to be done)?

I know I can get the info after the render using "GetSetProjectInfo_String" with desc "RENDER_STATS". This doesn't suit my needs as I would need to show the user before the render is performed (as a sort of preview).

2) Is it possible to know if a render run has failed via the extension api? I trigger a render using action "File: Render project, using the most recent render settings, auto-close render dialog" via "Main_OnCommand(42230, 1)". Is it possible to know (programatically) if there where any failures during the render?
1) RENDER_TARGETS is the attribute, that shows you the filenames, if rendered right now.
However, it will not check, if the filename needs to be incremented. So you need to check first, if the silently increment checkbox is checked and if yes, if the filename already exists and increment it yourself in that case.

I'm planning to add a function to my Ultraschall-Api that should do this automatically, but I haven't yet.

2) Best is to use my Ultraschall-Api(link in my signature), which does it for you. The rendering functions in it manage to check, if the file hasn't finished rendering due being canceled.

If you need to do it yourself, you have two options:
1) check if the filename exists after the rendering. Not sure if Reaper keeps incomplete rendered files but I doubt it.
2)set the option "add items to the project after rendering".
If tracks are added, rendering worked(you might need to remove them afterwards again). If no new tracks are added, rendering was aborted.

But as I said, best is to use my rendering functions, as coding most of the rendering-stuff yourself is really tedious.

Edit:
Here's the introduction page:
https://mespotin.uber.space/Ultrasch...1_Introduction
__________________
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-14-2022, 07:17 PM   #931
mrelwood
Human being with feelings
 
mrelwood's Avatar
 
Join Date: Nov 2006
Location: Finland
Posts: 1,528
Default

Quote:
Originally Posted by toddkc View Post
Your plugins look great! Do you do all the things yourself or is there some UI/GUI library you wouldn't mind sharing?
Nope, just bare old fashioned elbow grease and manual labor! If I get an idea of something, I can get pretty meticulous about it, so I’d have to do it manually in the end anyway.

I have noticed that I may be a bit of a loner regarding making JSFX GUIs.

Quote:
My first attempt is pretty basic but does almost exactly what I need, so yay!

https://github.com/toddkc/JSFX_MIDI_Snapshots
I’ll be sure to check that out!
__________________
______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 03-18-2022, 05:19 AM   #932
papagirafe
Human being with feelings
 
papagirafe's Avatar
 
Join Date: Aug 2020
Location: Brasil
Posts: 690
Default ShowConsoleMsg() for video presets

I am looking for way to access the debug console from video processor presets which desperately lacks this functionality (unless you pollute the video output itself). Can a JSFX use ShowConsoleMsg() or do I need some sort of background reascript that waits to receive messages through gmem? Thanx in advance.
papagirafe is offline   Reply With Quote
Old 03-28-2022, 09:02 AM   #933
adu89
Human being with feelings
 
Join Date: Mar 2019
Posts: 8
Default

For the following extension method:

bool (*GetSetProjectInfo_String)(ReaProject* project, const char* desc, char* valuestrNeedBig, bool is_set);

How can I find out what the size of valuestrNeedBig should be?
adu89 is offline   Reply With Quote
Old 03-28-2022, 09:41 AM   #934
nofish
Human being with feelings
 
nofish's Avatar
 
Join Date: Oct 2007
Location: home is where the heart is
Posts: 12,110
Default

Quote:
Originally Posted by adu89 View Post
For the following extension method:

bool (*GetSetProjectInfo_String)(ReaProject* project, const char* desc, char* valuestrNeedBig, bool is_set);

How can I find out what the size of valuestrNeedBig should be?
In C/C++ you mean?
Afaik there's no reliable (straightforward) way currently.
https://forum.cockos.com/showthread.php?t=221626

(In SWS e.g. we use looping and resizing the buffer until it fits:
https://github.com/reaper-oss/sws/bl...velope.cpp#L33)

edit:
Maybe scratch what I said above.
Just noticed GetSetProjectInfo_String wants a valuestrNeedBig, not a strNeedBig where you can specify a size (e.g. like for GetTrackStateChunk()). Not sure what a valuestrNeedBig actually is and how it should be handled.

edit2:
There are some hints in the API doc about how valuestr should be used, but I haven't used it myself in C/C++ API:

Quote:
RENDER_METADATA : get or set the metadata saved with the project (not metadata embedded in project media). Example, ID3 album name metadata: valuestr="ID3:TALB" to get, valuestr="ID3:TALB|my album name" to set. Call with valuestr="" and is_set=false to get a semicolon-separated list of defined project metadata identifiers.

RENDER_STATS : (read-only) semicolon separated list of statistics for the most recently rendered files. call with valuestr="XXX" to run an action (for example, "42437"=dry run render selected items) before returning statistics.

Last edited by nofish; 03-28-2022 at 10:38 AM.
nofish is offline   Reply With Quote
Old 03-28-2022, 10:28 AM   #935
adu89
Human being with feelings
 
Join Date: Mar 2019
Posts: 8
Default

Quote:
Originally Posted by nofish View Post
In C/C++ you mean?
Afaik there's no reliable (straightforward) way currently.
https://forum.cockos.com/showthread.php?t=221626

(In SWS e.g. we use looping and resizing the buffer until it fits:
https://github.com/reaper-oss/sws/bl...velope.cpp#L33)

edit:
Maybe scratch what I said above.
Just noticed GetSetProjectInfo_String wants a valuestrNeedBig, not a strNeedBig where you can specify a size (e.g. like for GetTrackStateChunk()). Not sure what a valuestrNeedBig actually is and how it should be handled.
Thank you for the suggestions!
adu89 is offline   Reply With Quote
Old 04-01-2022, 09:53 AM   #936
kumamushi
Human being with feelings
 
Join Date: Mar 2022
Posts: 2
Default

Hi, I'm new to advanced DAWs like this, but I'd like to convert an app I wrote years ago to be a plugin of sorts for Midi Fighter 64 + Reaper. Essentially it would intercept the MIDI events from pressing different buttons in realtime, and change which note each button would play after it's been pressed so it would simultaneously play and record in Reaper. This would get fed into any subsequent VST plugins that allow me to use a soundfont to convert the output to something audible (I already have one of those picked out at least that works well). I'd also like to modify the lights on the Midi Fighter on the fly if that's possible, but that's just a bonus.

The operation flow would go like this:
Press Button 3 on the Midi Fighter 64
Button 3's note would play and record in Reaper
Button 1 now has Button 3's note value, Button 2 has Button 4's note value, Button 3 has Button 5's note value, etc.

The idea is to have a midi controller that I can play with relative button presses instead of absolute. What level of API would I need? VST, ReaScript, or something else? I also intend to have a simple UI that lets me change the scale of the notes.
kumamushi is offline   Reply With Quote
Old 04-01-2022, 12:58 PM   #937
nofish
Human being with feelings
 
nofish's Avatar
 
Join Date: Oct 2007
Location: home is where the heart is
Posts: 12,110
Default

Maybe have a look at ReaLearn, it can do dynamic mapping (that what's your essentially looking for if I got it right?), it's implemented as a VST and open source.
(ReaLearn thread: https://forum.cockos.com/showthread.php?t=178015).

Quote:
Originally Posted by kumamushi View Post
Hi, I'm new to advanced DAWs like this, but I'd like to convert an app I wrote years ago to be a plugin of sorts for Midi Fighter 64 + Reaper. Essentially it would intercept the MIDI events from pressing different buttons in realtime, and change which note each button would play after it's been pressed so it would simultaneously play and record in Reaper. This would get fed into any subsequent VST plugins that allow me to use a soundfont to convert the output to something audible (I already have one of those picked out at least that works well). I'd also like to modify the lights on the Midi Fighter on the fly if that's possible, but that's just a bonus.

The operation flow would go like this:
Press Button 3 on the Midi Fighter 64
Button 3's note would play and record in Reaper
Button 1 now has Button 3's note value, Button 2 has Button 4's note value, Button 3 has Button 5's note value, etc.

The idea is to have a midi controller that I can play with relative button presses instead of absolute. What level of API would I need? VST, ReaScript, or something else? I also intend to have a simple UI that lets me change the scale of the notes.
nofish is offline   Reply With Quote
Old 04-01-2022, 06:30 PM   #938
mrelwood
Human being with feelings
 
mrelwood's Avatar
 
Join Date: Nov 2006
Location: Finland
Posts: 1,528
Default

Quote:
Originally Posted by kumamushi View Post
Hi, I'm new to advanced DAWs like this, but I'd like to convert an app I wrote years ago to be a plugin of sorts for Midi Fighter 64 + Reaper. Essentially it would intercept the MIDI events from pressing different buttons in realtime, and change which note each button would play after it's been pressed so it would simultaneously play and record in Reaper. This would get fed into any subsequent VST plugins that allow me to use a soundfont to convert the output to something audible (I already have one of those picked out at least that works well). I'd also like to modify the lights on the Midi Fighter on the fly if that's possible, but that's just a bonus.

The operation flow would go like this:
Press Button 3 on the Midi Fighter 64
Button 3's note would play and record in Reaper
Button 1 now has Button 3's note value, Button 2 has Button 4's note value, Button 3 has Button 5's note value, etc.

The idea is to have a midi controller that I can play with relative button presses instead of absolute. What level of API would I need? VST, ReaScript, or something else? I also intend to have a simple UI that lets me change the scale of the notes.
Sounds like something that would be relatively easy to do as a (Reaper only) JS plugin. It’s an attractive and very capable format for making plugins. I have made a few myself… Click my signature for more info on those.

Load any JS plugin (several are included with Reaper) on a track and click the “Edit” button. This opens the whole plugin code in an editor that you can edit on the fly.

In your case I’d take for example the MIDI transpose plugin, duplicate the actual file, and make your own plugin from that. That’s how I started.
__________________
______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 04-01-2022, 09:03 PM   #939
kumamushi
Human being with feelings
 
Join Date: Mar 2022
Posts: 2
Default

Thanks for the suggestions! I'll check out both of those and get a feel for what would work best. This would indeed be a kind of dynamic mapping.
kumamushi is offline   Reply With Quote
Old 04-11-2022, 06:03 AM   #940
BenjyO
Human being with feelings
 
Join Date: Nov 2011
Posts: 308
Default Drawing rectangles on media items

I'm working on a script which detects silences based on a threshold in a longer segment of audio (dialogue), marks them (very similar to dynamic split) and analyzes their length (statistics). I'd like to be able to arbitrarily interact with these silences - delete some of them and add them somewhere where they weren't detected in the first place. Visually marking them is one of the issues at the moment.

I'd like to know what options do I have for marking these silences. At the moment the script marks them with razor edits which is OK, but I'm wondering if there's a better option for such a task. I like how dynamic split colors the silent areas - as if they were muted. Is there a way to do that in ReaScript?
__________________
Check out some of my music
BenjyO is offline   Reply With Quote
Old 04-11-2022, 05:44 PM   #941
IonianStreams
Human being with feelings
 
IonianStreams's Avatar
 
Join Date: May 2019
Location: Front Range Colorado
Posts: 17
Default Unpredictable mouse modifier arpeggiate behavior

Following the instructions here...
https://forum.cockos.com/showpost.ph...05&postcount=4
https://forum.cockos.com/showpost.ph...41&postcount=7
https://www.youtube.com/watch?v=UkdrS5J_CD4&t=52s
...I set up the mouse modifier to use left-click-drag on a group of notes to arpeggiate or strum a chord ("just stretch" option).

It's exactly what I want -- almost. The examples above would seem to show that it only works on pre-selected notes such as a chord. However, on my system at least, it ignores the pre-selected notes, selects an apparently random set of notes (often all the notes in the measure), and then does the strum on all those notes. I just want it to use the pre-selected notes only, ignoring all other non-selected notes. (The workaround is to move the desired notes into a completely blank measure, use the mouse modifier strum there, and move the notes back to original position. Also, but less important, I would like it to drag only the beginning note edges, not the whole note.)

What's up? Is this the proper behavior of this mouse modifier?

I know this mouse modifier is an action "Set default mouse modifier action for MIDI note left drag to Stretch note positions (arpeggiate)". But the Actions dialog does not let me click the "Edit Action" button to see the code and maybe "fix" it for my purposes. Where is this source code?


Edit: Solved... Just mouse modifier confusion. For the strum action, I had set Ctrl+Alt+left-click-drag for the mouse modifier. Turns out that Ctrl+Alt+left-click (no drag) was also set to "select note and all later notes". So the left-click happened first, selecting the pre-selected notes I wanted to strum plus all later notes in the MIDI item. Then left-drag applied the strum to all those notes. So, I just used Shift+Ctrl+Alt+left-click-drag for the strum action (because Shift+Ctrl+Alt+left-click is unassigned and won't interfere).
__________________
I understand. At least I think I understand, which is the same thing... I think.
My music made with Reaper: https://www.youtube.com/channel/UC5y...G03G5UQBR22Yfw

Last edited by IonianStreams; 04-16-2022 at 09:27 PM. Reason: Solved
IonianStreams is offline   Reply With Quote
Old 04-25-2022, 05:07 AM   #942
rafd
Human being with feelings
 
Join Date: Apr 2022
Posts: 1
Default

I'm writing my first reaper extension and have a couple of 'how to' queries:

The extension needs to create and arm a track, tart recording, then determine when recording is stopped and fetch the file name.

Ideally I'd like to set a custom file name in advance when recording is started but from what I can see in the api this may not be possible? Reaper pops up a dialog on recording complete to allow you to name the file but I'm not sure this can be handled via the api?

Also, is there any callback mechanism for transport state changes or will I have to poll the state?

Thanks!
rafd is offline   Reply With Quote
Old 05-03-2022, 01:32 PM   #943
chmaha
Human being with feelings
 
chmaha's Avatar
 
Join Date: Feb 2021
Posts: 2,289
Default How to check a marker exists by number or label?

I need to check if a marker exists in order to complete a Lua script if conditional correctly either by id or label (both should work). In my specific example, I want to check if marker with id 101, label "DEST-OUT" exists. Probably the safest check would be with the label...

EDIT: Would it be the right approach to use CountProjectMarkers and then iterate through for a label match with EnumProjectMarkers?

Code:
local function dest_out()
  retval, num_markers, num_regions = reaper.CountProjectMarkers(0)
  exists = false
  for i = 1, num_markers, 1
  do
    retval, isrgn, pos, rgnend, label, markrgnindexnumber = reaper.EnumProjectMarkers(i)
    if (label == "DEST-OUT")
    then
      exists = true
    end
  end
  return exists
end
EDIT2: The above works! But is it the best approach? Can I ignore values I don't need with underscores instead of assigning them to a variable?

Last edited by chmaha; 05-03-2022 at 03:22 PM.
chmaha is offline   Reply With Quote
Old 05-03-2022, 04:23 PM   #944
nofish
Human being with feelings
 
nofish's Avatar
 
Join Date: Oct 2007
Location: home is where the heart is
Posts: 12,110
Default

Quote:
Originally Posted by BethHarmon View Post
Can I ignore values I don't need with underscores instead of assigning them to a variable?
Yes.
Also some other small optimisations:
- make the returned variables local (there's somewhere a benchmark thread that local variables work faster, edit: here), and in this case you don't need them in global scope and it's good practice anyway
- insert a break statement after exists = true so the loop doesn't need to run til the end if the match is found

Last edited by nofish; 05-03-2022 at 04:29 PM.
nofish is offline   Reply With Quote
Old 05-04-2022, 01:08 AM   #945
chmaha
Human being with feelings
 
chmaha's Avatar
 
Join Date: Feb 2021
Posts: 2,289
Default

Quote:
Originally Posted by nofish View Post
Yes.
Also some other small optimisations:
- make the returned variables local (there's somewhere a benchmark thread that local variables work faster, edit: here), and in this case you don't need them in global scope and it's good practice anyway
- insert a break statement after exists = true so the loop doesn't need to run til the end if the match is found
Thanks! I didn't know about the Lua local variable stuff but the missing break was just an oversight on my part.
chmaha is offline   Reply With Quote
Old 05-04-2022, 03:36 AM   #946
chmaha
Human being with feelings
 
chmaha's Avatar
 
Join Date: Feb 2021
Posts: 2,289
Default Recall horizontal (and vertical) zoom?

OK, now onto another task:

I want to capture the current horizontal zoom level (reaper.GetHZoomLevel?) and return to it after doing various edits which involve zooming in (reaper.adjustZoom?). Is this possible with a regular lua script? Would I need to run as a background script so it could retain the value of the original zoom level? Can I write the value to a temporary file?

EDIT: OK, I figured out the file stuff in Lua...opening, writing, reading, closing etc. Even have os.remove to delete based on certain conditions...Is there a better way? Also, once I have the original zoom level and current zoom level, how to use reaper.adjustZoom to get back to the original?

EDIT2: Getting there with start_time, end_time = reaper.GetSet_ArrangeView2(0, false, 0, 0, 0, 0)

Last edited by chmaha; 05-04-2022 at 07:11 AM.
chmaha is offline   Reply With Quote
Old 05-04-2022, 07:19 AM   #947
nofish
Human being with feelings
 
nofish's Avatar
 
Join Date: Oct 2007
Location: home is where the heart is
Posts: 12,110
Default

Quote:
Originally Posted by nofish View Post
Also some other small optimisations:
- make the returned variables local
Hm wait, if having them in a local function (as you have) aren't the variables within it local to the function anyway (without declaring them local explicitly)?
Not sure actually, maybe someone else knows?
nofish is offline   Reply With Quote
Old 05-04-2022, 07:31 AM   #948
chmaha
Human being with feelings
 
chmaha's Avatar
 
Join Date: Feb 2021
Posts: 2,289
Default

So a question about functions. Is there a way to treat a variable like a string so that
Code:
start_time, end_time = reaper.GetSet_ArrangeView2(0, true, 0, 0, time)
is interpreted as something like
Code:
start_time, end_time = reaper.GetSet_ArrangeView2(0, true, 0, 0, 100, 2000)
where time is equal to the string "100, 2000"?

In the first example, it doesn't interpret it properly...
chmaha is offline   Reply With Quote
Old 05-04-2022, 07:47 AM   #949
chmaha
Human being with feelings
 
chmaha's Avatar
 
Join Date: Feb 2021
Posts: 2,289
Default

Well, I've sidestepped the string interpolation issue and just written the two values on separate lines and read them as such later on. Works perfectly!
chmaha is offline   Reply With Quote
Old 05-07-2022, 02:22 PM   #950
Tube2Stomp
Human being with feelings
 
Join Date: Apr 2020
Posts: 20
Default

Quote:
Originally Posted by mrelwood View Post
That helped me understand what you're after!

The attachment should do it.
Some time have passed since you made this script for me, and I wanted to report back that it works fine but there is an issue I can't fix myself as this script (with midi buffer and delays) is above my JSFX knowledge :-)

The thing is that some kontakt libraries legato scripting trip over them selves if I play too fast (say I use 200ms of delay on the "note offs" and during this time I play +3 consecutive notes) yet other libraries legato scripting is working find thru that.
Also if I play the same note again (say C4 then release and play C4 again) before the 200ms have passed, the second C4 chokes. that happens with all kontakt libraries.

So far I used this script only with kontakt libraries that behaved well and also avoided playing repeating same notes :-)

But I gave this a thought and I know what needs to be done, just don't know how to write it my self in this level of JSFX scripting.

Lets assume you set 200ms of delay on the Note Offs.

If you play C4 and 110ms later you play D4, the script needs to:
1. Send D4 Note On.
2. Send C4 Note Off right after previous step.
3. Block/Discard the C4 Note Off that will come 90ms later.

If you play C4 and 110ms later you play C4 again, the script needs to:
1. Send C4 Note Off.
2. Send C4 Note On right after previous step.
3. Block/Discard the C4 Note Off that will come 90ms later.

The difference between these scenarios is simply that the first one needs to maintain the legato triggering of kontakt, thus the Note Off needs to come after the Note On.
The second scenario just needs to prevent the note chocking so the Note Off needs to come before the Note On.


Thanks again for even coming up with this script in the first place.
It's a great little tool for a specific problem :-)
Tube2Stomp is offline   Reply With Quote
Old 05-19-2022, 02:02 AM   #951
matt_f
Human being with feelings
 
matt_f's Avatar
 
Join Date: Nov 2018
Posts: 29
Default Mark PCM Sink as not valid for LUFS measurement

For object-based audio/NGA renderers, the LUFS readout (or any of the stats for that matter) shown during render are not applicable as it is dependant upon end-user configuration of the NGA content.

Could we have a flag or something that we can set in a PCM Sink to inform REAPER not to attempt to do a LUFS/RMS etc analysis during render?

Ultimately we will need a proper solution to do this for NGA content, but for the meantime it would be better to show nothing at all rather than inaccurate information.
matt_f is offline   Reply With Quote
Old 05-19-2022, 07:39 AM   #952
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 6,630
Default

Quote:
Originally Posted by BethHarmon View Post
So a question about functions. Is there a way to treat a variable like a string so that
Code:
start_time, end_time = reaper.GetSet_ArrangeView2(0, true, 0, 0, time)
is interpreted as something like
Code:
start_time, end_time = reaper.GetSet_ArrangeView2(0, true, 0, 0, 100, 2000)
where time is equal to the string "100, 2000"?

In the first example, it doesn't interpret it properly...
You could do stuff like:

Code:
time="100, 2000"
start_time, end_time = reaper.GetSet_ArrangeView2(0, true, 0, 0, time:match("(.-), (.*)"))
But this only works, as long as the format stays the same in the variable time.
__________________
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 05-24-2022, 12:42 AM   #953
gd1570
Human being with feelings
 
Join Date: Jul 2012
Posts: 14
Default C++ API: Some actions not working on macOS?

Hi!

I'm working on a reaper extension using the C++ API, calling Main_OnCommand(command_id, 0); to execute actions. The Windows version works fine but some actions do not seem to work when running on macOS.

Here are some actions that do not seem to work (there could be others):
- Track: toggle solo for selected tracks
- Track: toggle mute for selected tracks
- Track: toggle FX bypass for selected tracks
- Track: toggle record arm for selected tracks

Running these actions from reaper's action list works, so do most other actions and API functions.
The toggle state is also reported correctly for all actions.

tested on Windows 10 in Reaper 5.92 and 6.57 and on macOS (M1, monterey, in Reaper 6.33 and 6.58). The same code works on Windows but not on macOS.


Am I doing something wrong or is this a bug in Reaper? Any ideas?
__________________
reaper_command_palette | Emergence: granular effect plugin for mac and windows | Diffuse: delay/reverb plugin | patreon | itch.io | youtube | website
gd1570 is offline   Reply With Quote
Old 05-24-2022, 07:33 AM   #954
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 6,630
Default

Does not work means, it doesn't do anything?

First idea coming into my mind, did you accidentally deselect tracks? You can check by using CountSelectedTracks(). Especially if you mess around with functions who do not update the UI by themselves, it might look like it's selected but actually isn't.
Just a thought, maybe it's 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 06-15-2022, 03:04 AM   #955
chmaha
Human being with feelings
 
chmaha's Avatar
 
Join Date: Feb 2021
Posts: 2,289
Default Delete Marker by Label?

Is there a way to delete a project marker by label vs id? I'm currently using:

Code:
reaper.DeleteProjectMarker(NULL, 100, false)
for my specially assigned markers (in this case labelled "DEST-IN"). But, if the user already has a marker with id 100, I don't want those regular markers deleted.

Ideally, something like this would be great:

Code:
reaper.DeleteProjectMarker2(NULL, 100, "DEST-IN", false)


Likewise, it would be great to be able to go to a marker identified by both its ID and label:

Code:
reaper.GoToMarker2(0, 100, "DEST-IN", false)
Given REAPER allows for markers with the exact same IDs (and labels) it seems logical to expect a way to distinguish between them when moving to, or deleting, them.

EDIT: I've figured out I can use enumProjectMarkers to query the label and then deleteProjectMarkerByIndex to delete them but is this efficient? With a bit of logic I can also store the retval of the S-D markers when I first iterate over the S-D markers to check for their presence. But, if I have two markers with the same ID, using the retval seems to break and GoToMarker will only go to the first of the identically IDed markers in the timeline which seems extremely odd given this use of boolean with the command is supposed to identify markers by order.

EDIT2: Abandon ship? It seems having markers with the same ID causes all sorts of problems.
__________________
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; 06-15-2022 at 06:06 AM.
chmaha is offline   Reply With Quote
Old 06-15-2022, 09:56 AM   #956
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 6,630
Default

Yeah, the shown id only works for regions, where you can have each shown-id only once. But for markers it doesn't help at all.

Can you tell us more about the practical usecase of the DEST-IN-markers and how they are supposed to work for the user? Maybe this gives some hints, if another approach is a better one or if some other concept would help better, than the shown idx.

My gut feeling screams "marker guids" as potential helpful tool (gettable using GetSetProjectInfo_String), but my gut might be wrong about that.

Do I get it right, you need to be able to differentiate between your own marker-types and the ones the user created, in some way?
__________________
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 06-15-2022, 10:17 AM   #957
chmaha
Human being with feelings
 
chmaha's Avatar
 
Join Date: Feb 2021
Posts: 2,289
Default

Quote:
Originally Posted by Meo-Ada Mespotine View Post
Yeah, the shown id only works for regions, where you can have each shown-id only once. But for markers it doesn't help at all.

Can you tell us more about the practical usecase of the DEST-IN-markers and how they are supposed to work for the user? Maybe this gives some hints, if another approach is a better one or if some other concept would help better, than the shown idx.

My gut feeling screams "marker guids" as potential helpful tool (gettable using GetSetProjectInfo_String), but my gut might be wrong about that.

Do I get it right, you need to be able to differentiate between your own marker-types and the ones the user created, in some way?
Thanks.

So a user sets DEST-IN, DEST-OUT, SOURCE-IN and SOURCE-OUT markers (with ids of 100-103 and labels) in order to performance various source-destination editing functions:

Code:
local r = reaper
local cur_pos = (r.GetPlayState() == 0) and r.GetCursorPosition() or r.GetPlayPosition()

r.DeleteProjectMarker(NULL, 100, false)
r.AddProjectMarker2(0, false, cur_pos, 0, "DEST-IN", 100, r.ColorToNative(22, 141, 195) | 0x1000000)
Basically, for a 4-point edit, you copy the audio inbetween SOURCE-IN and OUT and paste it with crossfades to DEST-IN and DEST-OUT. One of my videos is probably of most help in this: https://www.youtube.com/watch?v=A-9jtpoUUdo

The problem comes if a user is using a LOT of markers and already has 100-103 created. I've thought about using 1000-1003 instead but that feels unnecessarily large (and still doesn't completely avoid the issue if people create such numbers via API). I tried making all S-D markers have an ID of 0 but then going to and deleting markers are a mess as you can expect. To answer your question: yes, I do need to be able to differentiate between S-D markers and regular ones.
__________________
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; 06-15-2022 at 10:29 AM.
chmaha is offline   Reply With Quote
Old 06-16-2022, 09:16 AM   #958
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 6,630
Default

Hmm, this somehow sounds like the Custom-Markers/Regions-concept I had added to Ultraschall-API.

This basically creates markers with a naming scheme like:

"_custommarkername: the title of the marker"

So you could have

"_DEST-IN:"-markers and "_SOURCE-IN:"-markers.

And I wrote functions, that would only affect the markers with a certain name.
For instance, you could add/set/enum/delete/count only the "_DEST-IN"-markers, leaving all others untouched. Same with all other such custommarkernames.
I wrote this, as the Ultraschall-Podcast-extension has also different marker-types("_Edit:", "_Shownote:", "_Time:", etc), that we needed to address quickly without touching any of the other markers.

Could you give my custom-markers-feature in Ultraschall-API a try to see, if their behavior comes somewhat close to what you have in your mind?

If yes, I could cut them out to be working standalone, so you have a bunch of functions you could use for such things, without having to code them yourself, if you want.
I think, modding them to use specific names "DEST-IN" instead of "_DEST-IN:" or "SOURCE-IN" instead of "_SOURCE_IN:" should work too but I would need to check on that...

Installation of Ultraschall-API(just install it on portable version for the tests):
https://mespotin.uber.space/Ultrasch...How_to_Install

Introduction to Custom-Markers/Regions:
https://mespotin.uber.space/Ultrasch...rs_and_Regions
__________________
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 06-16-2022, 09:27 AM   #959
chmaha
Human being with feelings
 
chmaha's Avatar
 
Join Date: Feb 2021
Posts: 2,289
Default

Quote:
Originally Posted by Meo-Ada Mespotine View Post
Hmm, this somehow sounds like the Custom-Markers/Regions-concept I had added to Ultraschall-API.
So I already have some code I wrote to only affect the S-D markers but the problem came with markers that shared the same ID. Are you saying that I could go to and delete my S-D markers without even bumping into regular markers that might share the same ID?

This, for example, is how I figured out how to delete markers by label versus just ID:

Code:
local r = reaper

r.Undo_BeginBlock()
markers, regions = r.CountProjectMarkers(0)
for i=0, markers + regions - 1 do
  num, _, _, _, string, _ = reaper.EnumProjectMarkers(i)
  if string == "DEST-IN" or string == "DEST-OUT" or string == string.match(string, "%d+:SOURCE[-]IN") or string == string.match(string, "%d+:SOURCE[-]OUT") then
    reaper.DeleteProjectMarkerByIndex(0, i)
  end
end
r.Undo_EndBlock('Delete All S-D Markers', 0)
The problem is obviously with the DeleteProjectMarkerByIndex line itself which won't discrimination between a regular marker and custom marker.
__________________
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 06-16-2022, 09:53 AM   #960
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 6,630
Default

Yeah, with a distinctive naming-scheme, you could ignore the shown id altogether, that's how I do it and it works quite nice in practice.


You just need a function that enumerates through all marker-names and ignore those, who don't fit the naming-scheme.
This should give you the id over all markers(not the shown one but the one in timeline order).
Then you delete it.

I'm currently afk, but I'll check your code-snippets later to be sure I didn't miss something...
__________________
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
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:31 AM.


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