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

Reply
 
Thread Tools Display Modes
Old 12-17-2018, 01:47 AM   #81
zookthespook
Human being with feelings
 
Join Date: Mar 2015
Posts: 452
Default

Thank you for putting all the time behind this project
to be honest i am just a script leech .. can't even script hello world without seeing a tutorial , but thanks to good people like you we get to see new powers added to reaper !

regards
zook
zookthespook is offline   Reply With Quote
Old 12-17-2018, 06:44 AM   #82
mespotine
Human being with feelings
 
mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig, Germany
Posts: 1,117
Default

Hotfixes I - fixes issues with GetMarker/GetRegion-functions:

https://api.mespotine.de/ultraschall_hotfixes.lua

Just replace the ultraschall_hotfixes.lua with that new file.

The full downloadpackage of the API itself includes this hotfix as well.
__________________
Ultraschall-API - a Lua-functions-library4Reaper: https://forum.cockos.com/showthread....98#post2067798
Reaper Internals - Developerdocs4Reaper: https://forum.cockos.com/showthread.php?t=207635

Last edited by mespotine; 12-17-2018 at 06:58 AM.
mespotine is offline   Reply With Quote
Old 12-17-2018, 06:49 AM   #83
mespotine
Human being with feelings
 
mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig, Germany
Posts: 1,117
Default

Let's get started with fulfilling a first Feature Request:

Quote:
Originally Posted by reapero View Post
Mmmm...would it be possible then use Get the current Marker/Region at mouse-position + the render feature to do something like:

a) activate script
b) roll over the regions you want to render with the mouse
c) then render these regions without having to go thru the region matrix, etc
Try this script.
When you run it, Ctrl+LeftClick(or CMD+LeftClick on Mac) on the Region you want to render. A dialog will pop up, asking you, where to render it and it's filename. Enter that and hit OK.
It will remember that typed filename, when you click on the next region to render.


https://mespotin.uber.space/Mespotin...nt_Project.lua

Don't know, if this works good on Mac and Linux, haven't tested that yet.
Needs JS-Extension-plugin 0.951 and SWS installed.
__________________
Ultraschall-API - a Lua-functions-library4Reaper: https://forum.cockos.com/showthread....98#post2067798
Reaper Internals - Developerdocs4Reaper: https://forum.cockos.com/showthread.php?t=207635
mespotine is offline   Reply With Quote
Old 12-19-2018, 07:59 AM   #84
tXShooter
Human being with feelings
 
tXShooter's Avatar
 
Join Date: Aug 2017
Posts: 285
Default COM Objects?

Hey Meo,
In all of your coding experience with Reaper, have you had any occasion/need/desire to mess around with COM objects such as MS Access, Word, Excel, Power Point, and Outlook?

The simplest example that I can think of for a FR on this would be to email a render directly from Reaper using an Outlook COM Object.

Another possible use could be OneDrive for collaborative projects.

Just curious what you thought of that.

Thanks for all of your contributions to Reaper!
__________________
"But be ye doers of the word, and not hearers only, deceiving your own selves."
tXShooter is online now   Reply With Quote
Old 12-19-2018, 08:10 AM   #85
mespotine
Human being with feelings
 
mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig, Germany
Posts: 1,117
Default

No, haven't thought about that and no idea how to do that.
Can't this be done in some way using a shell/commandline?
__________________
Ultraschall-API - a Lua-functions-library4Reaper: https://forum.cockos.com/showthread....98#post2067798
Reaper Internals - Developerdocs4Reaper: https://forum.cockos.com/showthread.php?t=207635
mespotine is offline   Reply With Quote
Old 12-19-2018, 08:37 AM   #86
chip mcdonald
Human being with feelings
 
chip mcdonald's Avatar
 
Join Date: May 2006
Location: NA - North Augusta South Carolina
Posts: 3,559
Default

Would the render capability allow a script or batch file to render all .rpp reaper projects in a directory?
__________________
]]]>-guitar lessons - www.chipmcdonald.com-<[[[
Experiencing Guitar: Essays from Teaching by Chip McDonald https://www.amazon.com/dp/1521877823..._QZJxAbA4GVDC1
chip mcdonald is offline   Reply With Quote
Old 12-19-2018, 09:33 AM   #87
tXShooter
Human being with feelings
 
tXShooter's Avatar
 
Join Date: Aug 2017
Posts: 285
Default

Quote:
Originally Posted by mespotine View Post
No, haven't thought about that and no idea how to do that.
Can't this be done in some way using a shell/commandline?
That's how I'm currently adopting things... using AHK to communicate with Excel and Outlook.


Skip the 'long version' of my answer.

Long Version
My recordings are of our church services, from before the first piano note and all the way to the last, to include song specials (choir and solos) to sermons to special announcements, etc. My Lua script is designed to extract portions of that recording and render them to individual MP3's (using templates which contain FX chains and such). Currently (and due to my own limited knowledge) this is only for the sermons, but I hope to include the song specials and such later on... which may happen sooner than expected now that your API has been released.

I store all of my marker data in a spreadsheet for each recording and use that to email various entities (depending on what's being marked, which is indicated by the text of the markers (songs vs sermons vs speeches vs blah). This spreadsheet is also used by others in my church for their own purposes (new membership, baptisms, legalities (hey, it happens from time to time), etc.).

There are timing issues with using the shell / commandline that can cause all kinds of headaches if one little thing goes wrong... this is why it's taken me 18 months to get to where I am today. Just this month I've finally been able to build a script that successfully does the above with the sermons. However, and quite sadly, this script still involves using 5 other AHK scripts to automate things. Things like GetSceneNumber(OSC), Render, Save File, Compose Email, and Watchdog (to close things that are left open by some reason or another). Render and Save File looks to be something that can now be done within Reaper thanks especially to you and your API... I haven't had a chance to dig into it yet.


Short Answer
Golly! It sure would be keen / neato if Lua in Reaper supported DLL and COM objects! (insert mega cheesy grin here)
__________________
"But be ye doers of the word, and not hearers only, deceiving your own selves."
tXShooter is online now   Reply With Quote
Old 12-19-2018, 09:42 AM   #88
karbomusic
Human being with feelings
 
karbomusic's Avatar
 
Join Date: May 2009
Posts: 23,671
Default

Quote:
Originally Posted by tXShooter View Post
There are timing issues with using the shell / commandline that can cause all kinds of headaches if one little thing goes wrong... this is why it's taken me 18 months to get to where I am today.
I have no idea what languages you know but in C#/.NET you could create a FileSystemWatcher that monitors some directory for changes and when a create file event occurs (the render), pull the file that caused the change then email it using .NET's System.Net.Mail component. This would avoid Outlook/COM altogether. Or you could use Outlook's .NET Office Library to interop and send it via Outlook but it's much easier to avoid having to use such a heavy mail client for this IMHO. You would have to know when the render is complete before acting though - doable just mentioning for awareness.

Or you could just take the folder watching out of the equation and write a similar app that whenever you execute it, it emails everything in folder X. That's how I would most likely do it.

Quote:
Short Answer
Golly! It sure would be keen / neato if Lua in Reaper supported DLL and COM objects! (insert mega cheesy grin here)
It's probably available in C++ as an extension assuming you can Import the needed libraries but I still think tying all this directly into Reaper is potentially less desirable long-term, or maybe not. It may be even remotely available in Lua - or at least starting an external app via Lua when the render completes.

Last edited by karbomusic; 12-19-2018 at 09:48 AM.
karbomusic is online now   Reply With Quote
Old 12-19-2018, 10:45 AM   #89
mespotine
Human being with feelings
 
mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig, Germany
Posts: 1,117
Default

Quote:
Originally Posted by chip mcdonald View Post
Would the render capability allow a script or batch file to render all .rpp reaper projects in a directory?
Yes, you just need to pass the filename+path of the rpp-file to the render-function.

There's a function, that gets all files in a path into an array:

https://mespotin.uber.space/Mespotin...lesnamesInPath

Iterate over the array and pass the filenames+path to
https://mespotin.uber.space/Mespotin...ject_RenderCFG

Don't forget to create a renderstring first:
https://mespotin.uber.space/Mespotin..._Renderstrings


You should reading the Introduction-chapters about Rendering as well: https://mespotin.uber.space/Mespotin...1_Introduction

They'll explain you a lot about, how to do rendering of files.
__________________
Ultraschall-API - a Lua-functions-library4Reaper: https://forum.cockos.com/showthread....98#post2067798
Reaper Internals - Developerdocs4Reaper: https://forum.cockos.com/showthread.php?t=207635
mespotine is offline   Reply With Quote
Old 12-19-2018, 10:52 AM   #90
mespotine
Human being with feelings
 
mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig, Germany
Posts: 1,117
Default

Quote:
Originally Posted by karbomusic View Post
It's probably available in C++ as an extension assuming you can Import the needed libraries but I still think tying all this directly into Reaper is potentially less desirable long-term, or maybe not. It may be even remotely available in Lua - or at least starting an external app via Lua when the render completes.
I'm currently coding Lua only, so I'm not capable at all to write such a thing. I also try to make the API as system-independent as possible, so there's no "you can do this, but only on Windows"-stuff in there.
So, I'll probably not looking into it, unless there's an easy possibility for Linux and Mac as well.

It would be cool, however, if Reaper's Lua would support modules, like dll-modules and such. But unfortunately, it doesn't :/
__________________
Ultraschall-API - a Lua-functions-library4Reaper: https://forum.cockos.com/showthread....98#post2067798
Reaper Internals - Developerdocs4Reaper: https://forum.cockos.com/showthread.php?t=207635
mespotine is offline   Reply With Quote
Old 12-19-2018, 11:35 AM   #91
tXShooter
Human being with feelings
 
tXShooter's Avatar
 
Join Date: Aug 2017
Posts: 285
Default

Quote:
Originally Posted by karbomusic View Post
I have no idea what languages you know but in C#/.NET you could create a FileSystemWatcher that monitors some directory for changes and when a create file event occurs (the render), pull the file that caused the change then email it using .NET's System.Net.Mail component. This would avoid Outlook/COM altogether. Or you could use Outlook's .NET Office Library to interop and send it via Outlook but it's much easier to avoid having to use such a heavy mail client for this IMHO. You would have to know when the render is complete before acting though - doable just mentioning for awareness.

Or you could just take the folder watching out of the equation and write a similar app that whenever you execute it, it emails everything in folder X. That's how I would most likely do it.
That's why I said,
Quote:
However, and quite sadly, this script still involves using 5 other AHK scripts to automate things. Things like GetSceneNumber(OSC), Render, Save File, Compose Email, and Watchdog (to close things that are left open by some reason or another).
(I forgot about a script... a Database Parser that parses all of the Reaper markers into Excel immediately after the recording stops.)

The roughest parts have been outside of the COM Object, and that's mostly due to a lack of good/proper documentation, support, and example.
__________________
"But be ye doers of the word, and not hearers only, deceiving your own selves."
tXShooter is online now   Reply With Quote
Old 12-27-2018, 08:06 AM   #92
lachinhan
Human being with feelings
 
lachinhan's Avatar
 
Join Date: Nov 2014
Location: Can Tho - Viet Nam
Posts: 101
Default

I like this features of Ultraschall https://youtu.be/14jFONiA83g
__________________
NK Recording Studio
Email: lachinhan@gmail.com or admin@thuamninhkieu.com
Website:nkpro.top
lachinhan is offline   Reply With Quote
Old 12-27-2018, 09:47 AM   #93
mespotine
Human being with feelings
 
mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig, Germany
Posts: 1,117
Default

Quote:
Originally Posted by lachinhan View Post
I like this features of Ultraschall https://youtu.be/14jFONiA83g
Yes, and we're already working on the next iteration of it
__________________
Ultraschall-API - a Lua-functions-library4Reaper: https://forum.cockos.com/showthread....98#post2067798
Reaper Internals - Developerdocs4Reaper: https://forum.cockos.com/showthread.php?t=207635
mespotine is offline   Reply With Quote
Old 12-29-2018, 09:07 AM   #94
chip mcdonald
Human being with feelings
 
chip mcdonald's Avatar
 
Join Date: May 2006
Location: NA - North Augusta South Carolina
Posts: 3,559
Default

Quote:
Originally Posted by mespotine View Post
Yes, you just need to pass the filename+path of the rpp-file to the render-function.

There's a function, that gets all files in a path into an array:
Ok, thanks! Too much to undertake at the moment but good to know.
__________________
]]]>-guitar lessons - www.chipmcdonald.com-<[[[
Experiencing Guitar: Essays from Teaching by Chip McDonald https://www.amazon.com/dp/1521877823..._QZJxAbA4GVDC1
chip mcdonald is offline   Reply With Quote
Old 12-29-2018, 11:40 AM   #95
mespotine
Human being with feelings
 
mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig, Germany
Posts: 1,117
Default

If anyone is at the 35th Chaos Communication Congress in Leipzig/Germany, I'm there at the "Sendezentrum" in the CCL.
So if you have questions regarding the API and are there, gimme a wink here or at https://twitter.com/mespotineshows
__________________
Ultraschall-API - a Lua-functions-library4Reaper: https://forum.cockos.com/showthread....98#post2067798
Reaper Internals - Developerdocs4Reaper: https://forum.cockos.com/showthread.php?t=207635
mespotine is offline   Reply With Quote
Old 01-03-2019, 03:37 PM   #96
Travesty
Human being with feelings
 
Travesty's Avatar
 
Join Date: Nov 2014
Posts: 420
Default

This is amazing
Travesty is offline   Reply With Quote
Old 01-05-2019, 02:30 PM   #97
mespotine
Human being with feelings
 
mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig, Germany
Posts: 1,117
Default

Thanks


@all

anyone already trying to do something with this API? If yes, what are you currently trying to do?

I'm curious


@mods
Could you make this sticky? This will be developed much more further in the future...
__________________
Ultraschall-API - a Lua-functions-library4Reaper: https://forum.cockos.com/showthread....98#post2067798
Reaper Internals - Developerdocs4Reaper: https://forum.cockos.com/showthread.php?t=207635
mespotine is offline   Reply With Quote
Old 01-06-2019, 01:20 PM   #98
woodslanding
Human being with feelings
 
woodslanding's Avatar
 
Join Date: Mar 2007
Location: Denver, CO
Posts: 378
Default

Since I am seeing you are very interested in color transformation, I thought I would see if you would want to look into supporting HCL.

A very nice introduction here:

https://howlettstudios.com/articles/...oblem-with-hsv

It's something I'd love to implement in my guis. I typically have lightness controlled by the program, depending on whether it's background under black text, or colored text on a black background, etc, and have user controls for saturation and hue. But this results in drastic difference in lightness, which can make reading the text very problematic. HCL solves this problem. And if you set up a horizontal line in the color picker at this link, you can see how delightfully you get a spectrum of colors of identical brightness.

Just a thought!

EDIT: Some good links to existing code here:
https://www.vis4.net/blog/2011/12/av...nt-hsv-colors/
__________________
eric moon
Very Stable Genius
https://gogolab.com/

Last edited by woodslanding; 01-06-2019 at 01:28 PM.
woodslanding is offline   Reply With Quote
Old 01-06-2019, 01:43 PM   #99
woodslanding
Human being with feelings
 
woodslanding's Avatar
 
Join Date: Mar 2007
Location: Denver, CO
Posts: 378
Default

Looking at this:

https://gka.github.io/chroma.js/

There is support for HCL, so the code is in there somewhere.

I like how you can take an existing color and set it to a particular luminance.... I am going to have a look at the code that does that, that seems like a good way of allowing the user to select any color, and still have it show up properly against various colors of background or text
__________________
eric moon
Very Stable Genius
https://gogolab.com/
woodslanding is offline   Reply With Quote
Old 01-07-2019, 05:18 AM   #100
_Stevie_
Human being with feelings
 
_Stevie_'s Avatar
 
Join Date: Oct 2017
Posts: 2,222
Default

Quote:
Originally Posted by mespotine View Post
Thanks


@all

anyone already trying to do something with this API? If yes, what are you currently trying to do?

I'm curious
Nothing fancy: exporting audio based on the project name, adding the start timecode and choose FLAC as format.
__________________
My Reascripts forum thread | My Reascripts on GitHub | Stephan Römer - film composer
If you wish to donate for my scripts: please consider an organization like: animal shelter, doctors without borders, UNICEF, etc...
_Stevie_ is online now   Reply With Quote
Old 01-07-2019, 10:30 AM   #101
_Stevie_
Human being with feelings
 
_Stevie_'s Avatar
 
Join Date: Oct 2017
Posts: 2,222
Default

@mespotine

I'm just digging thru the Render functions.

1. Do we always need to make a copy of a project to set the render options,
or can we use the current one that is opened?

2. I want to generate the filename based on wildcards. Do I need to use both functions sequentially in that case?

SetProject_RenderFilename and put "" to use a render pattern instead
and SetProject_RenderPattern to generate the pattern
__________________
My Reascripts forum thread | My Reascripts on GitHub | Stephan Römer - film composer
If you wish to donate for my scripts: please consider an organization like: animal shelter, doctors without borders, UNICEF, etc...
_Stevie_ is online now   Reply With Quote
Old 01-07-2019, 02:05 PM   #102
_Stevie_
Human being with feelings
 
_Stevie_'s Avatar
 
Join Date: Oct 2017
Posts: 2,222
Default

Okay, next confusion(s).

Although, I'm referring to the current project (which is already open), Reaper ones the project again to render it.

And the second thing: how can I write the RenderPattern to the actual file?
When I execute RenderProject_RenderCFG, I have to set render_filename, without the possibility to refer to the RenderPattern.

What I got is:

Code:
dofile(reaper.GetResourcePath().."/UserPlugins/ultraschall_api.lua")
retval, projectfilename_with_path = reaper.EnumProjects(-1,"")

render_cfg_string = ultraschall.CreateRenderCFG_WAVPACK(3, 0, 0, true, false)

retval = ultraschall.SetProject_RenderPattern(nil, "$project $starttimecode")

retval, _, _, _ = ultraschall.RenderProject_RenderCFG(nil, "m:/Projekte/Export/", -1, -1, false, false, false, render_cfg_string)
__________________
My Reascripts forum thread | My Reascripts on GitHub | Stephan Römer - film composer
If you wish to donate for my scripts: please consider an organization like: animal shelter, doctors without borders, UNICEF, etc...
_Stevie_ is online now   Reply With Quote
Old 01-07-2019, 02:20 PM   #103
mespotine
Human being with feelings
 
mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig, Germany
Posts: 1,117
Default

@stevie

The reopening of a currently opened project to render it is a limitation I can't surpass. This is the only way of making the current-project-rendering possible.

Good observation with the render-pattern-problem. I will look into it and probably add a function, that renders a project by using a Renderpattern instead of a export-filename.
But need to dig deeper into RenderPattern, as I don't use them at all.

Otherwise, the only option is to set the Render-Pattern, load the altered project and use the action for render using the last render-settings.


I'll put also on my ToDo-List to create a temporary render-project, which can be altered using the render-setting-functions and rendered afterwards.


@woodslanding

I'll look into it. THanks for the links
__________________
Ultraschall-API - a Lua-functions-library4Reaper: https://forum.cockos.com/showthread....98#post2067798
Reaper Internals - Developerdocs4Reaper: https://forum.cockos.com/showthread.php?t=207635
mespotine is offline   Reply With Quote
Old 01-07-2019, 06:14 PM   #104
_Stevie_
Human being with feelings
 
_Stevie_'s Avatar
 
Join Date: Oct 2017
Posts: 2,222
Default

Quote:
Originally Posted by mespotine View Post
@stevie

The reopening of a currently opened project to render it is a limitation I can't surpass. This is the only way of making the current-project-rendering possible.
I see, bummer. With a huge project, re-loading might take longer, than setting up the render dialog.

Quote:
Good observation with the render-pattern-problem. I will look into it and probably add a function, that renders a project by using a Renderpattern instead of a export-filename.
But need to dig deeper into RenderPattern, as I don't use them at all.

Otherwise, the only option is to set the Render-Pattern, load the altered project and use the action for render using the last render-settings.
Interessting, so the editings will be saved as "last render" settings.

Quote:
I'll put also on my ToDo-List to create a temporary render-project, which can be altered using the render-setting-functions and rendered afterwards.
Great, thanks!
__________________
My Reascripts forum thread | My Reascripts on GitHub | Stephan Römer - film composer
If you wish to donate for my scripts: please consider an organization like: animal shelter, doctors without borders, UNICEF, etc...
_Stevie_ is online now   Reply With Quote
Old 01-08-2019, 03:04 AM   #105
reapero
Human being with feelings
 
Join Date: Aug 2011
Posts: 158
Default

Yeah, same for me. Tried to use the render stuff but opening the project again just kills the computer.

Terrrific work Mespotine, thanks!!
reapero is online now   Reply With Quote
Old 01-08-2019, 09:10 AM   #106
mespotine
Human being with feelings
 
mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig, Germany
Posts: 1,117
Default

New Hotfix for the Ultraschall-API.

Download it at https://api.mespotine.de/ultraschall_hotfixes.lua and replace the file ultraschall_hotfixes.lua with that one.


@stevie
The aforementioned hotfix includes some stuff interesting for you.

RenderProject_RenderCFG-function:
you can set renderfilename_with_path now to nil, which means, that it will use the rendername/renderpattern already set in the file


string tempfile = ultraschall.CreateTemporaryFileOfProjectfile(strin g projectfilename_with_path)
this creates a temporary-file of a rpp-projectfile. (Yet undocumented, but will be part of the next official beta of the Ultraschall-API.)


With that, you can do RenderPatterns, like in the following demoscript:
Code:
-- Ultraschall-API-demoscript - Meo Mespotine - 8th of January 2019
--
-- render the currently opened project, using renderpattern.
-- needs the currently opened project to be saved first!
--
-- needs at least Ultraschall-API 4.00 beta 2.7 including hotfixes from 8th of January 2019
-- get them all from ultraschall.fm/api 
dofile(reaper.GetResourcePath().."/UserPlugins/ultraschall_api.lua")

-- First, we create a FLAC-render-cfg-string
render_cfg_string = ultraschall.CreateRenderCFG_FLAC(0, 5)

-- Lets create a tempfile of the project. If no parameter is given, it will use the projectfile of the currently opened project.
-- If that isn't possible(project not being saved for instance), end the script
tempfile = ultraschall.CreateTemporaryFileOfProjectfile()
if tempfile==nil then return end


-- Now do the manipulation with the tempfile (!!!)
-- for example, the render-pattern:
retval = ultraschall.SetProject_RenderPattern(tempfile, "$year-$monthname-$day this is my file")


-- now we render the stuff. Note: the renderfilename_with_path is set to nil here, but the projectfile is set to tempfile!
retval, renderfilecount, MediaItemStateChunkArray, Filearray = ultraschall.RenderProject_RenderCFG(tempfile, nil, -1, -1, false, true, true, render_cfg_string)


-- after all is done, we need to delete the tempfile again
os.remove(tempfile)

ultraschall.ShowLastErrorMessage()
I don't know, whether you need to set the rendername to "" when setting a renderpattern and I don't know, how to give a path. Maybe you can help me with that.


@reapero and stevie
With my FR fulfilled for Get/SetProjectStateChunk, I could get rid of the otherwise useless reloading of a project.
Maybe you could vote for it? (Hint Hint, Nudge Nudge)

https://forum.cockos.com/showthread.php?p=2059252

I hope, there's no technical limitation forbidding the Reaper-devs giving us the ProjectStateChunk of an opened project...


@myself
I should finally find a way delivering the API with ReaPack. Gonna look into it next week, hopefully...
__________________
Ultraschall-API - a Lua-functions-library4Reaper: https://forum.cockos.com/showthread....98#post2067798
Reaper Internals - Developerdocs4Reaper: https://forum.cockos.com/showthread.php?t=207635
mespotine is offline   Reply With Quote
Old 01-09-2019, 02:22 AM   #107
andyp24
Human being with feelings
 
Join Date: Mar 2016
Posts: 643
Default

Hi Mespotine

Thanks for all these functions, which I'll investigate as time goes on.

One question please - is calling one of your functions (eg "Select all items to the left") likely to be faster or slower than writing my own loop within a script to do that? Or does it just depend whether your code is more efficient than mine in the way it works?

In other words, is the advantage of your library of functions simply that it saves me having to write them, or will they potentially run faster too?

Thanks
Andy

Last edited by andyp24; 01-09-2019 at 08:51 AM.
andyp24 is online now   Reply With Quote
Old 01-09-2019, 11:33 AM   #108
mespotine
Human being with feelings
 
mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig, Germany
Posts: 1,117
Default

Quote:
Originally Posted by andyp24 View Post
Hi Mespotine

Thanks for all these functions, which I'll investigate as time goes on.

One question please - is calling one of your functions (eg "Select all items to the left") likely to be faster or slower than writing my own loop within a script to do that? Or does it just depend whether your code is more efficient than mine in the way it works?

In other words, is the advantage of your library of functions simply that it saves me having to write them, or will they potentially run faster too?

Thanks
Andy
Depends. My implementations are mostly to save me from having to code stuff time and again, though some of my code is probably slower than it could.
In a future version, I'll add the option for you to suggest a better implementation. So if performance is a thing for you and you'll find that your code is faster than mine, drop me a note in how you did that and I'll try to improve speed.


@stevie and reapero
I might have an idea of speeding up the rendering by getting rid of the loading of a project by maybe exploiting the render-queue.
No promises, but my yesterday's tests looked quite promising.

Thanks for your feedback, by the way, as it inspired me to this new idea
__________________
Ultraschall-API - a Lua-functions-library4Reaper: https://forum.cockos.com/showthread....98#post2067798
Reaper Internals - Developerdocs4Reaper: https://forum.cockos.com/showthread.php?t=207635
mespotine is offline   Reply With Quote
Old 01-09-2019, 02:41 PM   #109
andyp24
Human being with feelings
 
Join Date: Mar 2016
Posts: 643
Default

Great, thanks for the explanation.
Andy
andyp24 is online now   Reply With Quote
Old 01-09-2019, 04:08 PM   #110
_Stevie_
Human being with feelings
 
_Stevie_'s Avatar
 
Join Date: Oct 2017
Posts: 2,222
Default

Quote:
Originally Posted by mespotine View Post

@stevie and reapero
I might have an idea of speeding up the rendering by getting rid of the loading of a project by maybe exploiting the render-queue.
No promises, but my yesterday's tests looked quite promising.

Thanks for your feedback, by the way, as it inspired me to this new idea
That sounds great! Awesome idea, looking forward to it
__________________
My Reascripts forum thread | My Reascripts on GitHub | Stephan Römer - film composer
If you wish to donate for my scripts: please consider an organization like: animal shelter, doctors without borders, UNICEF, etc...
_Stevie_ is online now   Reply With Quote
Old 01-11-2019, 08:36 AM   #111
mespotine
Human being with feelings
 
mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig, Germany
Posts: 1,117
Default

Is anyone interested in a "Ultraschall-API-feature of the week" post, in which I show and explain certain cool features I provided?

Just to help you getting what you can do with it actually, without being overwhelmed by the amount of functions...

What do you think?
__________________
Ultraschall-API - a Lua-functions-library4Reaper: https://forum.cockos.com/showthread....98#post2067798
Reaper Internals - Developerdocs4Reaper: https://forum.cockos.com/showthread.php?t=207635
mespotine is offline   Reply With Quote
Old 01-11-2019, 10:55 AM   #112
reapero
Human being with feelings
 
Join Date: Aug 2011
Posts: 158
Default

That ´d be nice. I´d follow it at least.
reapero is online now   Reply With Quote
Old 01-11-2019, 07:45 PM   #113
_Stevie_
Human being with feelings
 
_Stevie_'s Avatar
 
Join Date: Oct 2017
Posts: 2,222
Default

Sure man, if you find the time to do so, it would be highly appreciated!
__________________
My Reascripts forum thread | My Reascripts on GitHub | Stephan Römer - film composer
If you wish to donate for my scripts: please consider an organization like: animal shelter, doctors without borders, UNICEF, etc...
_Stevie_ is online now   Reply With Quote
Old 01-12-2019, 05:08 AM   #114
cyrano
Human being with feelings
 
cyrano's Avatar
 
Join Date: Jun 2011
Location: Belgium
Posts: 4,035
Default

Quote:
Originally Posted by mespotine View Post
Is anyone interested in a "Ultraschall-API-feature of the week" post, in which I show and explain certain cool features I provided?

Just to help you getting what you can do with it actually, without being overwhelmed by the amount of functions...

What do you think?
That would be great! Especially for dumbo's like me...
__________________
“It has become appallingly obvious that our technology has exceeded our humanity” Albert Einstein
cyrano is offline   Reply With Quote
Old 01-13-2019, 05:35 PM   #115
mespotine
Human being with feelings
 
mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig, Germany
Posts: 1,117
Default

Ultraschall Api
Feature of the Week
#1

Before we start with cool features, I would love to introduce you to a very helpful feature in day-to-day-programming, which usually means: fixing bugs.
One of the main problems of fixing bugs are cryptic error-messages or even worse: error-codes.
I hate that and if you're programming a lot, you probably hate it too.
So I added an error-messaging system. You can do a lot with it, but I want to focus on one aspect that's most useful for you.

All API-functions create useful error-messages, when a problem arises. Yes, all of them!

So let me introduce to you:

ShowLastErrorMessage
This function is simple. If an error happened in one of the Ultraschall-API-functions, calling this function will open a messagebox showing you the problematic function, the problematic parametername(if applicable) and the error-message. It will be the last error that occurred, before calling ShowLastErrorMessage.

So let's assume, you want to read a file using ReadFullFile, but for some reasons, you don't give the function a filename, but rather something else, like the number "1"

Code:
-- let's add the Ultraschall-API to our script
dofile(reaper.GetResourcePath().."/UserPlugins/ultraschall_api.lua")

-- let's pass a wrong parameter to this function
ultraschall.ReadFullFile(1)

-- see, whether we produced an error
ultraschall.ShowLastErrorMessage()
When we run this script, ShowLastErrorMessage will show us, that the first parameter filename_with_path must be a string, which tells us: it can't be a number.
PS: if you pass to ReadFullFile a filename of a file that doesn't exist, it will raise the error that the file does not exist, that you passed in parameter filename_with_path, when running ShowLastErrorMessage.

So everytime you pass a wrong value into a parameter or something else goes wrong, it will show you, what went wrong.

Include this function into your prayers, as it will quickly help you finding obvious bugs in your scripts.
I added this as programming-sugar for all of you, but quickly understood, how helpful it is for me as well.

I often put this at the end of my script, so it will show me the last error that happened in my script, if at all. If you have weird behaving functions, you should include ShowLastErrorMessage after the weird behaving functions to see, if it created an error.

This is especially useful for those of you, who use an external editor, but if you use Reaper's own ReaScript-IDE, it is helpful as well.



If you are programming in the ReaScript-IDE and want to have the error-messages shown at the bottom, just as any other error-message by Reaper or Lua, you can use another nice function:

ToggleIDE_Errormessages
This toggles, whether error-messages shall be shown like any other ReaScript/Reaper-API-function/Lua-error at the bottom of the IDE or in an error-window opened, while the IDE is closed.


Whatever you prefer, getting useful debug-information by Ultraschall-API-functions isn't hard.


PS: I mostly use ShowLastErrorMessage and I love it

PSPS: It works only for Ultraschall-API-functions. Reaper's own functions don't create such error-messages, though I already think about, how to do that as well. Maybe some day...
__________________
Ultraschall-API - a Lua-functions-library4Reaper: https://forum.cockos.com/showthread....98#post2067798
Reaper Internals - Developerdocs4Reaper: https://forum.cockos.com/showthread.php?t=207635
mespotine is offline   Reply With Quote
Old 02-04-2019, 07:59 AM   #116
mespotine
Human being with feelings
 
mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig, Germany
Posts: 1,117
Default

Anyone in need of helper functions for every day Reaper-programming?
Now it's time for such feature-requests, as I'm working on the next Ultraschall-Api-update.
__________________
Ultraschall-API - a Lua-functions-library4Reaper: https://forum.cockos.com/showthread....98#post2067798
Reaper Internals - Developerdocs4Reaper: https://forum.cockos.com/showthread.php?t=207635
mespotine is offline   Reply With Quote
Old 02-22-2019, 09:51 AM   #117
mespotine
Human being with feelings
 
mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig, Germany
Posts: 1,117
Default

Watch this space for a new release next week.

Especially, if you ever wanted to pass parameters to a script that you want to start (Teaserteaser)


@mods:
Is it possible to make this thread sticky somehow?
__________________
Ultraschall-API - a Lua-functions-library4Reaper: https://forum.cockos.com/showthread....98#post2067798
Reaper Internals - Developerdocs4Reaper: https://forum.cockos.com/showthread.php?t=207635
mespotine is offline   Reply With Quote
Old 02-22-2019, 12:40 PM   #118
TonE
Human being with feelings
 
Join Date: Feb 2009
Location: Reaper HAS send control via midi !!!
Posts: 1,806
Default

Quote:
Originally Posted by mespotine View Post
Especially, if you ever wanted to pass parameters to a script that you want to start (Teaserteaser)
If you would add a few examples where this feature could be useful, that would make this post complete.
TonE is offline   Reply With Quote
Old 02-25-2019, 10:45 AM   #119
mespotine
Human being with feelings
 
mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig, Germany
Posts: 1,117
Default

It was a FeatureRequest by lokasenna.

You could write one script, that accepts parameters. Now you could start that script from other scripts and pass parameters to it.

One example: you could write a script, that runs Guis, like with lokasenna's GuiLib. You could then tell, via parameters, which gui-element shall be part of the gui and what not.
That way, you would not have a gui in each of your scripts, but rather concentrated in one script.
And this script could be started multiple times from your script. And each of these multiple started gui-scripts can be controlled via parameters to have individual gui-designs.

Which means: you could have multiple gui-windows in one script by that, which is impossible to do with a "naked Reaper".

This is also, what I designed that for.
__________________
Ultraschall-API - a Lua-functions-library4Reaper: https://forum.cockos.com/showthread....98#post2067798
Reaper Internals - Developerdocs4Reaper: https://forum.cockos.com/showthread.php?t=207635
mespotine is offline   Reply With Quote
Old 02-27-2019, 10:07 AM   #120
mespotine
Human being with feelings
 
mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig, Germany
Posts: 1,117
Default New release 4.00 beta 2.72

It's spring, times are a changing. And so I release a brand-new-version of the Ultraschall-API.


[small]4.00 Beta 2.72: - "Blue Oyster Cult - Don't fear the Reaper" - 1st of March 2019[/small]

It has now 780 functions, with 80 new ones

Among them new features, like:
  • ReaPack installable, it can be installed using ReaPack now, using https://github.com/Ultraschall/ultra..._api_index.xml - Request by X-Raym
  • Defer-functions, that allow setting, how often a specific defer-loop shall be executed, every n'th cycle/second. They also
    allow being terminated from inside and outside the current script.
  • ChildScripts, that allow you to run scripts as multiple script-instances, pass parameters and returnvalues to and from them - Request by lokasenna
  • Get HWNDS, get numerous HWNDs, including the one of your gfx.init-window, ArrangeView, Timeline, Render to File-dialog, Actions-dialog, etc - Request by Sexan
  • print and print2, replaces the unuseable print-function from Lua
  • new backgroundscripts, who monitor statechanges of playstate, editcursorposition and loop-button
  • Custom Markers and Regions, that follow the scheme "_custommarkername: text", that can be easily managed.
    Have multiple markertypes with custom-markers and custom-regions with this feature. - request by VanillaChief
  • Reaper-Internals Docs, updated to Reaper 5.971(including the new Video Processor-docs), SWS 2.10.0.1, JS-Extension 0.971 and ReaPack.
  • many, many, many, many bugfixes
New features in 4.00beta2.72
  • SplitStringAtNULLBytes - splits a string at NULL-bytes ( \0 )
  • new background-script - ultraschall_track_old_playstate.lua - stores old playstate into extstate ultraschall->last_playstate
  • GetLastPlayState - returns the last playstate before the current one
  • US_Api_AUD.html - added
  • US_Api_Concepts_AUD.html - added
  • US_Api_Concepts_DOC.html - added
  • US_Api_Concepts_GFX.html - added
  • US_Api_Concepts_GUI.html - added
  • US_Api_Concepts_VID.html - added
  • US_Api_DOC.html - added
  • US_Api_GFX.html - added
  • US_Api_GUI.html - added
  • US_Api_VID.html - added
  • US_Api-AUD.USDocML - added
  • US_Api-DOC.USDocML - added
  • US_Api-GFX.USDocML - added
  • US_Api-GUI.USDocML - added
  • US_Api-VID.USDocML - added
  • NewUltraschallDoc_VID_Converter.lua - added
  • NewUltraschallDoc_GUI_Converter.lua - added
  • NewUltraschallDoc_DOC_Converter.lua - added
  • NewUltraschallDoc_AUD_Converter.lua - added
  • NewUltraschallConceptsDocConverter_AUD.lua - added
  • NewUltraschallConceptsDocConverter_DOC.lua - added
  • NewUltraschallConceptsDocConverter_GFX.lua - added
  • NewUltraschallConceptsDocConverter_GUI.lua - added
  • NewUltraschallConceptsDocConverter_VID.lua - added
  • IsValidHWND - checks, if a HWND is a valid one
  • Main_OnCommandByFilename - runs a command by its filename instead of the ActionCommandID/command-id;
    returns a unique script-identifier for the started script-instance, that you can use as
    extstate to communicate with that script;
    allows passing of parameters to the started script!
  • MIDI_OnCommandByFilename - runs a command in the MIDI-Editor context by its filename instead of the ActionCommandID/command-id;
    returns a unique script-identifier for the started script-instance, that you can use as
    extstate to communicate with that script
    allows passing of parameters to the started script!
  • BrowseForOpenFiles - utilizes JS_Dialog_BrowseForOpenFiles-function, but returns the files and paths in a more comfortable way
  • Base64_Encoder - encodes a string into a Base64-encoded string
  • CreateTemporaryFileOfProjectfile - creates a valid temporary-copy of an rpp-projectfile; use nil for the currently opened one(must be saved first)
  • ultraschall.hotfixdate - holds the release-date of the currently installed hotfix, returned by GetApiVersion now
  • Base64_Decoder - decodes a Base64-encoded string
  • StateChunkLayouter - layouts statechunks according the layouting rules of rpp-projectfiles; makes parsing them much easier
  • CountUltraschallEffectPlugins - counts number of instances of StudioLink, StudioLinkOnAir, Ultraschall-Soundboard and Ultraschall_Dynamics-plugins in a track. Also returns a table with all bypass/offline-states
  • GetReaperWindowAttributes - returns several attributes of the Reaper-window, like size/position, active-state, childwindows, etc
  • GetTopmostHWND - returns the topmost hwnd(window-handler) of a child-hwnd; returns also all the parent-hwnds
  • print - replacement for Lua's own print-function(which is quite useless in Reaper); displays the printed parameters in the ReaScript-console
  • print2 - like print, but displays the parameters as a messagebox instead
  • ConvertIntegerToBits - converts an integer-value into its individual bitvalues
  • ReverseEndianess_Byte - changes endianess of a byte-value
  • GFX_Init - opens a new gfx-window. Like gfx.init, but this returns its HWND-windowhandler-object as well
  • GFX_GetWindowHWND - gets the HWND of a opened gfx-window, opened with ultraschall.GFX_Init
  • ReaPack-functions - added ReaPack-functions to Reaper-Internals docs
  • Windows_Find - finds Reaper-windows by title and returns their HWNDs
  • GetAllReaScriptIDEWindows - returns the HWNDs of all opened ReaperIDE-windows
  • GetReaScriptConsoleWindow - returns the HWND of the ReaScript-console, if open at all.
  • IsReaperRendering - returns, if Reaper is currently rendering a file
  • GetAllRecursiveFilesAndSubdirectories - returns all subdirectories with all their files with full path of a directory
  • RippleCut_Regions - ripple-cuts all regions between startposition and endposition and moves all regions after endposition toward projectstart by difference between startposition and endposition
  • ShowErrorMessagesInReascriptConsole - toggles, if errormessages shall be shown in the ReaConsole immediately, when they happen
  • GFX_DrawThickRoundRect - draws a round-rectangle with variable thickness
  • GFX_BlitFramebuffer - blits the content of a framebuffer into the drawing-buffer; will resize, if necessary and retains aspect-ratio
  • ConvertIntegerIntoString - converts the individual bytes of an integer into a string
  • GetProject_RenderOutputPath - returns the output-directories for rendered files from a projectfile
  • GetSetIntConfigVar - gets/sets a configuration-variable of the type integer-bitfield
  • GetScriptIdentifier - returns a unique identifier-string for the current script-instance, that can be used to send command/string to this scriptinstance
  • Defer1 to Defer20 - run a customized defer-cycle, in which you can decide, how often it should be run. You can also stop such a defer-cycle from in/outside the script using StopDeferCycle.
    For that, Defer1 to Defer20 will return an identifier, which can be used to stop this specific defer-cycle.
    You should only use each DeferXX-cycle once in a script-instance, or the timing will become corrupt!
  • StopDeferCycle - stops a Defer1 to Defer20-defer-instance from a script-instance
  • GetTrackSelection_TrackStateChunk - gets, if a track in a StateChunk is selected; works only with TrackStateChunks from ProjectStateChunks
  • SetTrackSelection_TrackStateChunk - sets a track in a StateChunk selected; works only with TrackStateChunks from ProjectStateChunks
  • GetIniFileValue - gets an ini-value from an ini-file; unlike SWS's own functions for that(2.9.7 and earlier), this has no problems with Umlauts in the path
  • SetIniFileValue - sets an ini-value into an ini-file; unlike SWS's own functions for that(2.9.7 and earlier), this has no problems with Umlauts in the path
  • SetLoopState - sets the current loop-state(button)
  • GetLoopState - gets the current state of loop
  • SetScriptParameters - sets parameters for a child-script, as started by Main_OnCommandByFilename and MIDI_OnCommandByFilename
  • GetScriptParameters - gets parameters for a child-script, as started by Main_OnCommandByFilename and MIDI_OnCommandByFilename
  • GetScriptReturnvalues - gets returnvalues, that a script-instance with a specific scriptidentifier sent to the current script
  • SetScriptReturnvalues - sends returnvalues to a script-instance with a specific scriptidentifier
  • GetLastLoopState - gets the last loop-state, needs RunBackgroundHelperFeatures to be run first
  • GetVerticalScroll - gets the current vertical-scroll-factor of the arrangeview
  • SetVerticalScroll - sets a new vertical-scroll-factor of the arrangeview
  • GetUserInputs - gets the user-input. Like Reaper's own GetUserInputs but a different parameter-scheme, that should be easier to handle.
  • GetScriptReturnvalues_Sender - gets, which child-scripts(and their corresponding ScriptIdentifier) have sent return-values to the current script
  • GetDeferIdentifier - gets the identifier of a Defer1 to Defer20-cycle of the current script
  • Docs: Child Scripts: Introduction - added chapter
  • Docs: Child Scripts: The unique ScriptIdentifier - added chapter
  • Docs: Child Scripts: Running Childscripts - added chapter
  • Docs: Child Scripts: Passing Parameters and Returnvalues - added chapter
__________________
Ultraschall-API - a Lua-functions-library4Reaper: https://forum.cockos.com/showthread....98#post2067798
Reaper Internals - Developerdocs4Reaper: https://forum.cockos.com/showthread.php?t=207635
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 10:36 AM.


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