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

Reply
 
Thread Tools Display Modes
Old 12-08-2018, 04:29 AM   #1
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 6,612
Default Ultraschall-API 4.9 - 1663 Lua-Functions -"Razor Edit"

After over 6 years of coding, I'm proud to announce the release of the

Ultraschall-API 4.9 - a 1662 Lua-functions-library for Reaper

which can be found at https://ultraschall.fm/api or installed via ReaPack, using https://github.com/Ultraschall/ultra..._api_index.xml

This API is intended to make programming Reaper much more easier, trying to give you access to many hard-to-code corners of Reaper, improving programming workflows, that are inconvenient to work with using Reaper's own API, making debugging of scripts much easier and much more.
This API was to be used within Ultraschall only, but quickly evolved into a huge 1000+ function-library, that many 3rd-party programmers and scripters may find use in, with many useful features, like:
  • ReaPack-installable, add it to your ReaPack-installation and you can install it easily
  • Rendering - you can render your projects without having to use the render-dialog. You can customize the rendering-workflow in every way you want. Just create a renderstring and pass it over to RenderProject_RenderCFG or RenderProjectRegions_RenderCFG
  • Navigation, Follow and Arrangeview-Manipulation - get/set cursors, zoom, autoscroll-management, scroll, etc
  • ArrangeView-Snapshots - you can save, retrieve snapshots of the arrangeview, including position, zoomstates to quickly jump through parts of your project
  • Trackstates - you can access and set all(!) track-states available
  • ProjectStates - you can access all and set many project-states available
  • EventManager - run actions, when certain events occur. Which events? You decide!
  • Mediaitem-states - you can access and set many mediaitem-states (more will follow)
  • File access - many helperfunctions for reading, writing, copying files. No more hassle writing it yourself! e.g ReadFullFile, WriteValueToFile, etc
  • Cough-Mute-management - you can write your own cough-buttons, that set the state of the mute-envelope of a track easily
  • Marker - extensive set of marker functions, get, set, export, import, enumerate, etc
  • Spectrogram - you can program the spectrogram-view
  • Routing - you can set Sends/Receives and HWOuts more straightforward than with Reaper's own Routing-functions. Includes mastertrack as well.
  • Get MediaItems - you can get all media-items within a time-range AND within the tracks you prefer; a 2D-approach e.g. GetAllMediaItemsBetween and GetMediaItemsAtPosition, etc
  • Gaps between items - you can get the gaps between items in a track, using GetGapsBetweenItems
  • Edit item(s) - Split, Cut, Copy, Paste, Move, RippleCut, RippleInsert, SectionCut by tracks AND time/start to endposition e.g. RippleCut, RippleInsert, SectionCut, SplitMediaItems_Position, MoveMediaItemsBefore_By, MoveMediaItemsSectionTo and many more
  • Previewing MediaItems and files - you can preview MediaItems and files without having to start playback of a project
  • KB-Ini-Management - manipulate the reaper-kb.ini-file with custom-settings
  • Checking for Datatypes - check all datatypes introduced with Ultraschall-API and all Lua/Reaper-datatypes
  • UndoManagement - functions for easily making undoing of functions as well as preventing creating an undo-point
  • RunCommand for Items/Tracks - apply actions to specific items/tracks
  • Checking for changed projecttabs - check, if projecttabs have been added/removed
  • ExtState-Management - an extensive set of functions for working with extstates as well as ini-files
  • Data Manipulation - manipulate a lot of your data, including bitwise-integers, tables, etc
  • Clipboard-Management - get items from clipboard, put them to clipboard, even multiple ones
  • Error Messaging System - all functions create useful error-messages that can be shown using, eg: ShowLastErrorMessage, for easier debugging
  • Custom-Defer-functions, who allow you to control, how often a deferred function shall be executed (every n'th cycle/second)
  • Child-Scripts, who allow starting scripts AND passing parameters/returnvalues/values between two scripts. Even multiple-instances of one script can be started, where communication with each scriptinstance is possible on an individual basis.
    Means: Start Childscript.lua twice, and you can communicate with ChildScript.lua(instance1) and ChildScript.lua(instance2) individually, which is difficult to do otherwise.
  • Custom-Markers and Regions, allow you to create different markertypes of the scheme _custommarker1: text of the marker
    You can add, set, count, enum, delete them like normal markers. All you need to set the custommarker-name (custommarker1 in the above example) and this will be used for the custom-markers/custom-regions of your choice
  • Razor Edit functions - you can manipulate, nudge, get/set Razor-Edit-Areas very easily
  • Localization of your scripts - via a translationfile. Now you can let people do translations for you without having to add them into your script by hand.
  • FXStateChunk-Management - access all the nice gems the API itself doesn't, though StateChunks provide
  • Parameter Modulation - code your parameter modulation. No more UI needed
  • tons of other helper-functions
  • my Reaper-Internals Documentation AND
it's fully documented.

Find the introduction to it here: https://mespotin.uber.space/Ultrasch..._Concepts.html
__________________
Use you/she/her.Ultraschall-Api Lua Api4Reaper - Donate, if you wish

On vacation for the time being...

Last edited by Meo-Ada Mespotine; 06-29-2023 at 03:16 PM. Reason: Release
Meo-Ada Mespotine is offline   Reply With Quote
Old 12-08-2018, 04:29 AM   #2
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 6,612
Default

For a description of concepts I introduce with it, see Functions Reference Page
Downloads and the latest hotfixes can be found at the Downloads Page.

Installation via ReaPack can be done using the index-URL: https://github.com/Ultraschall/ultra..._api_index.xml

Happy coding and let's see, what you can do with it

Meo Mespotine

For more information about Ultraschall itself, see ultraschall.fm and if you want to support us, see my support-page or the Ultraschall-donationpage for donating to us.

PS: This is public-beta, so it probably contains many bugs I couldn't find yet. Please report them, if you happen to find one. Read more about this in the Bugreporting and Feature Requests chapter of the docs.


Jesus..I need a break after this...


See the Ultraschall-Feature-of-the-Week-posts for some of the nice functionalities I provide.
Click here to go to the first post.
__________________
Use you/she/her.Ultraschall-Api Lua Api4Reaper - Donate, if you wish

On vacation for the time being...

Last edited by Meo-Ada Mespotine; 07-07-2020 at 05:35 AM.
Meo-Ada Mespotine is offline   Reply With Quote
Old 12-08-2018, 04:30 AM   #3
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 6,612
Default

Placeholder 2
__________________
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 12-08-2018, 04:30 AM   #4
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 6,612
Default

Placeholder 3
__________________
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 12-08-2018, 04:31 AM   #5
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 6,612
Default

Placeholder 4
__________________
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 12-08-2018, 04:32 AM   #6
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 6,612
Default

Placeholder 5 for something big to come...
__________________
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 12-08-2018, 04:41 AM   #7
Eliseat
Human being with feelings
 
Eliseat's Avatar
 
Join Date: Mar 2018
Location: Cologne
Posts: 1,362
Default

Eliseat is offline   Reply With Quote
Old 12-08-2018, 05:27 AM   #8
mschnell
Human being with feelings
 
mschnell's Avatar
 
Join Date: Jun 2013
Location: Krefeld, Germany
Posts: 14,634
Default

Are we going to see 700 "placeholder" messages ?

.. and it's still 16 days until Christmas

-Michael
mschnell is offline   Reply With Quote
Old 12-08-2018, 05:36 AM   #9
Coachz
Human being with feelings
 
Coachz's Avatar
 
Join Date: Oct 2010
Location: Charleston, SC
Posts: 12,762
Default

Delete this as spam mods
Coachz is offline   Reply With Quote
Old 12-08-2018, 07:03 AM   #10
Eliseat
Human being with feelings
 
Eliseat's Avatar
 
Join Date: Mar 2018
Location: Cologne
Posts: 1,362
Default

Quote:
Originally Posted by Coachz View Post
Delete this as spam mods
No, I'm to curious to know what its all about.
Eliseat is offline   Reply With Quote
Old 12-08-2018, 08:01 AM   #11
Jae.Thomas
Human being with feelings
 
Join Date: Jun 2006
Posts: 22,560
Default

I can totally see why someone would do this.. so im curious
Jae.Thomas is offline   Reply With Quote
Old 12-08-2018, 04:36 PM   #12
LowlyOP
Human being with feelings
 
LowlyOP's Avatar
 
Join Date: Feb 2018
Posts: 121
Default

i'm scared.
LowlyOP is offline   Reply With Quote
Old 12-09-2018, 02:02 PM   #13
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 6,612
Default

6 days, until you can easily

Color Items and Tracks:
Code:
-- Meo Mespotine - 30. November 2018
-- Cycles colors of MediaItems and MediaTracks. It's using a ColorTable with SonicRainboomColorStyle

dofile(reaper.GetResourcePath().."/UserPlugins/ultraschall_api.lua")

ColorTable=ultraschall.CreateSonicRainboomColorTable()           -- create ColorTable SonicRainboom-style
NumMediaItems,MediaItemArray=ultraschall.GetAllMediaItems() -- get all MediaItems in the current project as MediaItemArray

function main()
  -- Let's cycle the colors
  counter=counter-1 
  CycledColorTable=ultraschall.CycleTable(ColorTable,math.floor(counter))  -- cycle the colors in the ColorTable
  retval = ultraschall.ApplyColorTableToTrackColors(CycledColorTable, 1) -- apply the cycled ColorTable to MediaTrack-colors
  ultraschall.ApplyColorTableToItemColors(CycledColorTable, 1, MediaItemArray) -- apply the cycled ColorTable to MediaItem-colors
  reaper.defer(main)
end

counter=0 -- a simple counter for the offset of the cycling
main() -- Let's start to boogie


or even influence brightness, contrast and saturation:

Code:
-- Ultraschall-API demoscript by Meo Mespotine 29.10.2018
-- 
-- change brightness, contrast and saturation of the trackcolors of all tracks.
-- will apply, by default, the Ultraschall-colorscheme "Sonic Rainboom"

dofile(reaper.GetResourcePath().."/UserPlugins/ultraschall_api.lua")

-- Colorize Tracks
ColorTable = ultraschall.CreateSonicRainboomColorTable()
ultraschall.ApplyColorTableToTrackColors(ColorTable, 2)

gfx.init("Change Track-Color's Brightness, Contrast and Saturation",300,200,0,500,400)
gfx.setfont(1,"times",16)

brightness=0
contrast=0
saturation=0

function changecolor(value, changetype)
  -- change the color, according to selected type
  for i=1, reaper.CountTracks(0) do 
    R,G,B=ultraschall.ConvertColorReverse(reaper.GetTrackColor(reaper.GetTrack(0,i-1)))
    if changetype==1 then red, green, blue = ultraschall.ChangeColorBrightness(R,G,B, value) end -- brightness
    if changetype==2 then red, green, blue = ultraschall.ChangeColorContrast(R,G,B, value, 255+value) end -- contrast
    if changetype==3 then red, green, blue = ultraschall.ChangeColorSaturation(R,G,B, value) end -- saturation
    newcol=ultraschall.ConvertColor(red,green,blue)
    reaper.SetTrackColor(reaper.GetTrack(0,i-1), newcol)
  end
end

function main()
  -- get pressed key  
  A=gfx.getchar()  
  
  -- brightness
  if A==49 then changecolor(-3, 1) brightness=brightness-3 end 
  if A==50 then changecolor(3, 1) brightness=brightness+3 end 
  -- contrast
  if A==51 then changecolor(-3, 2) contrast=contrast-3 end 
  if A==52 then changecolor(3, 2) contrast=contrast+3 end 
  -- saturation
  if A==53 then changecolor(-3, 3) saturation=saturation-3 end 
  if A==54 then changecolor(3, 3) saturation=saturation+3 end
  
  if A~=-1 then 
    gfx.x=0 gfx.y=0
    gfx.drawstr("Change\n Brightness(keys 1 and 2): "..brightness.."\n Contrast(keys 3 and 4)  : "..contrast.."\n Saturation(keys 5 and 6): "..saturation)
    gfx.update()
    reaper.defer(main) 
  end
end

A=1
main()
__________________
Use you/she/her.Ultraschall-Api Lua Api4Reaper - Donate, if you wish

On vacation for the time being...

Last edited by Meo-Ada Mespotine; 12-09-2018 at 02:45 PM.
Meo-Ada Mespotine is offline   Reply With Quote
Old 12-09-2018, 02:11 PM   #14
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 6,612
Default

Quote:
Originally Posted by mschnell View Post
Are we going to see 700 "placeholder" messages ?

.. and it's still 16 days until Christmas

-Michael
Placeholder-posts are only a future workaround for the 10k-textlimit of posts.
And yes, I'll use them all over time

Quote:
Originally Posted by Coachz View Post
Delete this as spam mods
As I'm vegetarian, you can be pretty sure, it's not spam
__________________
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 12-09-2018, 03:51 PM   #15
Eliseat
Human being with feelings
 
Eliseat's Avatar
 
Join Date: Mar 2018
Location: Cologne
Posts: 1,362
Default

And I thought you gathered 700 people from Leipzig to join the Reaper community at once.

So after seeing the first conclusion I'm even more excited about what will follow.

Many thanks
Eliseat is offline   Reply With Quote
Old 12-10-2018, 12:01 AM   #16
LowlyOP
Human being with feelings
 
LowlyOP's Avatar
 
Join Date: Feb 2018
Posts: 121
Default

#slowleaks are totally in style lately

you have my attention. just don't redact 95% of it please.
LowlyOP is offline   Reply With Quote
Old 12-10-2018, 12:21 AM   #17
dsyrock
Human being with feelings
 
dsyrock's Avatar
 
Join Date: Sep 2018
Location: China
Posts: 564
Default

I'm eager for the "Rendering with reascript" thing, haha
dsyrock is offline   Reply With Quote
Old 12-10-2018, 02:15 AM   #18
Ivannn Bennnettt
Human being with feelings
 
Join Date: Feb 2017
Posts: 305
Default

I'm intrigued
Ivannn Bennnettt is offline   Reply With Quote
Old 12-10-2018, 06:52 AM   #19
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 6,612
Default

5 days, until you can finally

get all MediaItems by time and tracks, using GetAllMediaItemsBetween:
Code:
integer count, array MediaItemArray, array MediaItemStateChunkArray = ultraschall.GetAllMediaItemsBetween(number startposition, number endposition, string trackstring, boolean inside)
, the way you are used from doing in the arrange-view:

Code:
-- Ultraschall-API demoscript by Meo Mespotine 30.11.2018
-- 
-- shows the MediaItems within time-selection and within selected tracks
-- also shows the number of found items
-- if no time-selection exists, it will display the found items at editcursorposition in selected tracks


dofile(reaper.GetResourcePath().."/UserPlugins/ultraschall_api.lua")

function main()
  -- get selected tracks and time-selection(loop)
  selected_trackstring = ultraschall.CreateTrackString_SelectedTracks()
  loopstart, loopend = reaper.GetSet_LoopTimeRange(false, false, 0, 0, false)
  if loopstart==0 and loopend==0 then loopstart=reaper.GetCursorPosition() loopend=reaper.GetCursorPosition() end
  
  -- get the MediaItems within selected tracks and time-selection
  count, MediaItemArray, MediaItemStateChunkArray = ultraschall.GetAllMediaItemsBetween(loopstart, loopend, selected_trackstring, false)
  
  -- if the selection has changed, show the currently found items in the ReaConsole-window
  if oldcount~=count or oldloopstart~=loopstart or oldloopend~=loopend or oldselected_trackstring~=selected_trackstring then
    reaper.ClearConsole()
    reaper.ShowConsoleMsg("Found Items: "..count.."\n\nList of Items:\n")
    for i=1, count do
      reaper.ShowConsoleMsg(tostring(MediaItemArray[i]).."\n")
    end
  end
  
  -- keep the old values to check next defer-cycle, whether anything has changed
  oldcount=count
  oldloopstart=loopstart
  oldloopend=loopend
  oldselected_trackstring=selected_trackstring
  
  -- start the next defer-cycle
  reaper.defer(main)
end

main()



or do ripple-cut the way you want:

Code:
-- Ultraschall-API demoscript by Meo Mespotine 30.11.2018
-- 
-- Apply Ripple-Cut of MediaItems only on selected tracks and time-selection

dofile(reaper.GetResourcePath().."/UserPlugins/ultraschall_api.lua")

selection_start, selection_end = reaper.GetSet_LoopTimeRange(false, false, 0, 0, 0)
trackstring = ultraschall.CreateTrackString_SelectedTracks()
number_items, MediaItemArray_StateChunk = ultraschall.RippleCut(selection_start, selection_end, trackstring, true, false)
selection_start, selection_end = reaper.GetSet_LoopTimeRange(true, false, reaper.GetCursorPosition(), reaper.GetCursorPosition(), 0)


or manipulate multiple MediaItems at the same time(like length in this example)

Code:
-- Ultraschall-API demoscript by Meo Mespotine 29.10.2018
-- 
-- Change length of MediaItems by a value, in selected Tracks and Time-Selection
-- MediaItems must be fully within the time-selection, at least in this demo, though you
-- can choose to use MediaItems only partially within time-selection as well
-- see functions-reference-docs for more details on GetAllMediaItemsBetween()

dofile(reaper.GetResourcePath().."/UserPlugins/ultraschall_api.lua")

selection_start, selection_end = reaper.GetSet_LoopTimeRange(false, false, 0, 0, 0)
trackstring = ultraschall.CreateTrackString_SelectedTracks()
count, MediaItemArray = ultraschall.GetAllMediaItemsBetween(selection_start, selection_end, trackstring, true)

if count>0 then
  retval, deltalength = reaper.GetUserInputs("Alter by length(in seconds):", 1, "", "")
  if type(tonumber(deltalength))=="number" then
    retval = ultraschall.ChangeDeltaLengthOfMediaItems_FromArray(MediaItemArray, tonumber(deltalength))
  else
    reaper.MB("Must be a number", "Number needed", 0)
  end
end
__________________
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 12-10-2018, 09:22 AM   #20
Eliseat
Human being with feelings
 
Eliseat's Avatar
 
Join Date: Mar 2018
Location: Cologne
Posts: 1,362
Default

Seems like you want to increase the tension. This turns out more and more to be a thriller. Did you collect all those action gems over years to create this count down before Christmas?

Anyway. This is a nice Adventskalender which offers a new surprise for every new day. And I really like surprises.

Many thanks
Eliseat is offline   Reply With Quote
Old 12-11-2018, 03:28 AM   #21
Moy
Human being with feelings
 
Moy's Avatar
 
Join Date: Oct 2017
Location: China
Posts: 60
Default

Oh.. Seems there are BIG news.
I'm getting excited.

( Besides, I'm looking forward for [Reascript Render] feature to be shown)
__________________
Nice to meet REAPER.
My Chinese tutorials of RAEPER: https://zhuanlan.zhihu.com/reaper
Moy is offline   Reply With Quote
Old 12-11-2018, 03:31 AM   #22
reapero
Human being with feelings
 
Join Date: Aug 2011
Posts: 508
Default

checking daily..where are you today mespotine?

anxious for the render stuff as well..
reapero is offline   Reply With Quote
Old 12-11-2018, 05:22 AM   #23
amagalma
Human being with feelings
 
amagalma's Avatar
 
Join Date: Apr 2011
Posts: 3,450
Default

Looking forward to it!
__________________
Most of my scripts can be found in ReaPack.
If you find them useful, a donation would be greatly appreciated! Thank you! :)
amagalma is offline   Reply With Quote
Old 12-11-2018, 07:04 AM   #24
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 6,612
Default

4 more days, until you can finally:

RENDER YOUR PROJECTS:

Code:
-- Ultraschall-API demoscript by Meo Mespotine 29.10.2018
-- 
-- render a project to numerous audio-file-formats(in this example: flac, opus, mp3, wav)
-- see Functions-Reference for more details on the parameter-settings, given to the functions,
-- as well as other formats
--
-- opens file-dialog to select project-file. after selection, it will show an input-box, where you enter
-- the render-filename with path. file-extensions will be given by Reaper's rendering-process automatically

dofile(reaper.GetResourcePath().."/UserPlugins/ultraschall_api.lua")

-- Select Input and Output-files
retval, projectfilename_with_path=reaper.GetUserFileNameForRead("", "Select Project-File", "*.rpp")
if retval==true then
  retval2, renderfilename_with_path=reaper.GetUserInputs("Please give filename+path of the target-render-file.", 1, "", "")
  else
  reaper.MB("No projectfile selected. Quitting now.", "No projectfile Selected", 0)
  return
end

if retval2==true then
  -- Create Renderstrings first, for Flac, Opus, MP3(Maxquality) and Wav
  render_cfg_string_Flac = ultraschall.CreateRenderCFG_FLAC(0, 5)
  render_cfg_string_Opus = ultraschall.CreateRenderCFG_Opus2(2, 128, 10, false, false)
  render_cfg_string_MP3_maxquality = ultraschall.CreateRenderCFG_MP3MaxQuality()
  render_cfg_string_Wav = ultraschall.CreateRenderCFG_WAV(1, 0, 0, 0, false)
  
  -- Render the files. Will automatically increment filenames(if already existing) and close the rendering-window after render.
  retval, renderfilecount, MediaItemStateChunkArray, Filearray = ultraschall.RenderProject_RenderCFG(projectfilename_with_path, renderfilename_with_path, -2, -2, false, true, true, render_cfg_string_Flac)
  renderfile1=Filearray[1]
  retval, renderfilecount, MediaItemStateChunkArray, Filearray = ultraschall.RenderProject_RenderCFG(projectfilename_with_path, renderfilename_with_path, -2, -2, false, true, true, render_cfg_string_Opus)
  renderfile2=Filearray[1]
  retval, renderfilecount, MediaItemStateChunkArray, Filearray = ultraschall.RenderProject_RenderCFG(projectfilename_with_path, renderfilename_with_path, -2, -2, false, true, true, render_cfg_string_MP3_maxquality)
  renderfile3=Filearray[1]
  retval, renderfilecount, MediaItemStateChunkArray, Filearray = ultraschall.RenderProject_RenderCFG(projectfilename_with_path, renderfilename_with_path, -2, -2, false, true, true, render_cfg_string_Wav)
  renderfile4=Filearray[1]
  
  -- show the filenames of the rendered files
  reaper.MB("The rendered files are:\n\n1: "..renderfile1.."\n2: "..renderfile2.."\n3: "..renderfile3.."\n4: "..renderfile4, "Rendered Files",0) 
else
  reaper.MB("No outputfile Chosen. Quitting now.", "No outputfile Selected", 0)
end

--ultraschall.ShowLastErrorMessage()


even the current active project(needs to be saved first):

Code:
-- Ultraschall-API demoscript by Meo Mespotine 30.11.2018
-- 
-- render the current project either from time-selection or as a whole to numerous audio-file-formats(in this example: flac, opus, mp3, wav)
-- see Functions-Reference for more details on the parameter-settings, given to the functions,
-- as well as other formats
--
-- checks, if the project needs to be saved first(as an unsaved project can't be rendered using my approach due API-limitations). 
-- After that, it will show an input-box, where you enter the render-filename with path. file-extensions will be given by Reaper's rendering-process automatically

dofile(reaper.GetResourcePath().."/UserPlugins/ultraschall_api.lua")

-- Check if file needs to be saved, otherwise give script Output-filename with path
if reaper.IsProjectDirty(0)==0 then
  retval2, renderfilename_with_path=reaper.GetUserInputs("Please give filename+path of the target-render-file.", 1, ",extrawidth=200","")
  else
  reaper.MB("Project must be save first. Quitting now.", "Project not saved", 0)
  return
end

if retval2==true then
  -- Create Renderstrings first, for Flac, Opus, MP3(Maxquality) and Wav
  render_cfg_string_Flac = ultraschall.CreateRenderCFG_FLAC(0, 5)
  render_cfg_string_Opus = ultraschall.CreateRenderCFG_Opus2(2, 128, 10, false, false)
  render_cfg_string_MP3_maxquality = ultraschall.CreateRenderCFG_MP3MaxQuality()
  render_cfg_string_Wav = ultraschall.CreateRenderCFG_WAV(1, 0, 0, 0, false)
  
  loopstart, loopend = reaper.GetSet_LoopTimeRange(false, false, 0, 0, false)
  if loopend==0 then loopend=reaper.GetProjectLength() end
  
  -- Render the files. Will automatically increment filenames(if already existing) and close the rendering-window after render.
  retval, renderfilecount, MediaItemStateChunkArray, Filearray = ultraschall.RenderProject_RenderCFG(projectfilename_with_path, renderfilename_with_path, loopstart, loopend, false, true, true, render_cfg_string_Flac)
  renderfile1=Filearray[1]
  retval, renderfilecount, MediaItemStateChunkArray, Filearray = ultraschall.RenderProject_RenderCFG(projectfilename_with_path, renderfilename_with_path, loopstart, loopend, false, true, true, render_cfg_string_Opus)
  renderfile2=Filearray[1]
  retval, renderfilecount, MediaItemStateChunkArray, Filearray = ultraschall.RenderProject_RenderCFG(projectfilename_with_path, renderfilename_with_path, loopstart, loopend, false, true, true, render_cfg_string_MP3_maxquality)
  renderfile3=Filearray[1]
  retval, renderfilecount, MediaItemStateChunkArray, Filearray = ultraschall.RenderProject_RenderCFG(projectfilename_with_path, renderfilename_with_path, loopstart, loopend, false, true, true, render_cfg_string_Wav)
  renderfile4=Filearray[1]
  
  -- show the filenames of the rendered files
  reaper.MB("The rendered files are:\n\n1: "..renderfile1.."\n2: "..renderfile2.."\n3: "..renderfile3.."\n4: "..renderfile4, "Rendered Files",0)
else
  reaper.MB("No outputfile Chosen. Quitting now.", "No outputfile Selected", 0)
end

ultraschall.ShowLastErrorMessage()



and yes, you saw right: the render-functions return the filenames of the rendered files!
__________________
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 12-11-2018, 01:39 PM   #25
Arthur McArthur
Human being with feelings
 
Arthur McArthur's Avatar
 
Join Date: Sep 2016
Location: Toronto
Posts: 744
Default

This looks amazing!!!
Arthur McArthur is offline   Reply With Quote
Old 12-11-2018, 04:39 PM   #26
tXShooter
Human being with feelings
 
tXShooter's Avatar
 
Join Date: Aug 2017
Posts: 336
Default



Oooooooooooohhhhh
__________________
"But be ye doers of the word, and not hearers only, deceiving your own selves."
tXShooter is offline   Reply With Quote
Old 12-11-2018, 06:35 PM   #27
Coachz
Human being with feelings
 
Coachz's Avatar
 
Join Date: Oct 2010
Location: Charleston, SC
Posts: 12,762
Default

Does this cost money and what does it do or does it do multiple things?
Coachz is offline   Reply With Quote
Old 12-12-2018, 09:12 AM   #28
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 6,612
Default

Quote:
Originally Posted by Coachz View Post
Does this cost money and what does it do or does it do multiple things?
It will be for free, though donations are very welcome.
__________________
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 12-12-2018, 09:13 AM   #29
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 6,612
Default

3 days, until you can finally

save and retrieve ArrangeViewSnapShots to easily navigate through your project:

Code:
-- Ultraschall-API demoscript by Meo Mespotine 30.11.2018
-- 
-- store and retrieve arrangeview-snapshots, who contain the zoom as well as the position of the arrangeview
-- vertical scrolling not(yet) supported

dofile(reaper.GetResourcePath().."/UserPlugins/ultraschall_api.lua")

-- Initialize window, font and variables
gfx.init("Arrangeview-Snapshots - Demoscript", 500, 300, 0, 400, 300)
gfx.setfont(1,"Times",16)

retval, description, startposition, endposition, vzoomfactor, hzoomfactor="none", "none", "-", "-", "-", "-"

function main()
  -- Get currently typed character and check for F1 to F4 keys (with or without Cmd/Ctrl-key pressed)
  Key=gfx.getchar()
  if gfx.mouse_cap&4==0 and Key==26161.0 then retval, description, startposition, endposition, vzoomfactor, hzoomfactor = ultraschall.RestoreArrangeviewSnapshot(1, true, true) end --F1
  if gfx.mouse_cap&4==0 and Key==26162.0 then retval, description, startposition, endposition, vzoomfactor, hzoomfactor = ultraschall.RestoreArrangeviewSnapshot(2, true, true) end --F2
  if gfx.mouse_cap&4==0 and Key==26163.0 then retval, description, startposition, endposition, vzoomfactor, hzoomfactor = ultraschall.RestoreArrangeviewSnapshot(3, true, true) end --F3
  if gfx.mouse_cap&4==0 and Key==26164.0 then retval, description, startposition, endposition, vzoomfactor, hzoomfactor = ultraschall.RestoreArrangeviewSnapshot(4, true, true) end --F4
  if description==nil then description="" end
  if startposition==nil then startposition="" end
  if endposition==nil then endposition="" end
  if hzoomfactor==nil then hzoomfactor="" end

  -- when using Cmd/Ctrl+F1 to F4, store the accompanying arrangeview-snapshot
  -- let the user decide first, how to name the arrange-view-snapshot
  if gfx.mouse_cap&4==4 and Key>=26161 and Key<=26164 then
    retval, snapshotname=reaper.GetUserInputs("Give the slot a name", 1, "", "")
  end
  if gfx.mouse_cap&4==4 and Key==26161.0 then ultraschall.StoreArrangeviewSnapshot(1, snapshotname, true, true) end --F1
  if gfx.mouse_cap&4==4 and Key==26162.0 then ultraschall.StoreArrangeviewSnapshot(2, snapshotname, true, true) end --F2
  if gfx.mouse_cap&4==4 and Key==26163.0 then ultraschall.StoreArrangeviewSnapshot(3, snapshotname, true, true) end --F3
  if gfx.mouse_cap&4==4 and Key==26164.0 then ultraschall.StoreArrangeviewSnapshot(4, snapshotname, true, true) end --F4
  
  -- Display text and current arrange-view-variables
  gfx.x=0
  gfx.y=0
  gfx.drawstr("Store Arrangeview-Snapshots.\n\nuse Cmd/Ctrl+F1 to F4 to store one arrangeview-snapshot\n\nuse F1 to F4 to retrieve one\n\nIn this demo, the focus must be on this gfx-window to\nset/retrieve Arrangeview-Snapshots.\n\nThe snapshots will be stored in the project itself.")
  gfx.x=0
  gfx.drawstr("\n\nCurrently used slot: "..description.." \n\t          start: "..startposition.." \n           end: "..endposition.." \n       hzoom: "..tostring(hzoomfactor))
  
  gfx.update()
  if Key~=-1 then reaper.defer(main) end
end

main()
__________________
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 12-12-2018, 09:19 AM   #30
reapero
Human being with feelings
 
Join Date: Aug 2011
Posts: 508
Default

Great stuff!!

For rendering the current project based on time selection, would it be possible to have the project´s path added in the dialog box by default?
reapero is offline   Reply With Quote
Old 12-12-2018, 09:38 AM   #31
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 6,612
Default

Quote:
Originally Posted by reapero View Post
Great stuff!!

For rendering the current project based on time selection, would it be possible to have the project´s path added in the dialog box by default?
Yes, because you will be able to code that yourself. These scripts in here are just for demonstration of the stuff in general.

@all
If you think, I just release a bunch of scripts that'll do all this stuff...then you have no idea what is in store for all of you ^^
__________________
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 12-12-2018, 01:24 PM   #32
Eliseat
Human being with feelings
 
Eliseat's Avatar
 
Join Date: Mar 2018
Location: Cologne
Posts: 1,362
Default

At least you don't avoid a good show with countdown and mystery.

It still looks promising.
Eliseat is offline   Reply With Quote
Old 12-12-2018, 02:43 PM   #33
Fabian
Human being with feelings
 
Fabian's Avatar
 
Join Date: Sep 2008
Location: Sweden
Posts: 7,407
Default

Quote:
Originally Posted by mespotine View Post
Yes, because you will be able to code that yourself. These scripts in here are just for demonstration of the stuff in general.

@all
If you think, I just release a bunch of scripts that'll do all this stuff...then you have no idea what is in store for all of you ^^
We are waiting... eagerly.
__________________
// MVHMF
I never always did the right thing, but all I did wasn't wrong...
Fabian is offline   Reply With Quote
Old 12-12-2018, 09:58 PM   #34
Ivannn Bennnettt
Human being with feelings
 
Join Date: Feb 2017
Posts: 305
Default

Ivannn Bennnettt is offline   Reply With Quote
Old 12-13-2018, 02:35 AM   #35
Breeder
Human being with feelings
 
Breeder's Avatar
 
Join Date: Nov 2010
Posts: 2,436
Default

So you're releasing a framework! That's f**king awesome! Does it include MIDI stuff as well?
Breeder is offline   Reply With Quote
Old 12-13-2018, 03:38 AM   #36
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 9,866
Default

Quote:
Originally Posted by Eliseat
And I thought you gathered 700 people from Leipzig to join the Reaper community at once.
That's why I thought as well :P I thought he was became some kind of teacher in a school or something with 700 students.


Seems it is more a Lua library (ultraschall_api.lua) with a lot of common usage functions (though, some of them were already implement in various script, like select items within a certain time range etc, but seems there will be more ground breaking stuff like the render stuff)


@mespotine
I hope you are using a system like LuaDoc or something to generate your documentation :P
X-Raym is offline   Reply With Quote
Old 12-13-2018, 04:47 AM   #37
reapero
Human being with feelings
 
Join Date: Aug 2011
Posts: 508
Default

Has this been developed using js_Reascipt API extension or it just has nothing to see with it?
reapero is offline   Reply With Quote
Old 12-13-2018, 06:36 AM   #38
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 6,612
Default

@Breeder
No, no MIDI-stuff yet. Hadn't time to work into MIDI at all right now. Especially the MIDI-note-management in Reaper is very difficult IMHO. Still working on some ideas regarding that.
Though some stuff regarding the MIDI-Editor will come.

@X-Raym
I'm using my own docs-system. All I found in the net, when looking for a docs-system, was too limited, so I made a new one.

@reapero
No, it is independent from Julian's Plugin, but it will require it installed for some stuff. As well as SWS 2.9.7 and the most recent Reaper-version.
__________________
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 12-13-2018, 06:37 AM   #39
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 6,612
Default

2 days, until you can finally

find out easily, which projecttabs have beend changed, added, deleted:

Code:
-- Ultraschall-API demoscript by Meo Mespotine 29.10.2018
-- 
-- shows the number of projecttabs, that have been reordered, newly created or closed since last change
-- will display it in the Reaper-Console

dofile(reaper.GetResourcePath().."/UserPlugins/ultraschall_api.lua")

function main()
  retval, countReorderedProj, reorderedProj, countNewProj, newProj, countClosedProj, closedProj = ultraschall.CheckForChangedProjectTabs(true)
  if retval==true then reaper.ClearConsole() reaper.ShowConsoleMsg("Since "..os.date()..", there have been: \n\n"..countReorderedProj.." project-tab(s) reordered\n"..countNewProj.." project-tab(s) newly created and\n"..countClosedProj.." project-tab(s) been closed") end  

  reaper.defer(main)
end

retval=true
main()


This was a FR from someone, but I forgot from who...
__________________
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 12-14-2018, 02:11 AM   #40
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 6,612
Default

1 day, until you can finally:

Get the current Marker/Region at mouse-position, the graphical-size they are drawn as into the arrangeview:

Code:
-- Ultraschall-API demoscript by Meo Mespotine 30.11.2018
-- 
-- shows, which markers/regions are underneath the mouse-cursor


dofile(reaper.GetResourcePath().."/UserPlugins/ultraschall_api.lua")

function main()
  -- get mouseposition, markers and regions as well as the mouse-context
  x,y=reaper.GetMousePosition()  
  marker=ultraschall.GetMarkerByScreenCoordinates(x, false)
  region=ultraschall.GetRegionByScreenCoordinates(x, false)
  window = reaper.BR_GetMouseCursorContext()
  
  -- if the markers/regions underneath the mouse have changed and if mouse is in ruler, 
  -- show the currently found markers and regions in the ReaConsole-window
  if (marker~=oldmarker or region~=oldregion) and window=="ruler" then
    if marker=="" then marker="\n\n\n" end -- small hack to avoid the output being 
                                           -- too jumpy when no marker is found
    reaper.ClearConsole()
    reaper.ShowConsoleMsg("Found Markers: \n"..marker.."\n\nFoundRegions:\n"..region)
  end
  
  -- keep the old values to check next defer-cycle, whether anything has changed
  oldmarker=marker
  oldregion=region
  
  -- start the next defer-cycle
  reaper.defer(main)
end

main()


and to show something else as well:

...you can store extstates for MediaTracks

Code:
-- Ultraschall-API demoscript by Meo Mespotine 11.12.2018
-- 
-- store new ExtStates for the first selected MediaTrack

dofile(reaper.GetResourcePath().."/UserPlugins/ultraschall_api.lua")

-- get the first selected MediaTrack and it's name
track=reaper.GetSelectedTrack(0,0)
if track==nil then return end
retval, name = reaper.GetTrackName(track,"")
if name==nil then name="" end

-- get the extstates stored with this MediaTrack
storedextstates=""
for i=1, 5 do
  temp, temp2 = ultraschall.GetTrackExtState(track, tostring(i))
  if temp2==nil then temp2="" end
  storedextstates=storedextstates..tostring(temp2)..","
end

-- show the inputdialog, with the already stored extstates as default
retval, retvals_csv = reaper.GetUserInputs("Set TrackExtStates "..name, 5, "01,02,03,04,05,extrawidth=300", tostring(storedextstates))
if retval==false then return end

-- separate the returned inputfields into an array
count, vals = ultraschall.CSV2IndividualLinesAsArray(retvals_csv, ",")

-- set the new ExtStates to the MediaTrack
for i=1, 5 do
  retval = ultraschall.SetTrackExtState(track, tostring(i), vals[i],true)
end
Code:
-- Ultraschall-API demoscript by Meo Mespotine 11.12.2018
-- 
-- retrieve and display ExtStates for the first selected MediaTrack
-- will be displayed in the ReaScript-Console

dofile(reaper.GetResourcePath().."/UserPlugins/ultraschall_api.lua")
-- prepare some variables
oldoutput=""
oldtrack=""

function main()
  -- get the first selected MediaTrack and it's name
  track=reaper.GetSelectedTrack(0,0)  
  if track~=nil then
    retval, name = reaper.GetTrackName(track, "")
  
    -- Get the ExtStates store with the first selected MediaTrack
    output=""  
    for i=1, 5 do
      temp, temp2 = ultraschall.GetTrackExtState(track, tostring(i))
      if temp2==nil then temp2="" end
      output=output.."    "..i..": "..temp2.."\n"
    end
    -- if extstates have been changed or the selected MediaTrack has changed, display the
    -- extstates into the ReaConsole-window
    if oldoutput~=output or oldtrack~=track then reaper.ClearConsole() reaper.ShowConsoleMsg("Showing ExtState for track: "..name.."\n\n"..output) end
    oldoutput=output
    oldtrack=track
  end
  -- repeat the whole thing
  reaper.defer(main)
end

-- let's boogie
main()
as well as for MediaItems. When ItemNotes are not enough:



Code:
-- Ultraschall-API demoscript by Meo Mespotine 11.12.2018
-- 
-- store new ExtStates for the first selected MediaItem

dofile(reaper.GetResourcePath().."/UserPlugins/ultraschall_api.lua")

-- get the first selected MediaItem and it's name
item=reaper.GetSelectedMediaItem(0,0)
if item==nil then return end
name = ultraschall.GetItemName(item)
if name==nil then name="" end

-- get the extstates stored with this MediaItem
storedextstates=""
for i=1, 5 do
  temp, temp2 = ultraschall.GetItemExtState(item, tostring(i))
  if temp2==nil then temp2="" end
  storedextstates=storedextstates..tostring(temp2)..","
end

-- show the inputdialog, with the already stored extstates as default
retval, retvals_csv = reaper.GetUserInputs("Set ItemExtStates "..name, 5, "01,02,03,04,05,extrawidth=300", tostring(storedextstates))
if retval==false then return end

-- separate the returned inputfields into an array
count, vals = ultraschall.CSV2IndividualLinesAsArray(retvals_csv, ",")

-- set the new ExtStates to the MediaItem
for i=1, 5 do
  retval = ultraschall.SetItemExtState(item, tostring(i), vals[i],true)
end
Code:
-- Ultraschall-API demoscript by Meo Mespotine 11.12.2018
-- 
-- retrieve and display ExtStates for the first selected MediaItem
-- will be displayed in the ReaScript-Console

dofile(reaper.GetResourcePath().."/UserPlugins/ultraschall_api.lua")
-- prepare some variables
oldoutput=""
olditem=""

function main()
  -- get the first selected MediaItem and it's name
  item=reaper.GetSelectedMediaItem(0,0)  
  if item~=nil then
    name = ultraschall.GetItemName(item)
    if name==nil then name="" end
  
    -- Get the ExtStates store with the selected MediaItem
    output=""  
    for i=1, 5 do
      temp, temp2 = ultraschall.GetItemExtState(item, tostring(i))
      if temp2==nil then temp2="" end
      output=output.."    "..i..": "..temp2.."\n"
    end
    -- if extstates have been changed or the selected MediaItem has changed, display the
    -- extstates into the ReaConsole-window
    if oldoutput~=output or olditem~=item then reaper.ClearConsole() reaper.ShowConsoleMsg("Showing ExtState for Item: "..name.."\n\n"..output) end
    oldoutput=output
    olditem=item
  end
  -- repeat the whole thing
  reaper.defer(main)
end

-- let's boogie
main()
__________________
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 12:39 AM.


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