Cockos Incorporated Forums

Cockos Incorporated Forums (https://forum.cockos.com/index.php)
-   ReaScript, JSFX, REAPER Plug-in Extensions (https://forum.cockos.com/forumdisplay.php?f=3)
-   -   ReaScript: API: Wish List (https://forum.cockos.com/showthread.php?t=48871)

MikeLacey 12-22-2009 01:54 PM

ReaScript: API: Wish List
 
Hello all,

Here's the start of a ReaScript wish list. What have I missed? What shouldn't be on the list? What should and shouldn't be in red? (No matter what anyone says I'm not taking the Wiki items off the list.) There aren't many Python items. (can't think why...)

These are the top ten things in the Wish List. Positions are set by +1 or -1 votes, so make sure you vote for what you need and un-vote for what you don't...
  • Numbers in () are item nums in big list below.
  • Items get into top ten with first +1, at bottom of list
  • Items go up list with each +1
  • Items go down in the list with each -1 (usually)
  1. (8) Add a return value for named notes to MIDIEditor_GetMode()
  2. (9) File dialogue, returning OK/Cancel & Filename (Expected v3.21 or thereabouts)
  3. (13) GetSet*State() chunk size limit is currently 16k, too small. (Expected v3.21 or thereabouts)
  4. (10) MIDIEditor_Get|SetView, returning (see big list)
  5. (12) Resizable console window
  6. (23) Get/SetMidiItemInfo_Value() - (see big list)
  7. (25) GetSetProjectState()
  1. ReaPerl. To be able to call RPR_* functions from a module.
  2. For functions that take a named parameter - Get/SetMediaTrackInfo_Value() - to not fail silently when you give them a parameter they don't know about.
  3. ReaPerl. Compile & Runtime Error messages for Perl scripts.(becoming an issue, scripts are getting longer)
  4. ReaPerl. To be able to call RPR_* functions as standard Perl functions, multiple line calls and calls in if statements, e.g.
    PHP Code:

    if(RPR_CountSelectedItems()==0

    and
    PHP Code:

    $var=RPR_FuncWithVeryLongNameAndParamList(
           
    MediaTrack,    # the selected track
           
    MediaItem,     # the item that will be edited
           
    p3,            # etc.
           
    p4,
           
    p5,
           
    p6,            # some random pointer or other...
           
    p7,
           
    p8
         
    ); 

    The solution to this one's related to the "RPR_ from a module wish" (above) I suspect.
  5. To (magically, not with work) know about Python as well as Perl (please).*
  6. A Wiki batch edit facility (please God).*
  7. A Wiki template that is not just a #include by another name.*
  8. Add a return value for named notes to MIDIEditor_GetMode()
  9. File dialogue, returning OK/Cancel & Filename (Expected v3.21 or thereabouts)
  10. MIDIEditor_Get|SetView, returning rectangles, diamonds, triangles, all notes, Hide unused, Hide unused/unnamed
  11. Support for Tk (GUI used by Python & Perl) in Perl as well as in Python.
  12. Resizable console window
  13. GetSet*State() chunk size limit is currently 16k, too small. (Expected v3.21 or thereabouts)
  14. "Possible Infinite Loop" message currently triggered at 16000 API calls in a ReaScript, sfzgeek hitting that limit.
  15. A command to close the console output window from within the script.
  16. API A means to obtain the Actions List contents -- particularly the name strings and the corresponding numeric ID's.
  17. something to get a valid reaper_plugin_info_t *rec (or any alternative other way to register to Reaper's notif)
  18. LICE_IBitmap * b = GetPNGFromCurrentTheme("mcp_volthumb.png", NULL); getting the user's current theme in a cross-plateform way would be cool for VSTs extension plugins
  19. something to work within FX chains in a FX type independent way (VST, JS, Dx) main first needs: trigering reaper's preset (then, FX's one) but also pin connection processing
  20. SWS's plugin_register("hookcommandex", hookCommandProcEx) FR: http://forum.cockos.com/project.php?issueid=1465
  21. padre, klinke & yves: enhanced csurf notif, http://forum.cockos.com/showthread.php?t=44152
  22. Something to validate chunk updates in a reliable way - GetSet*State() funcs bool vals sometimes fib a bit...
  23. Get/SetMidiItemInfo_Value() - perhaps not this API exactly, but something a more ReaScripter friendly than chunks. (Some aspects of friendlier could be user-contributed if we could call RPR_* functions from a module)
  24. GetFuncAddress() call. Not needed now include() is implemented.
  25. Jeffos would like to be able to say GetSetObjectState(ReaProject*), personally I would prefer to see a GetSetProjectState() to allow access to project-wide parameters using chunkish editing.

Oh, and just to be clear. I'm not complaining, I think ReaScript (yes, yes & the C++ API) is the best thing since sliced bread.

Mike

(* Some items may stretch the capabilities of the development team, but we shouldn't let that stop us asking. Remember - hard work is good for them. :))

schwa 12-22-2009 02:00 PM

Thanks Mike.

Also what would be handy is a wish list of particular API functions. Those sorts of wishes even have a chance of being granted :) (unlike, say, #5 above).

EvilDragon 12-22-2009 02:05 PM

I very much agree with:

8, 9, 10, 12, 13

:D

Also I will add:

15. A command to close the console output window from within the script. For example, currently:

RPR_ShowConsoleMsg("")

clears the console.

RPR_ShowConsoleMsg(close)

could do it?

MikeLacey 12-22-2009 02:15 PM

interesting, I've only thought of the console as a debugging tool...

EvilDragon 12-22-2009 02:25 PM

...and that is a good point as well. Yeah, we could use messageboxes for whatever we want to return to the user, true.

How about this then:

15. Naming all scripts like this:

"ReaScript: <script name here>"

instead of:

"Custom: <script name here>.py/pl"

:D

Geoff Waddington 12-22-2009 03:26 PM

As per schwa's suggestion I'm posting a wish list item here that is not strictly for ReaScript (but probably useful for ReaScripter's as well).

API: A means to obtain the Actions List contents -- particularly the name strings and the corresponding numeric ID's.

For custom actions and extension actions the ID's are assigned dynamically, so we need to do this at runtime.

Jeffos 12-23-2009 03:19 AM

Quote:

Originally Posted by schwa (Post 425936)
Thanks Mike.

Also what would be handy is a wish list of particular API functions. Those sorts of wishes even have a chance of being granted :) (unlike, say, #5 above).

Dear Santa schwa,

My (ordered) wish list is:

- Something to validate chunk updates in a reliable way
==> EDIT: this was a REAPER bug fixed in v3.22


- allowing ReaProject* as 1st param for GetSetObjectState() (no need of attached tracks in the setted/getted chunks..)

- something to get a valid reaper_plugin_info_t *rec (or any alternative other way to register to Reaper's notif)

- LICE_IBitmap * b = GetPNGFromCurrentTheme("mcp_volthumb.png", NULL);
getting the user's current theme in a cross-plateform way would be cool for VSTs extension plugins
==> EDIT: no API update needed for that


- something to work within FX chains in a FX type independent way (VST, JS, Dx): main first needs: trigering REAPER's preset (then, FX's one) but also pin connection processing
==> EDIT July 2010: trigering REAPER's preset is doable

I stop here. I really think the two 1st ones would open many doors. I'd be happy only with them.

Other devs wishes I really agree with (ordered too):
- same as SWS: plugin_register("hookcommandex", hookCommandProcEx);
FR: http://forum.cockos.com/project.php?issueid=1465
- same as padre_pc, klinke, yves: enhanced csurf notif, see http://forum.cockos.com/showthread.php?t=44152 (but forget what I said there: now, I know how to do almost everything I asked there)
- same as geoff: a way to enumerate the action list (I promise I won't do a parallèle learn system.. ;-)

MikeLacey 12-23-2009 12:43 PM

Jeff, hi,

So that I can add your items into the wish list... (and my apologies for asking stupid questions)

Quote:

Something to validate chunk updates in a reliable way
The functions GetSetEnv/Item/TrackState return bool (amongst other things), is the bool return value not reliable?

Quote:

allowing ReaProject* as 1st param for GetSetObjectState()
So that we can update project global parameters in a chunkish way? (In the style of GetSetProjectState()?)

EvilDragon 12-23-2009 01:15 PM

Quote:

Originally Posted by MikeLacey (Post 426381)
The functions GetSetEnv/Item/TrackState return bool (amongst other things), is the bool return value not reliable?

May be so, but when GetSetItemState() sets MIDI CFGEDIT chunk tokens, they are not updated and not reflected, even if you update the item on the timeline...

jedstar2000 12-23-2009 02:04 PM

Dear Santa Schwa .

I could really do with .
RPR_GetMidiItemInfo_Value( ) Retries all position pitches and velocities of notes in an item by index.
and
RPR_SetMidiItemInfo_Value( ) Sets all position pitches and velocities of notes in an item by index.

Chunk editing is just two tricksy for your average Rescripter it needs to be transformed into something far more friendly .

Have a very merry Christmas.

EvilDragon 12-23-2009 02:20 PM

Quote:

Originally Posted by jedstar2000 (Post 426418)
Chunk editing is just two tricksy for your average Rescripter it needs to be transformed into something far more friendly.

I agree.

Jedstar, would your proposed API call be able to, for example, take all notes of certain pitch in the item (or all notes from current note selection), and then, for example, select every other note in each pitch? Visually:

Code:

C5
B4
A#4  e              e
A4
G#4          e              e
G4
F#4    e e e  e e e  e e e  e e e
F4
E4

Let's say this is a hi-hat rhythm you'd want to transfer to closed hats only, and then select every other note to edit velocity further manually. After setting:

Code:

C5
B4
A#4
A4
G#4
G4
F#4  e E e E e E e E e E e E e E e E
F4
E4


MikeLacey 12-23-2009 02:32 PM

Quote:

Originally Posted by EvilDragon (Post 426394)
May be so, but when GetSetItemState() sets MIDI CFGEDIT chunk tokens, they are not updated and not reflected, even if you update the item on the timeline...

Fair comment - it's in the list

fingers 12-29-2009 01:30 AM

+1 for #13 this is a problem when you start loading vst effects on media items or tracks. The size quickly gets out of hand.

My request is for a mechanism similar to the way you write c++ dlls, but for reascript. I would like to have a function RPR_GetFunc which given the function name would return a function pointer. That way I can write modules in python which can access reaper plugin functions without having a huge callback class in the main script. Ideally, all I'd have to pass is a reference to RPR_GetFunc and the modules can get the plugin functions themselves, by calling 'DeleteTrack = RPR_GetFunc("DeleteTrack")' for example.

jedstar2000 12-29-2009 07:03 AM

Quote:

Originally Posted by EvilDragon (Post 426434)
I agree.

Jedstar, would your proposed API call be able to, for example, take all notes of certain pitch in the item (or all notes from current note selection), and then, for example, select every other note in each pitch? Visually:

Sure You would be able to do all that and a lot more.
you would just have to write the appropriate script.

We would also need .
RPR_CountSelectedMediaItems(0); but for counting how many notes inside an item
somthing like.
RPR_CountMidiNotesInMediaItems(0);

This would allow you to step threw every note in an item and manipulate it however you felt fit.

MikeLacey 12-29-2009 12:58 PM

Quote:

Originally Posted by fingers
My request is for a mechanism similar to the way you write c++ dlls, but for reascript. I would like to have a function RPR_GetFunc which given the function name would return a function pointer. That way I can write modules in python which can access reaper plugin functions without having a huge callback class in the main script. Ideally, all I'd have to pass is a reference to RPR_GetFunc and the modules can get the plugin functions themselves, by calling 'DeleteTrack = RPR_GetFunc("DeleteTrack")' etc.

This sounds tempting. Given the address of a REAPER function, from GetFunc(), you could wrap it in an FFI call and have a much more Python-ish or Perl-ish version of ReaScript, probably :) The implementation of ReaScript would then be in Perl or Python modules. You'd be able to write things like this:
PHP Code:

use RPR;   # the standard RPR_* API calls, wrapped using FFI
use MyRPRLib# a set of amazingly cool library objects & routines.

my $Proj $MyRPRLib::CurrentProj();
my $it $Proj -> SelectedItems(FIRST_SEL);
my $pan_env $it -> GetEnvByName('PAN');
s/\w1\./2./mg =~ $pan_env -> Chunk();      # Move all of the env points from the 2nd second to the 3rd second.

foreach $note ($it -> MIDINotes){
  
$note -> velocity *= 0.99;      # decrease the velocity of each MIDI note in the item by 1%
  
$note -> pitch ++;              # increase pitch of each MIDI note in the item by 1 semitone



Jeffos 01-06-2010 01:44 AM

Quote:

Originally Posted by MikeLacey (Post 426381)
The functions GetSetEnv/Item/TrackState return bool (amongst other things), is the bool return value not reliable?

Hi Mike! sorry for this late anwser. no, I meant that sometimes you have to fight to validate chunk updates (to avoid what you called "a temporary update" in another thread) while the fuction had returned "true". Sometimes it also return true but nothing is applied at all and there're other worst issues (e.g. right now I'm facing some deadlocks when setting, I'm trying to clarify that..)

Quote:

Originally Posted by MikeLacey (Post 426381)
So that we can update project global parameters in a chunkish way? (In the style of GetSetProjectState()?)

yes, it's the idea: master enveloppes, tempo, etc...

MikeLacey 01-06-2010 02:06 AM

"right now I'm facing some deadlocks when setting"

Interesting, I've not encountered that

yhertogh 01-06-2010 04:41 AM

Dear Schwanta,

1. APIs to control individual FX parameters. This includes manipulating FX params, but also getting information back from them , eg which plugin and plugin FX knob they control, so you could open the plugin window if you'd like

2. The before mentioned extensions to the [url=http://forum.cockos.com/showthread.php?t=44152]notifications/callbacks.[]/url

And finally, i think posting a new SDK is in order

Thank you and i have been a good boy :D

Yves

Jeffos 01-06-2010 04:57 AM

Mike can you add the GetSetObjectState(ReaProject*) idea to the list? Thanks in advance.

Quote:

Originally Posted by MikeLacey (Post 431857)
"right now I'm facing some deadlocks when setting"

Interesting, I've not encountered that

I'm setting chucks in a multi-threading context, not sure you can do that with reaScript ;-). anyway, it's probably my error..

Quote:

Originally Posted by yhertogh (Post 431909)
Thank you and i have been a good boy :D

ha ha! Sorry, but I can *not* confirm that: a good boy does not ask things he already had (SDK silentely updated in december ;))

MikeLacey 01-06-2010 05:32 AM

"I can *not* confirm that: a good boy..."

Quite...! Try and keep up yhertogh :)

Malevol3nt 01-06-2010 02:45 PM

I just wish I didn't have to work with regular expressions on reaper function returns.

Edit: Altho, I _did_ have some fun with those. :p

Malevol3nt 01-06-2010 06:40 PM

Quote:

Originally Posted by MikeLacey (Post 425930)
[*]Support for Tk (GUI used by Python & Perl) (long shot) Or... Drop down lists, text boxes and such in windows that can be called from ReaScript functions. (less of a long shot maybe)

Just spotted this one. I had no trouble running tkinter in Reaper, except of course not having the ability to make API calls without some kind of a callback mechanism (which I still have to figure out!). But it certainly is possible to have a GUI.

Blechi 01-06-2010 07:18 PM

Quote:

Originally Posted by Malevol3nt (Post 432258)
Just spotted this one. I had no trouble running tkinter in Reaper, except of course not having the ability to make API calls without some kind of a callback mechanism (which I still have to figure out!). But it certainly is possible to have a GUI.

Would you mind to post a little (python) demo snippet, because i didn't get this to work either?

Malevol3nt 01-06-2010 08:12 PM

1 Attachment(s)
Quote:

Originally Posted by Blechi (Post 432273)
Would you mind to post a little (python) demo snippet, because i didn't get this to work either?

Here you go. Just put it anywhere in the Reaper directory (I have a Reaper\Scripts Dir where I put all the stuff but it doesn't matter). Make a hotkey for it or just run it.

By the way, if you want to design your GUI's without having to code all the time you can use GUI Builder, which generates python ~2.5 compatible code. It's downloadable from here:

http://sourceforge.net/projects/spectcl/

However, all I needed to do was change the import statements from "import Tkinter" to "import tkinter" in the 2 .py files it generates, and the code seemed to work fine with Python 3.1. But I've only tried it briefly. Anyway, have fun!

Blechi 01-06-2010 09:53 PM

Thanks a lot. Works fine.
Also thanks for the link to the GUIbuilder thingy. Makes things a lot easier.

yhertogh 01-07-2010 02:20 AM

Quote:

Originally Posted by Jeffos (Post 431914)
ha ha! Sorry, but I can *not* confirm that: a good boy does not ask things he already had (SDK silentely updated in december ;))

Doh! Thanks Jeff!

Quote:

Originally Posted by MikeLacey
Quite...! Try and keep up yhertogh :)

:D :D :rolleyes:

Yves

MikeLacey 01-07-2010 02:58 AM

Nice one Malevol3nt, I'll have a look at that.

(And you know you like regexes really...)

Malevol3nt 01-07-2010 08:35 AM

Quote:

Originally Posted by Blechi (Post 432336)
Thanks a lot. Works fine.
Also thanks for the link to the GUIbuilder thingy. Makes things a lot easier.

Right, just be careful with the root.destroy() function. I've removed it from the example since closing the GUI with the X button calls that function anyway. If you were to say, put root.destroy() as a function call for one of the buttons, it will do the same thing.

However putting it in the wrong place can sometimes create an infinite loop spawning a few dozen windows, and you have to crash Reaper via the task manager to get rid of them. But it only happens if you don't know what you're doing (I got burned on that one myself )

Edit: Looks like tkinter seems to be a bit buggy, or I'm doing it wrong. For the life of me I can't figure out why sometimes a button activates itself on it's own. And I'm getting infinite loops, windows popping out everywhere. Argh!

Malevol3nt 01-07-2010 10:32 AM

It looks like the maximum number of envelope points I can retrieve with an extension is 629 points. Trying to extract more crashes reaper, with a "Memory could not be 'written' at address 0x********"

It seems Reaper has no problem having more than 629 envelope points. So it's probably a limitation of the size of the chunk RPR_GetSetEnvelopeState can return. At 629 points the string/chunk returned is 15742 characters long.

I'm not saying the limit should be changed. 629 is more than enough for anyone I guess. :)

On the good side of news, my envelope extraction function (which performs some regular expressions on the chunk) stores all the envelope data and points data in separate dictionaries pretty fast. Around ~20 milliseconds for 629 points, if cProfiler is to be trusted.

AudiOishi 01-08-2010 02:01 PM

I just wanted to chime in on Item 13. 16384 characters is way too small a limit for GetSetItemState().

+1 to the request to make this a much more useful function.

schwa 01-12-2010 07:03 AM

Quote:

Originally Posted by MikeLacey (Post 425930)
File dialogue, returning OK/Cancel & Filename

Coming soon.

Quote:

Originally Posted by MikeLacey (Post 425930)
GetSet*State() chunk size limit is currently 16k, too small.

Will be increased to 1MB.

MikeLacey 01-12-2010 08:31 AM

You're a nice man Mr Schwa, and I've always said so...

Thanks, good choices.

EvilDragon 01-12-2010 08:51 AM

Quote:

Originally Posted by schwa (Post 434603)
Coming soon.

Will this one basically look like the current file dialogue, or?

Because if it's just improved current file dialogue with return values, that is AWESOME!

fingers 01-12-2010 10:10 PM

Nice nice!! Sooner then I thought.

Changes in 3.2:

ReaScript: GetSetChunkState chunk length limit increased to 1MB
ReaScript: added GetUserFileNameForRead

schwa 01-12-2010 10:14 PM

Quote:

Originally Posted by fingers (Post 434971)
ReaScript: GetSetChunkState chunk length limit increased to 1MB
ReaScript: added GetUserFileNameForRead

Ah ... oops. Those changes are not in 3.2, they will be in the next release. The whatsnew update got entered with the wrong version number. Sorry!

sfzgeek 01-13-2010 01:59 AM

Quote:

Originally Posted by schwa (Post 434972)
Those changes are not in 3.2, they will be in the next release.

:) No problems. Great to know that some very welcome additions are on the way. The increased chunk limit is going to answer many people's prayers!

MikeLacey 01-15-2010 06:55 AM

Quote:

Originally Posted by sfzgeek (Post 435011)
:) The increased chunk limit is going to answer many people's prayers!

Absolutely

schwa 01-15-2010 07:04 AM

3.21pre1 has the chunk size increase and user file choose dialog.

MikeLacey 01-15-2010 07:34 AM

Thx schwa, testing now, test results in pre-release forum.

Mike

Andrej88 01-24-2010 06:46 PM

When a (python) script is running, none of the other shortcut keys work until that script exits (although running other scripts via the Actions window work).

A script with a GUI is usually executing an infinite loop until the user hits a close button of some sorts (or the script exits by itself). I've just tried running two GUI scripts at once. After I've ran the first script, the shortcut keys were not responding (as in ctrl-c, escape, F1-F12 buttons etc). I've opened the Actions window and tried executing other scripts. This will work, unless the other script is a GUI script as well. In that case, trying to run that second GUI script will leave Reaper completely frozen.

I think this is worth investigating if we're hoping to some day have GUI scripts running side-by-side. I've tested this with tkinter, and a commercial GUI library, with the same results on Reaper 3.2 and 3.21 beta.


All times are GMT -7. The time now is 12:28 PM.

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