|
|
|
09-13-2019, 01:55 AM
|
#281
|
Human being with feelings
Join Date: Apr 2013
Location: France
Posts: 9,875
|
There is an error in spectrogram API;
ultraschall.AddItemSpectralEdit
end_pos is actually length.
This works:
Code:
local retval, statechunk = ultraschall.AddItemSpectralEdit(
-1, -- integer itemidx
take_offset + item_len/4, -- number start_pos
item_len/2, -- number end_pos
1, -- number gain
0, -- number fade
0, -- number freq_fade
2000, -- number freq_range_bottom
5000, -- number freq_range_top
-1, -- integer h
0, -- integer byp_solo
0, -- number gate_thres
0, -- number gate_floor
1, -- number comp_thresh
1, -- number comp_exp_ratio
0, -- number n
0, -- number o
0, -- number fade 2
0, -- number freq_fade2 2
statechunk -- optional string MediaItemStateChunk
)
Also, it worth specifying that start_pos is relative to take start offset.
Last edited by X-Raym; 09-13-2019 at 02:01 AM.
|
|
|
09-13-2019, 05:45 AM
|
#282
|
Human being with feelings
Join Date: Oct 2007
Location: home is where the heart is
Posts: 12,096
|
Quote:
Originally Posted by X-Raym
string MediaItemStateChunk = ultraschall.SetItemSpectralEdit(integer itemidx, integer spectralidx, number start_pos, number end_pos, number gain, number fade, number freq_fade, number freq_range_bottom, number freq_range_top, integer h, integer byp_solo, number gate_thres, number gate_floor, number comp_thresh, number comp_exp_ratio, number n, number o, number fade2, number freq_fade2, optional string MediaItemStateChunk)
|
I think this gets reward for API function taking most arguments ever! (just kidding )
|
|
|
09-13-2019, 07:26 AM
|
#283
|
Human being with feelings
Join Date: Apr 2013
Location: France
Posts: 9,875
|
@nofish
And none of them are optional :P
ultrashall API has already the award of the API with most functions.
|
|
|
09-15-2019, 02:59 PM
|
#284
|
Human being with feelings
Join Date: May 2017
Location: Leipzig
Posts: 6,621
|
Ok, some nice(tm) bugs, I need to fix.
Oh well..
Thanks for reporting them.
|
|
|
09-15-2019, 03:04 PM
|
#285
|
Human being with feelings
Join Date: May 2017
Location: Leipzig
Posts: 6,621
|
Quote:
Originally Posted by nofish
I think this gets reward for API function taking most arguments ever! (just kidding )
|
Note to myself: beating this in one of the next updates...
|
|
|
09-15-2019, 03:13 PM
|
#286
|
Human being with feelings
Join Date: Apr 2013
Location: France
Posts: 9,875
|
@mespotine
I think letting length would be nice to not break existing scripts, you just need to update the doc :P
|
|
|
09-16-2019, 09:21 AM
|
#287
|
Human being with feelings
Join Date: May 2017
Location: Leipzig
Posts: 6,621
|
Quote:
Originally Posted by X-Raym
Could we have item pointer to choose item target ?
It seems that it is only spectral edit functions which use this unsual Itemidx method (so I suppose we should use media item state instead ? I dont see any function to get item idx, and it it requires looping in all items, it does sseems that efficient in a loop)
|
No looping through all MediaItems required, if you use this code(will be in the next release of the API as well):
Code:
function ultraschall.GetMediaItemNumber(MediaItem)
--[[
<US_DocBloc version="1.0" spok_lang="en" prog_lang="*">
<slug>GetMediaItemNumber</slug>
<requires>
Ultraschall=4.00
Reaper=5.965
Lua=5.3
</requires>
<functioncall>integer itemidx = ultraschall.GetMediaItemNumber(MediaItem MediaItem)</functioncall>
<description>
returns the indexnumber of a MediaItem-object
Can be helpful with Reaper's own API-functions, like reaper.GetMediaItem(ReaProject proj, integer itemidx)
returns -1 in case of an error
</description>
<parameters>
MediaItem MediaItem - the MediaItem, whose itemidx you want to have
</parameters>
<retvals>
integer itemidx - the indexnumber of the MediaItem, zero based.
</retvals>
<chapter_context>
MediaItem Management
Assistance functions
</chapter_context>
<target_document>US_Api_Documentation</target_document>
<source_document>ultraschall_functions_engine.lua</source_document>
<tags>mediaitem management, get, itemindex, itemidx</tags>
</US_DocBloc>
--]]
if ultraschall.type(MediaItem)~="MediaItem" then ultraschall.AddErrorMessage("GetMediaItemNumber", "MediaItem", "must be a valid MediaItem-object", -1) return -1 end
local MediaTrack = reaper.GetMediaItem_Track(MediaItem)
local ItemNr = reaper.GetMediaItemInfo_Value(MediaItem, "IP_ITEMNUMBER")
local TrackNumber=reaper.GetMediaTrackInfo_Value(MediaTrack, "IP_TRACKNUMBER")
local Count=0
for i=1, TrackNumber-1 do
Count=Count+reaper.GetTrackNumMediaItems(reaper.GetTrack(0,i-1))
end
Count=Count+ItemNr
return math.tointeger(Count)
end
But as all these functions use StateChunks(the only place for spectral-edit-stuff), it is probably recommended to use a MediaItemStateChunk instead, especially if you want to change/alter numerous settings at once.
GetItemStateChunk
Do the changes, by piping the StateChunk through the SpectralEdit-functions
SetItemStateChunk.
|
|
|
09-16-2019, 12:03 PM
|
#288
|
Human being with feelings
Join Date: Apr 2013
Location: France
Posts: 9,875
|
Code:
GetItemStateChunk
Do the changes, by piping the StateChunk through the SpectralEdit-functions
SetItemStateChunk.
Thats' why I end up doing indeed.
Performance is key :P
|
|
|
09-17-2019, 05:01 AM
|
#289
|
Human being with feelings
Join Date: May 2017
Location: Leipzig
Posts: 6,621
|
That's also the best approach, when using my Routing-functions. That way, they are even faster than Reaper's native ones
Maybe that's also the case with SetTrackStates-functions, but I haven't performance-checked that yet.
|
|
|
09-17-2019, 11:02 AM
|
#290
|
Human being with feelings
Join Date: Apr 2013
Location: France
Posts: 9,875
|
What do you use to generate html from your USdoc file ?
I've been experimenting basic styling
But really the HTML has to be cleaned and semantic.
If you can provide me your USdocParser I can take a look. In what format it is ?
A bit early to promise any results though.
At least, even basic styling without the right HTML can still very nice for the eye, as you can see from screenshot
|
|
|
09-17-2019, 12:18 PM
|
#291
|
Human being with feelings
Join Date: May 2017
Location: Leipzig
Posts: 6,621
|
Nice!
I build you a basic parser. In the meantime, you can find the doc-generator scripts in the API, in Scripts/Tools/Docgenerator.
It's not good code, more hack and slay
|
|
|
09-17-2019, 01:06 PM
|
#292
|
Human being with feelings
Join Date: Apr 2013
Location: France
Posts: 9,875
|
Oh ok so you use this big Lua scripts to generate your HTML :P
My own reascript.html parser only is 227 line long only.
Quote:
I build you a basic parser.
|
Don't create another one if you already use this one.
Maybe I'll write m own parser in JavaScript, which has lots of ways to handle XML and HTML and is way much easier to debug than Lua thanks to very rich browser console.
We'll see !
|
|
|
09-18-2019, 07:11 AM
|
#293
|
Human being with feelings
Join Date: May 2017
Location: Leipzig
Posts: 6,621
|
The parser is almost done, as I have added in one of the last few releases the doc-engine, which holds functions who read all USDocML-chunks and many who are able to parse individual stuff out.
Means, I'm building a parser, which gives you a table to work out the doc-generator with.
Just needs some fixes from the next US-API-release and some documentation and you can do, whatever you want with it.
|
|
|
09-19-2019, 04:53 AM
|
#294
|
Human being with feelings
Join Date: Apr 2013
Location: France
Posts: 9,875
|
@mespotine
I think I'll be more flexible with my own solutions,
But your USdocML are not valid XML files, they don't pass validation test, I can't use standard parser without text replace,
for eg, you have <funcitonname> in reaper-apidocs.USDocML with unescaped '<' and itbreaks at every & too. :/
I can take care of that, but I think you have to know :P
Last edited by X-Raym; 09-19-2019 at 05:02 AM.
|
|
|
09-19-2019, 05:28 AM
|
#295
|
Human being with feelings
Join Date: Apr 2013
Location: France
Posts: 9,875
|
Code:
text = text.replace( '<functionname>', 'functionname')
text = text.replace( /&/gm, '&')
text = text.replace( /<br>/gm, '')
text = text.replace( /pamrameters/gm, 'parameters')
text = text.replace( /parmeters/gm, 'parameters')
text = text.replace( /indent="default"/gm, '')
text = text.replace( />>/gm, '>')
text = text.replace( /<=/gm, '<=')
text = text.replace( /< :/gm, '< :')
text = text.replace( /\|</gm, '|<')
text = text.replace( /<0/gm, '<0')
text = text.replace( /<</gm, '<<')
text = text.replace( /=</gm, '=< ')
text = text.replace( / < /gm, ' < ')
text = text.replace( /V, </gm, 'V, < ')
Here are the javascript custom string replacement I had to make to be able to parse your reaper-apidocs.USDocML. Lots of things involves characters not escaped and wrong markup names.
Note: maybe just putting <description> content inside quotes would have be enough for most of the issue. I haven't tested.
Last edited by X-Raym; 09-19-2019 at 05:37 AM.
|
|
|
09-19-2019, 08:26 AM
|
#296
|
Human being with feelings
Join Date: May 2017
Location: Leipzig
Posts: 6,621
|
Can you post me a small example how it would look like? Then I could clean it up.
Edit: oh, I see it seems like I had parameters written wrong within apidocs...
Need to fix that.
Last edited by Meo-Ada Mespotine; 09-19-2019 at 11:05 AM.
|
|
|
09-19-2019, 03:09 PM
|
#297
|
Human being with feelings
Join Date: Apr 2013
Location: France
Posts: 9,875
|
@mespotine
In the end I think the goal will be to let the USdocXML go and just have it all to semantic HTML right away, to not have to manage several format.
USdocXML are not standard, it could have a better stucture hierarchy IMHO (Ill give you more details once I digg this further) :P,
And HTML can be easily parsed AND can be display directly in front end
Is this doc written by hand ?
|
|
|
09-22-2019, 05:53 PM
|
#298
|
Human being with feelings
Join Date: Apr 2013
Location: France
Posts: 9,875
|
Code:
<functioncall prog_lang="lua">integer = reaper.CountSelectedTracks2(ReaProject proj, boolean wantmaster)</functioncall>
Too bad you stripped the native (in generated doc) <i> tags from the code definitions of the functions, it is handy to highlight these in the doc. Can you bring it back somehow ?
It would allows me to not have to write a complex parser for retval values, retval values types, function name, argument values type, argument value and those for the 4 languages :P
EDIT: hmmmm even in ultrashall lua functions source code there isn't the <i> so I guess I'll need to write a custom parser for function def. As it can has variables things, it adds a little bit of difficulty, but I guess it isn't impossible.
Last edited by X-Raym; 09-22-2019 at 06:11 PM.
|
|
|
09-23-2019, 06:51 AM
|
#299
|
Human being with feelings
Join Date: May 2017
Location: Leipzig
Posts: 6,621
|
Ok, I've thought about that for a few days.
The idea behind the USDOcML-file is to have a docfile, that is independent of HTML, so the missing italic-tags are intended like that.
I think, that maybe this can't be made into a correct xml-file by my design.
For instance, you can make descriptions in different markup-languages, like MarkDown, etc, which I'm using heavily in the concepts-docs.
Markdown features things like the > element, which signals indented quotes what I'm using heavily for layout-stuff and I don't think, that > would be accepted by any Markdown-parser.
So I think I should remove the XML-line at the beginning, as this is misleading(I added markdown-support after design of the USDocML-Fileformat, so it's probably an oversight by me.)
So I came up with a different idea, that maybe we just need to make a converter, which converts this USDOcML into a useable XML-file, means: converting all markup-elements into their HTML-conform counterparts, making the structure a valid XML-file, which you can use for further stuff, including adding italic-tags into the functioncall-tags.
I think this would be a better approach than forcing USDOcML somehow into a webuseable format.
Another idea behind that(and why I don't add HTML-style stuff into it): you can use the USDOcML-file as basis for other tools and visualisations as well.
For instance, I'm thinking about making a tool for Reaper, which allows typing in some slugs and it shows you functions/statechunk-entries/configvars/etc that fit your filter-words.
That way we could get rid of endless searching through the docs-files. For that, html-tags and encoding-stuff would be a nightmare to parse for me and others.
I still can finish up my parser I started(it's using US-API-functions, so it's easy to build) and add a function, which allows adding the italics back into the functioncalls.
I have coded this already in my current scripts, so I would just reuse that.
My parser gives you all contents, allowing you to convert Markup-texts using external tools like PanDoc and you can create the XML-file the way you need it.
Should be easier to maintain for future additions(like the modular-concept I'm working on).
What do you think?
Oh and a biiig thank you for your work on that
|
|
|
09-23-2019, 07:20 AM
|
#300
|
Human being with feelings
Join Date: Apr 2013
Location: France
Posts: 9,875
|
I didn't make my mind 100% about this but there is few things to notice.
Quote:
For that, html-tags and encoding-stuff would be a nightmare to parse for me and others.
|
I disagree with this. HTML is basically just XML with semantic markup. Aka, all HTML devs (and there is a lot of them), expect certain markup for certain things (titles, tables etc). It is way more strict than XML, and stricter than custom XML-like format, and so, more predictable.
Also, as it is as it is XML-like, any language with native tools to parse them become extremly handy to use.
For eg, your parser ultraschall_functions_engine.lua wich transform reaper-apidocs.USDocMLinto HTML is about 65 000 lines long (well, most of half is doc lines, but you see the idea).
My JavaScript Parser which transform your reaper-apidocs.USDocMLinto into a workable HTML (and which already output something very similar to what you have) is about 60 lines of code. For maintenance, code understandability, collaboration, flexibility etc... It is just better.
I use some markdown parser to output some fields etc, so it doesn't prevent the usage of markdown.
In the end, the USDocML files could theoretically be replaced by the output HTML if USDocMLdoesn't have significant benefit. (Parsing them isn't the issue).
As you manually type doc, it may be better to have it directly external and not in the lua file, or in USDocML.
Quote:
Oh and a biig thank you for your work on that
|
Still exploring. I don't know where it will go. Though it already help see that there was error in your XML definitions :P
|
|
|
09-23-2019, 07:40 AM
|
#301
|
Human being with feelings
Join Date: May 2017
Location: Leipzig
Posts: 6,621
|
Quote:
Originally Posted by X-Raym
I didn't make my mind 100% about this but there is few things to notice.
I disagree with this. HTML is basically just XML with semantic markup. Aka, all HTML devs (and there is a lot of them), expect certain markup for certain things (titles, tables etc). It is way more strict than XML, and stricter than custom XML-like format, and so, more predictable.
Also, as it is as it is XML-like, any language with native tools to parse them become extremly handy to use.
|
That's right if I use the content only for web-specific stuff, but if I want to use a description shown by a Lua-tool, I would need to replace > by < again and many others (&, etc, etc), which not only slows the stuff down.
I would also need to code such a replacer and I think converting it using an external tool into XML-conform-text is faster to be done than the other way around.
I tried to code stuff like that myself but I quickly refrained from that and I couldn't find Lua-code out there, which would do it and be of a compatible license with the Ultraschall-API.
Quote:
In the end, the USDocML files could theoretically be replaced by the output HTML if USDocMLdoesn't have significant benefit. (Parsing them isn't the issue).
|
For the stuff I'm using them currently, yes, they are overkill. But I'm going to use them for many other things, like the description of the full Ultraschall-API-project, including visualization in different ways, using different tools which is still far away from now and only in my mind.
Quote:
As you manually type doc, it may be better to have it directly external and not in the lua file, or in USDocML.
|
I had it that way in the beginning and moved it into the Lua-file, as this makes maintaining changes in functions and it's accompanying docs much faster.
Before that it was a nightmare having to go through two files opened, now I only scroll up a little and change what I need.
USDocML wasn't designed for being a web-based format, rather a docformat which could be the basis for any other format you could ever need, including webbased ones but also completely others.
And it is designed as a format, which can be included directly into sourcecode, so maintaining docs is much faster that working in to different files.
It's still in the works, which is why there's still not 3rd-partysupport in the US-API as this needs the finished version of the USDocML-format. It's mostly done but still missing details. Or maybe, I'm reworking it completely(my current plan for this being finished it beta 2.8)
See it more like rpp-files: they are xml-alike/inspired but not xml directly.
tl;dr; I have plans with that fileformat, who need them to be that way
Last edited by Meo-Ada Mespotine; 09-23-2019 at 08:32 AM.
|
|
|
09-23-2019, 08:03 AM
|
#302
|
Human being with feelings
Join Date: May 2017
Location: Leipzig
Posts: 6,621
|
Quote:
Originally Posted by lexaproductions
Hey Mespotine, I'm planning to use your "Check for changed Project Tabs" functions to know if I have to resave my RPL file upon closing Reaper.
But it seems like there are 2 cases that are not covered:
1- If we save the current project under another name
2- If we open another project over the current one.
Both of those cases don't change the project count thus it seems like the function does not flag that change. Am I not using it right?
|
Did you have already time to check the stuff further? I would love to fix these bugs in the next release as well...
|
|
|
09-23-2019, 08:36 AM
|
#303
|
Human being with feelings
Join Date: Apr 2013
Location: France
Posts: 9,875
|
Code:
See it more like rpp-files: they are xml-alike/inspired but not xml directly.
Oh yes, and as I had to make a REAPER rpp parser / generator, I can tell you it was a nightmare to write custom code, which could have been done by native functions :P
Withuot mrlimbic help, I think I'll still be stuck in this.
If you want to keep USdocXML (and you have some valid arguments for), then at least make it valid XML, or any other format which is standardl (like JSON) to allows parsing without trickery aka, all the search replacement stuff I had to make). Just my two cents
|
|
|
09-23-2019, 09:14 AM
|
#304
|
Human being with feelings
Join Date: May 2017
Location: Leipzig
Posts: 6,621
|
After having putting more thought into it, I think even if I need the USDOcML-format as it is, I think you're right too.
So I think I should provide a valid XML-file-version of the docs in the US-API-package as well, so you could use it right away without having the trouble of troubleshooting it
I think I will make a converter for that, and could simplify it for that as well, but I need some more help from you for that.
If you look at the parameter/retvals-tags, do they work for you the way I added them or would you rather have the parameter/retval-names separated from the descriptions?
Like:
Code:
<retvals>
<retval id="1" name="exists" type="boolean">
returns true, if a MediaItem exists; false if not
</retval>
<retval id="2" name="item" type="optional MediaItem">
the MediaItem, which is returned by this function in some cases
</retval>
</retvals>
And would that help you for layouting the functioncall as well?
For the rest, would the current USDocML-version with your text-replacements work as a temporary file to experiment with, until I managed to finish the XML-conversion-stuff?
The xml-version would follow mostly the same structure, so it should mostly be compatible(depending on, if you need retvals and parameters stored in a different way).
|
|
|
09-23-2019, 09:41 AM
|
#305
|
Human being with feelings
Join Date: Apr 2013
Location: France
Posts: 9,875
|
Code:
For the rest, would the current USDocML-version with your text-replacements work as a temporary file
It could even work as a definitive fix, if you don't add new character which could break it haha :P
Quote:
parameter/retval-names separated from the descriptions?
|
Hmm this could maybe prevent me to have to write custom regex for <functioncall>...
But maybe a bit overkill. I was fine with just <i> like in native :P (even if I replace by <em>.
I have to explore regex solution works, maybe there is less conditions than I think.
|
|
|
09-23-2019, 09:58 AM
|
#306
|
Human being with feelings
Join Date: Apr 2013
Location: France
Posts: 9,875
|
Code:
string name - the name of the context-menu to show
- can be track_input, track_panel, track_area, track_routing, item, ruler, envelope, envelope_point, envelope_item
integer x - x-position of the contextmenu-display-position in pixels
integer y - y-position of the contextmenu-display-position in pixels
optional HWND hwndParent - the HWND-window in which to display the context-menu.
- nil, Reaper's main window will be used as HWND
optional identifier ctx - the object for which to apply the contextmenu. Options selected in the context-menu will be applied to this track/item;
- nil, use the selected track(s)/item(s)/envelope, depending on the chosen context-menu-name in parameter name;
- shows no context-menu, when no track/item/envelope is selected;
-
- possible objects and their corresponding name-parameter:
- - MediaTrack(track_input, track_panel, track_routing)
- - MediaItem(item)
- - TrackEnvelope(also Take-Envelopes!) (envelope, envelope_point)
- when using any other context-menu-name, this parameter will be ignored by Reaper.
optional ctxOptional - when ctx is a TrackEnvelope(or nil) and menu="envelope_point",
- this is the idx of the envelope-point to which to apply the context-menu
- when ctx is a TrackEnvelope(or nil) and menu="envelope_item",
- this reflects the automation-item in chosen envelope, to which to apply the context-menu(1 or higher for automation-item 1 or higher)
optional ctx2Optional - when ctx is a TrackEnvelope(or nil) and menu="envelope_point", this reflects,
- 0, whether to apply the context-menu to the point in the envelope-lane or
- 1 or higher, whether to apply the context-menu to the point in automation-item 1 or higher;
- nil, assumes 0(envelope-lane)
This isn't markdown ? What format is it ?
|
|
|
09-24-2019, 08:48 AM
|
#307
|
Human being with feelings
Join Date: May 2017
Location: Leipzig
Posts: 6,621
|
It's custom:
everything before the - is the name and everything after it is the description.
If only spaces/tabs are before the - then the text after - is a line of the description for the previous parameter/retvalname.
Example:
Code:
retvalname1 - first line of description
- second line of description of retvalname1
retvalname2 - the first line of description
etc, etc.
The description itself can be of any markup-format defined, the name itself not, as seen in the parameter/retvals-tag's element "markuptype" and "markupversion".
BTW: Do you know a good XML-validator-commandline-tool for Windows?
Last edited by Meo-Ada Mespotine; 09-24-2019 at 09:36 AM.
|
|
|
09-24-2019, 08:55 AM
|
#308
|
Human being with feelings
Join Date: May 2017
Location: Leipzig
Posts: 6,621
|
@all
Expect the next release to feature a real real nice gem
As great as the rendering-features
|
|
|
09-24-2019, 03:35 PM
|
#309
|
Human being with feelings
Join Date: Apr 2013
Location: France
Posts: 9,875
|
@mespotine
Custom format ? This means having to create a parser for that as well ^^
You know my love for standards :P
For xml validator as commabd line, I didnt try any, I just parse XML with javascript and it return the first error it can see. Javascript can be run as command line with Node.js.
|
|
|
09-26-2019, 09:25 AM
|
#310
|
Human being with feelings
Join Date: May 2017
Location: Leipzig
Posts: 6,621
|
Assuming I have given you the most perfect XML-file in the world ( ) how would you approach it?
Would you use the XML-file to generate an HTML-file which includes all contents of the XML-file or do you use an HTML-file with stylesheets and such to format the XML-file?
The standards stuff, yeah, I would love to have used one of them, but none of them fulfilled all my needs.
They either sucked as "Inline-Docs" within my functions or they sucked as format to accept Markdown or they sucked on metadata-level or they could do all three but were ugly to write and to read.
So in the end, I sighed and made my own stuff.
I even think about making my own MarkDown-dialect, as this is the next thing I use regularily and that sucks big time on edge-case-basis... :/
Last edited by Meo-Ada Mespotine; 09-26-2019 at 09:32 AM.
|
|
|
09-26-2019, 01:54 PM
|
#311
|
Human being with feelings
Join Date: Apr 2013
Location: France
Posts: 9,875
|
Quote:
Would you use the XML-file to generate an HTML-file which includes all contents of the XML-file or do you use an HTML-file with stylesheets and such to format the XML-file?
|
Hmmm I'm not sure to understand the subtle differnece here.
I use an HTML page wich parse and render the USdocXML into itself (it doesnt create new file to display the render).
Quote:
I even think about making my own MarkDown-dialect, as this is the next thing I use regularily and that sucks big time on edge-case-basis... :/
|
Note that markdown can include raw html in it, so it is handy for adding a bit of semantic if needed.
The hardest thing in markdown is table.
Quote:
how would you approach it?
|
Well, not being standard was 90% of my problem,
now I'm temporary stuck with inline content which are written in custom format (like your table) or without any markup (like the function definition).
So I would say that my approach would have been to only use existing standards, and to not remove semantic infos.
I may also would have take more advantage of attribute.
Tough question though ^^ I just post problem as they come. None of them are eliminatory. It should be possible to parse you data. It just requires more dev time. and brain power :P
|
|
|
10-01-2019, 09:22 AM
|
#312
|
Human being with feelings
Join Date: May 2017
Location: Leipzig
Posts: 6,621
|
4.00 Beta 2.77: - "Monkeys with Tools - Call the planet doctor" - 1st of October 2019
Has now 1029 functions with 44 new ones! Yes, I crossed the thousand!
New in this release:
- Event Manager
Killer Feature Time and long requested by many of you!
The EventManager allows you to run actions, when certain states occur/statechanges occur.
That way you can automatize running actions under certain circumstances without having to run your own defer-script for that.
Kudos to [user]fernsehmuell[/user], who was essential in the initial designs of it!
- ShowXXXInputMenu
Shows different Context-menus, like TrackInput, TrackPanel, TrackArea, TrackRouting, Ruler, MediaItem, Track/TakeEnvelope,
EnvelopePoint, EnvelopePoint for Automation Items, AutomationItems-contextmenu.
Reaper's own function ShowPopupMenu is quite difficult to use, so I made some, who make it easier.
- RunLuaSourceCode
Runs Luacode directly without having to create a script for it.
- Main_OnCommand_LuaCode
Runs Luacode as child-script directly without having to create a script for it.
- GetTimeByMouseXPosition
returns projecttime at x-screenposition, which can be nice for mouse-editing-specific actions.
- ReplacePatternInString
Like Lua's string.gsub(), this replaces a pattern within a string with a replacement string, but you can choose,
which one shall be replaced. And unlike string.gsub() only that one will be replaced, not the occurences after that.
- GetItem_ClickState and GetTrackEnvelope_ClickState
Return, if a MediaItem/EnvelopePoint is currently clicked and hovered by the mouse. Could be used for some nice and handy things.
- GetAllActions
Sped up and returns now more attributes, like action-type(script, native, custom, extension), termination-state of scripts, consolidate-state for custom actions.
- ConvertFunction_FromBase64String and ConvertFunction_ToBase64String
Convert a Lua-function to/from a BASE64-string. That way, you can exchange functions via extstates. Convert to Base64-string, put the string into an extstate,
read the string from the extstate and convert it back to a function.
- Bugfixes and optimzations
Optimized and bugfixed tons of other stuff, thanks to many bugreports and a lot of feedback from many of you.
Big thanks for that
New features in 4.00beta2.77
- Defer Management: GetDeferRunState - gets the current runstate of a ultraschall-defer-loop in the current or a specific scriptinstance(requested by rstockm)
- Docs: EventManager - added concepts docs for detailed description, on how to use and code the EventManager
- Envelope Management: GetTrackEnvelope_ClickState - returns the currently clicked TrackEnvelope-Point
- Error Messaging System: SuppressErrorMessages - suppresses and unsuppresses error-messages of the error messaging system
- EventManager: EventManager_AddEvent - registers a new event to the EvenManager-checkingqueue
- EventManager: EventManager_AddStartupEvent - adds an event into the ini-file of the EventManager, to be registered at startup of the ini-file
- EventManager: EventManager_CountRegisteredEvents - counts the number of registered events
- EventManager: EventManager_CountStartupEvents - counts the number of currently available startup-events for the EventManager
- EventManager: EventManager_EnumerateEvents - returns attributes of specific registered events
- EventManager: EventManager_EnumerateEvents2 - enumerates attributes of an event by EventIdentifier
- EventManager: EventManager_EnumerateStartupEvents - enumerates attributes of a startup-event
- EventManager: EventManager_EnumerateStartupEvents2 - enumerates attributes of a startup-event by an EventIdentifier
- EventManager: EventManager_IsValidEventIdentifier - checks, if an EventIdentifier is a valid and currently registered one
- EventManager: EventManager_PauseEvent - pauses a registered event in the EventManager
- EventManager: EventManager_RemoveAllEvents_Script - removes all events, registered by a script with a certain ScriptIdentifier
- EventManager: EventManager_RemoveEvent - removes an event from the EvenManager-checkingqueue
- EventManager: EventManager_RemoveStartupEvent - removes a registered-at-startup-event for the EventManager by EventIdentifier
- EventManager: EventManager_RemoveStartupEvent2 - removes a registered-at-startup-event for the EventManager
- EventManager: EventManager_ResumeEvent - resumes a paused and registered event in the EventManager
- EventManager: EventManager_SetEvent - sets an already existing event in the EvenManager-checkingqueue
- EventManager: EventManager_SetStartupEvent - sets an event in the ini-file of the EventManager, which will be registered at startup of the ini-file
- EventManager: EventManager_Start - starts the EventManager
- EventManager: EventManager_Stop - removes all events registered by the current script/a specific ScriptIdentifier; stops the EventManager, if all scripts who have registered events have used this function
- EventManager: Ultraschall_EventManager.lua - the backgroundscript for the EventManager
- Helper Functions: ConvertFunction_FromBase64String - loads a function from a BASE64-string
- Helper Functions: ConvertFunction_ToBase64String - converts a function into a BASE64-string
- Helper functions: Main_OnCommand_LuaCode - runs Luacode in a temporary new script, without the need to create it first
- Helper functions: ReplacePatternInString - replaces a certain occurence(and only that one) of a pattern in a string with a replacement
- Helper functions: RunLuaSourceCode - runs Lua-code directly from a string
- MediaItem Management: GetItem_ClickState - returns the currently clicked MediaItem
- MediaItem Management: GetItem_HighestRecCounter - returns the highest reccounter in the current project
- MediaItem Management: GetItem_Number - returns the itemnumber of a MediaItem within a project(requested by XRaym)
- Project Management: GetProjectFilename - returns the filename of a currently opened project
- Project Management: SetProject_GlobalAuto - sets global automation override-state a projectfile or a ProjectStateChunk
- Project Management: SetProject_Lock - sets locked-state of a projectfile or a ProjectStateChunk
- Project Management: SetProject_MasterAutomode - sets automation-mode of the mastertrack in a projectfile or a ProjectStateChunk
- Project Management: SetProject_Playrate - sets playrate-state of a projectfile or a ProjectStateChunk
- Project Management: SetProject_MasterSel - sets selection-state of the master-track in a projectfile or a ProjectStateChunk
- Project Management: SetProject_Tempo - sets the tempo settings(bpm, beat, denominator) a projectfile or a ProjectStateChunk
- Ultraschall: DeleteUSExternalState - deletes an extstate from the ultraschall.ini(requested by rstockm)
- User Interface: GetTimeByMouseXPosition - returns projecttime at x-screenposition
- User Interface: ShowTrackInputMenu - shows a TrackInput-contextmenu
- User Interface: ShowTrackPanelMenu - shows a TrackPanel-contextmenu
- User Interface: ShowTrackAreaMenu - shows a TrackArea-contextmenu
- User Interface: ShowTrackRoutingMenu - shows a TrackRouting-contextmenu
- User Interface: ShowRulerMenu - shows a Ruler-contextmenu
- User Interface: ShowMediaItemMenu - shows a MediaItem-contextmenu
- User Interface: ShowEnvelopeMenu - shows a Track/TakeEnvelope-contextmenu
- User Interface: ShowEnvelopePointMenu - shows an EnvelopePoint-contextmenu
- User Interface: ShowEnvelopePointMenu_AutomationItem - shows an EnvelopePoint-contextmenu for Automation Items
- User Interface: ShowAutomationItemMenu - shows an AutomationItems-contextmenu
Changes from Beta 2.761 to Beta 2.77
- Actions: GetAllActions - sped up by magnitudes; returns now actiontype, consolidate-state, termination-state of actions as well; supports now section 1(invisible custom actions)
- API: functions - moved all functions into modules for future modular-concept
- Configuration Files: CountIniFileExternalState_sec - had inner variable exposed -> fixed
- Configuration Files: EnumerateIniFileExternalState_sec - did return keys instead of sections -> fixed
- Configuration Files: GetKBIniKeys - enhanced description for osc
- Configuration Files: SetKBIniKeys - enhanced description for osc
- Docs: Reaper Internals - updated to Reaper 5.983 and JS-extension 0.992
- DocEngine: Docs_GetUSDocBloc_ChapterContext - returned an additional empty non-existant chapter -> fixed
- DocEngine: Docs_GetUSDocBloc_Requires - could produce a Lua-error -> fixed
- Defer Management: GetDeferIdentifier - you can optionally pass a script-identifier now, to get the defer-identifier of another scriptinstance(used to support only the current script instance)
- Helper Functions: IsValidMatchingPattern - moved to docs-index API-Helper functions -> Data Manipulation
- Helper Functions: SecondsToTime - moved to docs-index API-Helper functions -> Data Manipulation
- Helper Functions: SecondsToTimeString_hh_mm_ss_mss - moved to docs-index API-Helper functions -> Data Manipulation
- Helper Functions: SplitStringAtLineFeedToArray - didn't always return the last entry of the passed string -> fixed (thanks to Aurelien)
- Helper Functions: TimeStringToSeconds_hh_mm_ss_mss - moved to docs-index API-Helper functions -> Data Manipulation
- Helper Functions: TimeToSeconds - moved to docs-index API-Helper functions -> Data Manipulation
|
|
|
10-01-2019, 09:23 AM
|
#313
|
Human being with feelings
Join Date: May 2017
Location: Leipzig
Posts: 6,621
|
Changes from Beta 2.761 to Beta 2.77(continuation):
- HWND: GetActionsHWND - moved to docs-index User Interface -> Reaper-Windowhandler
- HWND: GetBatchFileItemConverterHWND - moved to docs-index User Interface -> Reaper-Windowhandler
- HWND: GetConsolidateTracksHWND - moved to docs-index User Interface -> Reaper-Windowhandler
- HWND: GetExportProjectMIDIHWND - moved to docs-index User Interface -> Reaper-Windowhandler
- HWND: GetPreferencesHWND - moved to docs-index User Interface -> Reaper-Windowhandler
- HWND: GetProjectDirectoryCleanupHWND - moved to docs-index User Interface -> Reaper-Windowhandler
- HWND: GetProjectSettingsHWND - moved to docs-index User Interface -> Reaper-Windowhandler
- HWND: GetRenderQueueHWND - moved to docs-index User Interface -> Reaper-Windowhandler
- HWND: GetRenderToFileHWND - moved to docs-index User Interface -> Reaper-Windowhandler
- HWND: GetRenderingToFileHWND - moved to docs-index User Interface -> Reaper-Windowhandler
- HWND: GetSaveLiveOutputToDiskHWND - moved to docs-index User Interface -> Reaper-Windowhandler
- HWND: GetVideoHWND - moved to docs-index User Interface -> Reaper-Windowhandler
- Media Explorer: MediaExplorer_OnCommand - moved function in docs to index Media Explorer
- Media Explorer: UpdateMediaExplorer - moved function in docs to index Media Explorer
- Project Management: CheckForChangedProjectTabs - checks now as well, if projectfilenames have changed, by either loading a project or saving a project under a new filename(requested by lexaproductions)
- Project Management: GetProject_GlobalAuto - added description for global-automation-override_state
- Project Management: GetProject_MasterGroupFlagsState - moved to correct docsindex Project Management
- Project Management: ProjectTabs-check - initialization had a bug, which could cause CheckForChangedProjectTabs to fail at times -> fixed
- Project Management: SetProject_MasterGroupFlagsState - moved to correct docsindex Project Management
- SpectralEdit: AddItemSpectralEdit - parameter end_pos was actually length -> fixed (thanks to XRaym)
- SpectralEdit: GetItemSpectralEdit - retval end_pos was actually length -> fixed (thanks to XRaym)
- SpectralEdit: SetItemSpectralEdit - parameter end_pos was actually length -> fixed (thanks to XRaym)
- Ultraschall: EnumerateUSExternalState_sec - had problems, when ultraschall.ini was stored with CR+LF-lineendings -> fixed (thanks to rstockm)
- Ultraschall: IsTrackSoundboard - sped up execution by removing useless loop(thanks rstockm)
- Ultraschall: IsTrackStudioLink - sped up execution by removing useless loop(thanks rstockm)
- Ultraschall: IsTrackStudioLinkOnAir - sped up execution by removing useless loop; didn't work correctly on Mac -> fixed(thanks rstockm)
- Ultraschall: moved ultraschall.ini-related functions to Ultraschall Specific-index in the docs
- User Interface: GetReaperWindowPosition_Left - deprecated
- User Interface: GetReaperWindowPosition_Right - deprecated
- User Interface: GetUserInputs - only working on Windows, currently. Working on fixing it.
- User Interface: MB - only working on Windows, currently. Working on fixing it.
|
|
|
10-01-2019, 12:25 PM
|
#314
|
Human being with feelings
Join Date: May 2017
Location: Leipzig
Posts: 6,621
|
Because I have been asked, here a full example-script, which adds an event to the new EventManager, which adds a marker and opens the markerediting-dialog, everytime the playstate changes from PLAY to PLAYPAUSE.
Maybe this helps you to get the idea.
Code:
dofile(reaper.GetResourcePath().."/UserPlugins/ultraschall_api.lua")
function TransitionPlayToPlaypause(userspace)
-- get the current playstate
local current_playstate=reaper.GetPlayState()
-- if the current playstate==2(playpause) and the old playstate==1(play) then
-- update old_playstate in the userspace and return true
-- in any other case, only update old_playstate in the userspace and return false
if current_playstate==2 and userspace["old_playstate"]==1 then
userspace["old_playstate"]=current_playstate
return true
else
userspace["old_playstate"]=current_playstate
return false
end
end
ultraschall.EventManager_Start()
EventIdentifier = ultraschall.EventManager_AddEvent(
"Insert Marker When Play -> PlayPause", -- a descriptive name for the event
0, -- how often to check within a second; 0, means as often as possible
0, -- how long to check for it in seconds; 0, means forever
true, -- shall the actions be run as long as the eventcheck-function
-- returns true(false) or not(true)
false, -- shall the event be paused(true) or checked for right away(true)
TransitionPlayToPlaypause, -- the eventcheck-functionname,
{"40157, 0"} -- a table, which hold all actions and their corresponding sections
-- in this case action 40157 from section 0
-- note: both must be written as string "40157, 0"
-- if you want to add numerous actions, you can write them like
-- {"40157, 0", "40171,0"}, which would add a marker and open
-- the input-markername-dialog
)
Edit: run the script, hit play and pause after that, to see the effect in action.
And if it doesn't, then it's probably a bug on my side.
Last edited by Meo-Ada Mespotine; 10-01-2019 at 03:28 PM.
|
|
|
10-01-2019, 03:01 PM
|
#315
|
Human being with feelings
Join Date: Apr 2013
Location: France
Posts: 9,875
|
Event system ?
You are again way ahead of your time haha
Well done for all this !
EDIT: hmmm your code snippet doesnt work on my side, last reaper pre releases and updated ultraschall. It just do nothing. Is there a way to see if the event has been register (action state stay inactive)
|
|
|
10-01-2019, 03:22 PM
|
#316
|
Human being with feelings
Join Date: May 2017
Location: Leipzig
Posts: 6,621
|
Make play and pause. If that doesn't work, you could count the currently registered events with the appropriate function.
If the count is 0, then there's a bug somewhere.
Edit: it took me 9 months to design and code that. I can understand now, why this hasn't been done yet.
And I'm pretty sure, it still has issues.
|
|
|
10-02-2019, 02:32 AM
|
#317
|
Human being with feelings
Join Date: Apr 2013
Location: France
Posts: 9,875
|
I confirm that with your code snippet above,
EventIdentifier is nil
and EventManager_CountStartupEvents return 0.
Lets see if someone else has this issue !
|
|
|
10-02-2019, 06:31 AM
|
#318
|
Human being with feelings
Join Date: May 2017
Location: Leipzig
Posts: 6,621
|
Hmm...that's weird.
I have tested it yesterday once again with a vanilla 5.983 and this API-version.
Could you add
ultraschall.ShowLastErrorMessage()
at the end and see, if it outputs an error?
|
|
|
10-02-2019, 06:41 AM
|
#319
|
Human being with feelings
Join Date: Apr 2013
Location: France
Posts: 9,875
|
the error is simply "Event manager not started"..
So I put ultraschall.EventManager_Start() at top of the script, before calling the error message and after.
Still get the same error :S
Is there something I'm missing about it ?
(not I'm using last pre).
|
|
|
10-02-2019, 06:43 AM
|
#320
|
Human being with feelings
Join Date: May 2017
Location: Leipzig
Posts: 6,621
|
Ok, that's a hint. Maybe something went wrong with the ReaPack-indexfile and something is missing.
Will investigate into that.
|
|
|
Thread Tools |
|
Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -7. The time now is 10:06 PM.
|