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
mespotine
Human being with feelings
 
mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig, Germany
Posts: 1,558
Default Ultraschall-API - 1029 Functions for Lua(beta 2.77 - 1Oct2019) - "EventManager!"

After over 1 and a half years of coding, I'm proud to announce the public-beta-release of the

Ultraschall-API 4.00 beta 2.77 - a 1029 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
  • 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.
  • tons of other helper-functions
  • my Reaper-Internals Documentation AND
it's fully documented.
__________________
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; 10-01-2019 at 09:27 AM. Reason: Release
mespotine is offline   Reply With Quote
Old 12-08-2018, 04:29 AM   #2
mespotine
Human being with feelings
 
mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig, Germany
Posts: 1,558
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.
__________________
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; 02-27-2019 at 10:03 AM.
mespotine is offline   Reply With Quote
Old 12-08-2018, 04:30 AM   #3
mespotine
Human being with feelings
 
mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig, Germany
Posts: 1,558
Default

Placeholder 2
__________________
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-08-2018, 04:30 AM   #4
mespotine
Human being with feelings
 
mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig, Germany
Posts: 1,558
Default

Placeholder 3
__________________
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-08-2018, 04:31 AM   #5
mespotine
Human being with feelings
 
mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig, Germany
Posts: 1,558
Default

Placeholder 4
__________________
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-08-2018, 04:32 AM   #6
mespotine
Human being with feelings
 
mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig, Germany
Posts: 1,558
Default

Placeholder 5 for something big to come...
__________________
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-08-2018, 04:36 PM   #7
LowlyOP
Human being with feelings
 
LowlyOP's Avatar
 
Join Date: Feb 2018
Posts: 119
Default

i'm scared.
LowlyOP is offline   Reply With Quote
Old 12-09-2018, 02:02 PM   #8
mespotine
Human being with feelings
 
mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig, Germany
Posts: 1,558
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()
__________________
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-09-2018 at 02:45 PM.
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 09:18 AM.


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