View Single Post
Old 01-08-2019, 09:10 AM   #106
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 6,629
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...
__________________
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