 |
|
|
10-02-2019, 06:51 AM
|
#321
|
Human being with feelings
Join Date: Apr 2013
Location: France
Posts: 9,401
|
Just for info, hat is the basic concept under the hood ? Does it defer the script somehow ? It is made in pure Lua right ?
|
|
|
10-02-2019, 06:56 AM
|
#322
|
Human being with feelings
Join Date: May 2017
Location: Leipzig
Posts: 6,345
|
All pure Lua.
There's a defer-script called ultraschall_eventmanager.lua, which gets started(or it should, but it seems like, it doesn't get started in your case for some reason).
The functions communicate back and forth with it using magic extstate-management.
This features also technology intended for my collaboration with lokasenna.
Edit: You could run the EventManager by hand, by adding the ultraschall_eventmanager.lua-script as action, run it and see, whether my script-snippet works after that.
|
|
|
10-02-2019, 07:21 AM
|
#323
|
Human being with feelings
Join Date: Apr 2013
Location: France
Posts: 9,401
|
I confirm the issue is that https://raw.githubusercontent.com/Ul...entManager.lua isn't downloaded.
I manually added it and it works now.
Now I'll be able to experiment when I'll face event style scripting needs. :P
|
|
|
10-02-2019, 07:34 AM
|
#324
|
Human being with feelings
Join Date: May 2017
Location: Leipzig
Posts: 6,345
|
Great
Will fix that on friday in Hotfix 1.
|
|
|
10-04-2019, 07:23 AM
|
#325
|
Human being with feelings
Join Date: May 2017
Location: Leipzig
Posts: 6,345
|
@XRaym
Forgot to ask, which OS and ReaPack-version do you use?
|
|
|
10-04-2019, 02:58 PM
|
#326
|
Human being with feelings
Join Date: Apr 2013
Location: France
Posts: 9,401
|
Win 10, last reapack version.
|
|
|
10-05-2019, 02:13 PM
|
#327
|
Human being with feelings
Join Date: May 2017
Location: Leipzig
Posts: 6,345
|
@XRaym
Ok, I only could find a potential bug on Linux due UpperLowercase-filname problems but I can't reproduce the bug you have...
Especially, as ReaPack would need to show an error, when downloading the EventManager.lua didn't work(it is definately in the reapack-index file).
And all my tests successfully load the full package.
So, I have no idea what the problem is. Maybe some filesystem-versioning stuff on Win10?
|
|
|
10-05-2019, 02:30 PM
|
#328
|
Human being with feelings
Join Date: May 2017
Location: Leipzig
Posts: 6,345
|
New Hotfix 1 from October, 5th, 2019
Build: 40677.01
Changes
- Docs: Reaper Internals - updated to JS-extension 0.993 and some additional bits about gfx.mouse_cap and get_action_context(); was missing gfx -> fixed
- EventManager: ultraschall_EventManager.lua - couldn't be installed/loaded under some circumstances due Upper/LowerCase-issues in filename -> fixed
please update your ReaPacks
|
|
|
10-13-2019, 09:31 AM
|
#329
|
Human being with feelings
Join Date: Feb 2009
Location: Reaper HAS send control via midi !!!
Posts: 3,950
|
Thanks mespotine you added all the great parameter learn functionality, with set and get. I still did not try them yet. But the most obvious and general use case scenario of this would be as follows, especially also useful to non-programmers:
1. only simple .txt files are used for parameter mappings
2. for saving and loading, simple .txt files
3. format could be 5 columns per line
4. using tab or ; as delimiter might work, or any of them
5. columns are: trackname;fxname;parametername;type;value
And the lua script would scan this .txt file, line by line and do following:
if (project contains any track with trackname AND any fx in that track with fxname AND any parameter in that fx with parametername)
use type for midi mapping
and value for its value
That's it. Then you could define any mappings for any scenarios for any complex project. Those .rpp templates could be shared together with those mapping .txt files.
Especially when thinking in terms of certain starndard mappings for certain devices, we could have many such templates for certain devices. Over time there could be many useful fun projects to play with, 100's of templates for device x, e.g. reason mode. Has your device reason mode, switch it on, load template, ready to go, all would work, immediately. In short it would allow making normal reaper .rpp projects, something like grooveboxes, all parameters mapped immediately to your hardware. Ready to have fun.
You plug in your project to your hardware(s) and not the opposite.
save_midi_mappings.lua would save midi_mappings.txt to project directory, which would simply contain all tracknames, all fxnames per track and all parameternames per fx, where no mapping is columns type and value would be empty. Optionally those empty mapping entry lines could be left out.
load_midi_mappings.lua would load midi_mappings.txt from project directory, if available. Wonderful way of sharing them in this forum, together with their .rpp templates.
And if load_midi_mappings.lua would be a bit more intelligent, it could even add the missing fx to the project first, then apply the midi mapping!
Typical mapping targets could be: Bypass, Wet, Cutoff, Resonance, Volume, Pan.
Last edited by TonE; 10-13-2019 at 10:07 AM.
|
|
|
10-21-2019, 09:27 AM
|
#330
|
Human being with feelings
Join Date: May 2017
Location: Leipzig
Posts: 6,345
|
Quote:
Originally Posted by TonE
Thanks mespotine you added all the great parameter learn functionality, with set and get. I still did not try them yet. But the most obvious and general use case scenario of this would be as follows, especially also useful to non-programmers:
1. only simple .txt files are used for parameter mappings
2. for saving and loading, simple .txt files
3. format could be 5 columns per line
4. using tab or ; as delimiter might work, or any of them
5. columns are: trackname;fxname;parametername;type;value
And the lua script would scan this .txt file, line by line and do following:
if (project contains any track with trackname AND any fx in that track with fxname AND any parameter in that fx with parametername)
use type for midi mapping
and value for its value
That's it. Then you could define any mappings for any scenarios for any complex project. Those .rpp templates could be shared together with those mapping .txt files.
Especially when thinking in terms of certain starndard mappings for certain devices, we could have many such templates for certain devices. Over time there could be many useful fun projects to play with, 100's of templates for device x, e.g. reason mode. Has your device reason mode, switch it on, load template, ready to go, all would work, immediately. In short it would allow making normal reaper .rpp projects, something like grooveboxes, all parameters mapped immediately to your hardware. Ready to have fun.
You plug in your project to your hardware(s) and not the opposite.
save_midi_mappings.lua would save midi_mappings.txt to project directory, which would simply contain all tracknames, all fxnames per track and all parameternames per fx, where no mapping is columns type and value would be empty. Optionally those empty mapping entry lines could be left out.
load_midi_mappings.lua would load midi_mappings.txt from project directory, if available. Wonderful way of sharing them in this forum, together with their .rpp templates.
And if load_midi_mappings.lua would be a bit more intelligent, it could even add the missing fx to the project first, then apply the midi mapping!
Typical mapping targets could be: Bypass, Wet, Cutoff, Resonance, Volume, Pan.
|
Will think about that but first, I will finish off the functions, so that is fully programmable.
The most important thing to take care of would be, future compatibility. Means, if the devs add new features, the txt-file must be extendable without breaking anything. This is where things become difficult and tedious in the design-process.
|
|
|
10-21-2019, 12:45 PM
|
#331
|
Human being with feelings
Join Date: Feb 2009
Location: Reaper HAS send control via midi !!!
Posts: 3,950
|
No problem, I started already playing around with it, modifying some available csv import/export scripts, so far only track names are saved, when finished I will share it of course. All these you would finish probably in 2 minutes, but that is not the point anyway, if there would be more tutorials for basic lua tasks, all would be much easier, most time is spent finding out first, which functions to use in which order correctly, plus how to set their parameters correctly, some start counting with 1, some with 0. Somehow this is the bad part of the whole lua story.
Even when trying to understand the available lua functions, there are too many, I can not find the right place in the documentation, so I am mainly just rgrep'ing in the entire reaper scripts + userplugins directory, looking at available 3000 .lua scripts as examples, then trying to figure out things. Examples which I do not like, I ignore, mpl scripts are typically unnecessarily complicated in their design, just to give one example. The main idea of a script should be understandable at first look, not looking like a cryptical task, splitting the main task into sub functions.
If you have any recommendations who's scripts are most elegant in design, that would be useful as well. One perfect design for csv file export and import would be cool, also. Best example I found is "Import Chordino chords to regions", but even this script contains elements not used in the script, like this line
PHP Code:
folder = filetxt:match[[^@?(.*[\/])[^\/]-$]]
|
|
|
10-21-2019, 12:56 PM
|
#332
|
Human being with feelings
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
|
Quote:
Originally Posted by TonE
plus how to set their parameters correctly, some start counting with 1, some with 0. Somehow this is the bad part of the whole lua story.
|
Any functions provided by Lua use 1-based indexes. The Reaper API ( reaper.___, gfx.___) uses 0-based indexes because the API comes from C++ and has to work EEL and Python, all of which use 0.
Quote:
The main idea of a script should be understandable at first look, not looking like a cryptical task, splitting the main task into sub functions.
|
Splitting tasks into smaller functions is critical for making code easy to write, debug, and maintain. There are entire books devoted to this idea.
The original version of my GUI library was all in one file with functions that were hundreds of lines long, and it was a nightmare to work with. The version I'm working on now is split into a few dozen files, I think there might only be one function over a hundred lines, most are a dozen or less, and I'm able to make changes much more quickly while knowing exactly what other parts of the code have been affected.
That said, naming functions clearly is also a valuable skill and is unfortunately overlooked quite often.
|
|
|
10-21-2019, 02:17 PM
|
#333
|
Human being with feelings
Join Date: Feb 2009
Location: Reaper HAS send control via midi !!!
Posts: 3,950
|
Quote:
Originally Posted by Lokasenna
The original version of my GUI library was all in one file with functions that were hundreds of lines long, and it was a nightmare to work with. The version I'm working on now is split into a few dozen files, I think there might only be one function over a hundred lines, most are a dozen or less, and I'm able to make changes much more quickly while knowing exactly what other parts of the code have been affected.
|
Especially lua not offering { } blocks, usually, so even the best editor like emacs is not of big help for quickly jumping between blocks.
Java has each class in a sepeparate .java file, along your description above, making things simpler, all stuff together in one place, the attributes and the functions which can deal with them. Plus there is inheritance, in lua are objects available?
|
|
|
10-21-2019, 02:34 PM
|
#334
|
Human being with feelings
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
|
Quote:
Originally Posted by TonE
Especially lua not offering { } blocks, usually, so even the best editor like emacs is not of big help for quickly jumping between blocks.
|
Lua has blocks just like every other language - function ... end or do ... end rather than curly braces. If your editor has difficulty with them, that's the editor's problem - I've never had any trouble in that department using Notepad++ or VS Code.
That said, because Lua is so flexible it is much more difficult to write a language server that can parse everything correctly. I only came across a server for VS Code the other day that can pick up class methods and the like.
Quote:
Plus there is inheritance, in lua are objects available?
|
Lua uses prototypal inheritance (like Javascript) rather than classical inheritance (Java or C++). Most ReaScripts don't make use of it, though, because most of what we're doing wouldn't benefit from being stuffed into a class structure.
Larger scripts like my GUI library use OOP all over the place because it does make sense there; I also found it helpful in Lokasenna_Smart fill gaps by stretching item tails because the work involved is a) repetitive and b) requires exposing a lot of values from one step of the process to the next.
|
|
|
10-21-2019, 04:53 PM
|
#335
|
Human being with feelings
Join Date: Feb 2009
Location: Reaper HAS send control via midi !!!
Posts: 3,950
|
What you mean with problems and editor? It is emacs.
If code has curly braces, you can use ctrl-alt-u, to go one level up in block hierarchy, if you hit ctrl-alt-d, you go one level down in block hierarchy, using ctrl-alt-n/p you can jump between blocks in same level. Not having those curly braces, removes this cool and quick jumping and diving in/out around codes. This is what I meant. So begin and end do not work, here on my emacs at least, with my settings.
Last edited by TonE; 10-21-2019 at 04:59 PM.
|
|
|
10-21-2019, 07:59 PM
|
#336
|
Human being with feelings
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
|
Quote:
Originally Posted by TonE
This is what I meant. So begin and end do not work, here on my emacs at least, with my settings.
|
Curly braces are how some languages denote a block of code, but not all. If Emacs is specifically looking for curly braces rather than what the current language uses, that's not Lua's fault - that's Emacs missing some fairly basic functionality.
|
|
|
10-22-2019, 04:43 AM
|
#337
|
Human being with feelings
Join Date: Feb 2009
Location: Reaper HAS send control via midi !!!
Posts: 3,950
|
But only for the above mentioned advanced navigation, can your editor do such navigation at all? Also with .lua codes? Diving in and out of block hierarchies?
|
|
|
10-22-2019, 06:48 AM
|
#338
|
Human being with feelings
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
|
Quote:
Originally Posted by TonE
But only for the above mentioned advanced navigation, can your editor do such navigation at all? Also with .lua codes? Diving in and out of block hierarchies?
|
The behavior isn't perfect, but this extension appears to do it.
|
|
|
10-23-2019, 07:41 AM
|
#339
|
Human being with feelings
Join Date: May 2017
Location: Leipzig
Posts: 6,345
|
Quote:
Originally Posted by TonE
The main idea of a script should be understandable at first look, not looking like a cryptical task, splitting the main task into sub functions.
|
I disagree: the main idea of a script is to provide the functionality in the first place.
Subfunctions can be very helpful with that, as you can split the work into individual tasks.
You can, however, try to make that stuff as easy to read as possible, by naming functions clearly, so you can see right away, what a certain function does.
So a main-function just calls the functions needed and their names tell you, what they are supposed to do.
But: what that "easy to read" means, is an individual thing. I try to name all my US-API-functions as clearly as possible, so reading the code is also like reading its description. But I have no idea, whether I succeeded in it at all, as others may have another idea of readability and find my naming-scheme confusing.
It's complicated and you can just try to make it as good as possible.
Another thing is, that maybe we need a better collection of tutorial-scripts, who are written to be understandeable in the first place, including extensive-descriptive-comments. But this isn't as easy as it may sound, as you need to find easy words for complicated tasks and this takes time to do correctly.
MPL's scripts are probably not written as example-scripts but more written as efficient as possible, so he can get the stuff working and as maintainable as possible for him.
It's complicated.
BTW: If you get your CSV-stuff working, I would be happy to include it into the Ultraschall-API officially. Sounds like a really helpful feature in the first place.
|
|
|
10-23-2019, 02:47 PM
|
#340
|
Human being with feelings
Join Date: Feb 2009
Location: Reaper HAS send control via midi !!!
Posts: 3,950
|
mespotine, I wrote in general, not meaning at all your scripts, only mpl scipts were one counter example, from my understanding. I guess you read/understood the same sentence in a different form.
Of course you can include it, but I am not far yet and it can take some time.
|
|
|
10-26-2019, 05:49 AM
|
#341
|
Human being with feelings
Join Date: May 2017
Location: Leipzig
Posts: 6,345
|
Yes I know. Maybe my writing sounded a little bit too harsh, sorry for that.
|
|
|
11-04-2019, 11:11 AM
|
#342
|
Human being with feelings
Join Date: May 2017
Location: Leipzig
Posts: 6,345
|
Ultraschall Framework - Changelog[/big]
4.00 Beta 2.78: - "Tchaikovski - Overture 1812" - 5th of November 2019
Has now 1070 functions, with 41 new ones
New in this release:
- Event Manager
Additional functions and features to improve handling, development, monitoring and debugging of events.
Fixed some bugs, that need startup-events to be readded again. Sorry for that.
- SLEM
like ultraschall.ShowLastErrorMessage() but faster to type. I should have added this much more earlier.
- MIDI-notes
Now you can send easily Midi: notes, cc-messages, pc and pitchbends.
- Defer
One Defer-function to rule them all. You can set, how often to run the defer-cycle and give it an identifier.
With that identifier, you can stop that specific defer-cycle from the outside!
Way better than killing all scripts with the action "ReaScript: Close all running reaScripts".
- PingMe
Puts out a message including linenumber and function, in which the PingMe-function was executed.
You can output the message in the ReaScript-console, as messagebox and into the clipboard, even retaining old clipboard-contents.
This can be used as simpler version of hooks to monitor internal behavior.
- StateInspector supports gmem
You can monitor now gmem-states as well, which is handy for developers of JSFX and Video-Processor-related scripts.
New features in 4.00beta2.78
- DeferManagement: Defer - runs a deferred loop; you can decide how often it runs; allows you to give it a unique identifier to access, watch and stop it from anywhere!
better than Defer1 through Defer20!
Use this one, when in doubt! (requested by rstockm)
- Debug: PingMe - shows a message with the current scriptfilename and linenumbers of execution for debugging purposes, like hooks but "lighter"
- Docs: Concepts - added chapters EventManager_The_Basic_Concept, EventManager_AlterRetrieve and EventManager_Debugging
- ErrorMessagingSystem: SLEM - this works like ultraschall.ShowLastErrorMessage() but is easier to type.
- EventManager: EventManager_DebugMode - starts/stops the debug-mode of the EventManager, which adds additional debugging features
- EventManager: EventManager_DebugMode_UserSpace - allows getting the contents of the userspace as used by a registered eventcheck-function, for debugging purposes(DebugMode must be set to on)
- EventManager: EventManager_GetEventIdentifier - returns the EventIdentifier of a registered event, by id
- EventManager: EventManager_GetLastCheckfunctionState - returns the last state of the checkfunction of a certain event, by numbered id(requested by rstockm)
- EventManager: EventManager_GetLastCheckfunctionState2 - returns the last state of the checkfunction of a certain event, by EventIdentifier(requested by rstockm)
- EventManager: EventManager_GetLastUpdateTime - returns the last time, when any event got updated(requested by rstockm)
- EventManager: EventManager_GetPausedState - returns, if a certain event is paused or not, by numbered id(requested by rstockm)
- EventManager: EventManager_GetPausedState2 - returns, if a certain event is paused or not, by EventIdentifier(requested by rstockm)
- EventManager: EventManager_GetRegisteredEventID - returns the id of a certain event by EventIdentifier, which is the position within all currently registered events
- Examplescript: US_Api_Examples_EventManager_HowTo.lua - an example on how to add an event to the EventManager(requested by rstockm)
- Helper Functions: ConvertFunction_FromHexString - converts and loads a function from hexstring as generated by function ConvertFunction_ToHexString
- Helper Functions: ConvertFunction_ToHexString - converts a function into a hexstring which can be reconverted into a function by function ConvertFunction_FromHexString
- MIDIManagement: MIDI_SendMidiCC - sends a MIDI-CC-message to a device or virtual keyboard or Reaper itself as shortcut
- MIDIManagement: MIDI_SendMidiNote - sends a MIDI-note to a device or virtual keyboard or Reaper itself as shortcut
- MIDIManagement: MIDI_SendMidiPC - sends a MIDI-PC-message to a device or virtual keyboard or Reaper itself as shortcut
- MIDIManagement: MIDI_SendMidiPitch - sends a MIDI-Pitchbend-message to a device or virtual keyboard or Reaper itself as shortcut
- Project Management: SetProject_MasterFXByp - sets the fx-bypass-state of the master-track in a projectfile or a ProjectStateChunk
- Project Management: SetProject_MasterMuteSolo - sets the mute-solo-state of the master-track in a projectfile or a ProjectStateChunk
- Project Management: SetProject_MasterNChans - sets the number of channels and vu-metering-settings of the mastertrack in a projectfile or a ProjectStateChunk
- Project Management: SetProject_MasterPanMode - sets the panmode of the track
- Project Management: SetProject_MasterTrackColor - sets the color of the track
- TrackManagement: AnyTrackFreeItemPositioningMode - returns, if any track has free item positioning mode activated
- TrackManagement: AnyTrackFXBypass - returns, if any track has fx-bypass activated(optionally with master-track)
- TrackManagement: AnyTrackHiddenTCP - returns, if any track is hidden in TCP(optionally with master-track)
- TrackManagement: AnyTrackHiddenMCP - returns, if any track is hidden in MCP(optionally with master-track)
- TrackManagement: AnyTrackPhased - returns, if any track is phase-inverted
- TrackManagement: AnyTrackRecarmed - returns, if any track is recarmed
- TrackManagement: AnyTrackRecMonitored - returns, if any track is rec-monitored
- UltraschallSoundboard: Soundboard_Play - starts playing a certain player within the Ultraschall Soundboard
- UltraschallSoundboard: Soundboard_PlayList_Next - starts the next Soundboard-player-slot
- UltraschallSoundboard: Soundboard_PlayList_Previous - starts the previous Soundboard-player-slot
- UltraschallSoundboard: Soundboard_PlayList_SetIndex - sets the current Soundboard-player-slot, optionally starts playing it
- UltraschallSoundboard: Soundboard_PlayList_CurrentIndex - returns the current Soundboard-player-slot
- UltraschallSoundboard: Soundboard_Stop - stops playing a certain player within the Ultraschall Soundboard
- UltraschallSoundboard: Soundboard_StopAllSounds - stops all player within the Ultraschall Soundboard
- UltraschallSoundboard: Soundboard_TogglePlay_FadeOutStop - toggles playing and stop with fadeout of a certain player within the Ultraschall Soundboard
- UltraschallSoundboard: Soundboard_TogglePlayStop - toggles play-stop of a certain player within the Ultraschall Soundboard
- UltraschallSoundboard: Soundboard_TogglePlayPause - toggles play-pause of a certain player within the Ultraschall Soundboard
Changes from Beta 2.77 to Beta 2.78
- Configuration Management: GetIniFileExternalState - was missing retval in the docs
- DeferManagement: GetDeferRunState - gets now Defer-cycles-runstate, of deferred-functions, started by the new function Defer, as well
- DeferManagement: StopDeferCycle - stops now Defer-cycles, started by the new function Defer, as well
- DeveloperTools: StateInspector - supports now displaying gmem-states as well(hit g or look in the menu)
- Docs: Reaper-Internals - updated JS-extension to 0.995
- DocEngine: Docs_GetUSDocBloc_Description - didn't return right markup-type and version -> fixed
- EventManager: EventManager_EnumerateStartupEvents - was missing retval paused -> fixed
- EventManager: EventManager_EnumerateStartupEvents2 - was missing retval paused -> fixed
- EventManager: EventManager_PauseEvent - had typo in parameter-name, so it was ignored -> fixed(thanks to rstockm)
- EventManager: EventManager_RemoveStartupEvent2 - had wrong functionname in docs -> fixed
- EventManager: EventManager_ResumeEvent - had typo in parameter-name, so it was ignored -> fixed(thanks to rstockm)
- EventManager: EventManager_SetEvent - you can now pass nil for parameters, who you don't want to change
- EventManager: EventManager_SetStartupEvent - you can now pass nil for parameters, who you don't want to change
- EventManager: EventManager_Start - checks now, if EventManager-script exists and returns false if not; didn't unregister the EventManager-script again, after it was run -> fixed(thanks to rstockm)
- EventManager: StartupEvent-functions - had to rewrite the function-encoding, so StartupEvents must be re-registered by you to work, sorry for that
- EventManager: EventManager-script - returns now the current event-check-function's state and a debugmode
- Helper Functions: Base64_Encoder - was completely broken due "improvements" -> fixed now
- Helper Functions: GetApiVersion - put retval "number versionnumber" as first returnvalue, for easier versioncomparison(sorry for any inconvenience)
- RenderManagement: RenderProject_RenderTable - didn't return filearray -> fixed
|
|
|
11-04-2019, 11:11 AM
|
#343
|
Human being with feelings
Join Date: May 2017
Location: Leipzig
Posts: 6,345
|
further changes: - TrackManagement: AnyTrackMute - hadn't parameter master documented -> fixed
- Ultraschall.ini: CountUSExternalState_key - allows now to set a different filename within the Ressource-folder, other than ultraschall.ini
- Ultraschall.ini: CountUSExternalState_sec - allows now to set a different filename within the Ressource-folder, other than ultraschall.ini
- Ultraschall.ini: DeleteUSExternalState - allows now to set a different filename within the Ressource-folder, other than ultraschall.ini; didn't work for the last key in the ini-file -> fixed
- Ultraschall.ini: EnumerateUSExternalState_key - allows now to set a different filename within the Ressource-folder, other than ultraschall.ini
- Ultraschall.ini: EnumerateUSExternalState_sec - allows now to set a different filename within the Ressource-folder, other than ultraschall.ini
- Ultraschall.ini: GetUSExternalState - allows now to set a different filename within the Ressource-folder, other than ultraschall.ini
- Ultraschall.ini: SetUSExternalState - allows now to set a different filename within the Ressource-folder, other than ultraschall.ini
|
|
|
11-25-2019, 10:00 AM
|
#344
|
Human being with feelings
Join Date: Aug 2011
Posts: 490
|
Hi!
Trying to use ExtStates for the first time here. I think i am not getting it right though.
Code:
reaper.SetExtState( "menubox_EXAMPLE", "preset1", "a bunch of data", false )
number_of_keys, _ = ultraschall.CountValuesByPattern("menubox_EXAMPLE", reaper.get_ini_file())
Then when i print number_of_keys its = 0, while i thought it should be 1.
Didnt i just create a key value in reaper´s ini file?
|
|
|
11-25-2019, 10:02 AM
|
#345
|
Human being with feelings
Join Date: May 2017
Location: Leipzig
Posts: 6,345
|
No, as you created it in reaper-extstate.ini, not reaper.ini.
|
|
|
11-25-2019, 10:31 AM
|
#346
|
Human being with feelings
Join Date: Aug 2011
Posts: 490
|
Oh, so ExtStates have their own ini file. Nice, thanks.
I cant succeed with this either, though
Code:
reaper_extstate_ini_path = reaper.GetResourcePath()..[[\reaper-extstate.ini]]
reaper.SetExtState( "menubox_EXAMPLE", "preset1", "a bunch of data", false )
number_of_keys, _ = ultraschall.CountValuesByPattern("menubox_EXAMPLE", reaper_extstate_ini_path)
number_of_keys still = 0
|
|
|
11-25-2019, 10:35 AM
|
#347
|
Human being with feelings
Join Date: May 2017
Location: Leipzig
Posts: 6,345
|
Ah, I didn't look good enough into your code, the last parameter "persist" of SetExtState must be true for values stored into the extstate.ini.
That way, they are retained the next time you restart Reaper. If the last parameter is false, Reaper forgets the extstate you've just set after exiting.
There's unfortunately no way to enumerate or count extstates, that are saved with persist=false, so setting persist=true is your only option.
|
|
|
11-25-2019, 10:38 AM
|
#348
|
Human being with feelings
Join Date: Aug 2011
Posts: 490
|
It returns 0 with true as well :/
|
|
|
11-25-2019, 10:42 AM
|
#349
|
Human being with feelings
Join Date: May 2017
Location: Leipzig
Posts: 6,345
|
I'll check...
Edit: What do you want to achieve?
|
|
|
11-25-2019, 10:47 AM
|
#350
|
Human being with feelings
Join Date: Aug 2011
Posts: 490
|
I want to save presets for my script uisng Extstates. The structure would be:
section "my_plugin", key "my_preset" , value "preset_data"
I want to update a menubox object (from Lokasenna´s GUI) to list all of the presets (keys). Thats why i was trying to use your API, since it provided better acces to just the keys or sections, etc.
|
|
|
11-25-2019, 10:52 AM
|
#351
|
Human being with feelings
Join Date: May 2017
Location: Leipzig
Posts: 6,345
|
I confirm, it's a bug on my side, but have no idea, why... O_O
Give me a few days to fix it and to upload a hotfix...
|
|
|
11-25-2019, 10:54 AM
|
#352
|
Human being with feelings
Join Date: Aug 2011
Posts: 490
|
Allright! Thanks again
|
|
|
11-28-2019, 07:13 AM
|
#353
|
Human being with feelings
Join Date: May 2017
Location: Leipzig
Posts: 6,345
|
Hotfix 1: 26th of November 2019
Changes:
- API: Reapack-API-xml-generator.lua - didn't correctly create zip-archive of the API stored in GitHub -> fixed
- API: ultraschall_api4.00_beta2.78.zip - didn't include full API -> fixed
- ConfigurationManagement: CountValuesByPattern - didn't count at all(for some reason) -> fixed(thanks to (thanks to reapero)
- Developer: ultraschall_developertool_Display-Altered-Config-Vars.lua - didn't work with rc-pre-releases of Reaper -> fixed
- Marker Management: MoveRegionsBy - still had debug-code in it, which could display messageboxes and overwrite global variables -> fixes (sorry for that)
Please update your ReaPacks
@reapero
It should work now.
|
|
|
11-28-2019, 08:03 AM
|
#354
|
Human being with feelings
Join Date: Aug 2011
Posts: 490
|
Thx Mespotine!
Number_of_presets = 0 here though, with the following code:
Code:
reaper.SetExtState( "menubox_EXAMPLE", "preset1", "a bunch of data", true )
reaper_extstate_ini_path = reaper.GetResourcePath().."\\reaper-extstate.ini"
number_of_presets, _ = ultraschall.CountValuesByPattern("menubox_EXAMPLE", reaper_extstate_ini_path)
Am i missing something?
|
|
|
11-28-2019, 09:17 AM
|
#355
|
Human being with feelings
Join Date: May 2017
Location: Leipzig
Posts: 6,345
|
The function CountValuesByPattern returns the number of values, who follow a certain pattern.
Ini-files and extstates follow that scheme:
[section]
key=value
in your case
[menubox_EXAMPLE]
preset1=a bunch of data
It returns 0, as there's no value, which holds the string "menubox_EXAMPLE" in it, as value is "a bunch of data".
Look for "data" or "bunch", and it shouldn't return 0 anymore.
|
|
|
11-29-2019, 07:58 AM
|
#356
|
Human being with feelings
Join Date: Aug 2011
Posts: 490
|
Ah, of course! I guess i was confused a bit by the documentation.
integer number_of_keys, string sections_and_keys
= ultraschall.CountValuesByPattern(string pattern, string ini_filename_with_path)
Shouldnt this be better named number_of_values_found or something instead? Anyway, looks like ultraschall.CountIniFileExternalState_key is what i was looking for.
Thanks for the clarification!
|
|
|
11-29-2019, 08:43 AM
|
#357
|
Human being with feelings
Join Date: May 2017
Location: Leipzig
Posts: 6,345
|
Oopps, you're right, that is wrong in my docs.
Thanks
|
|
|
12-02-2019, 08:16 AM
|
#358
|
Human being with feelings
Join Date: May 2017
Location: Leipzig
Posts: 6,345
|
Hotfix 2: Arrangeview Snapshots
Changes: - ArrangeView Snapshots: DeleteArrangeviewSnapshot - deleted all Arrangeview-Snapshots instead of the slot-one and didn't check for valid value for parameter slot -> fixed
- ArrangeView Snapshots: IsValidArrangeviewSnapshot - regression, didn't return false, if no snapshot was available in a certain slot -> fixed
- ArrangeView Snapshots: RetrieveArrangeviewSnapshot - had inner variable exposed -> fixed
Please update your ReaPacks for this fix.
|
|
|
12-05-2019, 09:38 AM
|
#359
|
Human being with feelings
Join Date: May 2017
Location: Leipzig
Posts: 6,345
|
I'm in the final stages of the first "real" version of Ultraschall-API, which isn't beta anymore and would like to ask, has somebody of you found any problems with Ultraschall-API and Reaper v6 so far?
It should work and the only bug I found is already fixed in the latest but still, I'm not sure yet.
|
|
|
12-19-2019, 09:35 AM
|
#360
|
Human being with feelings
Join Date: May 2017
Location: Leipzig
Posts: 6,345
|
4.00 Beta 2.79: - "Yes - Owner of a lonely heart"
Has now 1082 functions, with 12 new ones
New in this release:
NOTE: There are some new features, who make use of Reaper v6-features. Please update soon, as Reaper 6 will be a requirement soon!
- Speedup when loading US-API
I made a modules-system, which speeds up loading and initalization as well as memory-use of the Ultraschall-API by magnitudes.
This approach loads only the functions needed by your script(used to load all functions in earlier versions).
The loading is now about 86% faster and memoryuse if 56% less.
And what do you need to do to make use of the modules approach?
Well, nothing. The Ultraschall-API does it for you! (requested by many, so hope, this helps you a lot).
- Marker/Region Extstates
Reaper 6.02 added some new features, which gives a unique guid for a marker. This again, helped me adding a feature I wanted to have for a long time: Marker/Region Extstates.
They work like regular ProjectExtStates, but have the benefit, that they allow saving additional key-value stores associated with a certain marker/region.
And even if you change the whole order of the markers, the extstates will still be attached to the marker of your choice.
Possible usecase: storing the render-format-settings as region-extstates for region-rendering or simply adding additional metadata to markers/regions, that are needed but would spam the markertitle shown in the arrangeview.
Experiment with it, you'll quickly get the idea and ideas for practical usecases!
- Blitting an image centered
Sometimes, you want to blit an image into gfx-windows centered. Problem is: it's not easy to do. Until now, as I added the function
GFX_BlitImageCentered, which does exactly that.
That means, you can pass to the function the position of the center of the image and change rotate/scale. This makes zooming in and out of images much more easier, as they stay at their position.
- Subtitles SRT-import/export
You can import and export now SRT-files for subtitles. This should allow you to use regions as subtitle-feature.
- ConvertStringToBits and ConvertBitsToString
This can be helpful, if you have a string, which represents a binary-number: Just convert it with this function and voila, you can work with the bits themselves.
And if you need to do it the other direction, use ConvertBitsToString. That way, you can work easily on a bitlevel, if fiddling with bitshifting is too difficult for you.
- Bugfixes with ArrangeViewSnapShots, Markers
Should now work like a charm.
New features in 4.00beta2.79
- API: loadspeed - sped up loading speed by 86%, as API will now only load functions, actually needed, not all of them; memory need is reduced by about 56%.
- Docs: Reaper Internals - updated to Reaper 6.02
- ExtStateManagement: GetMarkerExtState - gets an extstate from a specific marker/region
- ExtStateManagement: SetMarkerExtState - sets an extstate for a specific marker/region
- GFX: GFX_BlitImageCentered - blits an image centered at a given position, to make "zooming"-effects easy to produce
- Helper Functions: ConvertBitsToString - converts a table with bits(entries with 0 or 1) into its string-representation
- Helper Functions: ConvertStringToBits - converts a string into its bit-representation
- Markermanagement: GetMarkerIDFromGuid - get the markerid from a guid
- Markermanagement: GetGuidFromMarkerID - get the guid from a marker
- Scrubbing: Scrubbing_MoveCursor_GetToggleState - gets the current toggle-state for when scrubbing using an action/surface
- Scrubbing: Scrubbing_MoveCursor_Toggle - toggles the state for when scrubbing using an action/surface
- Subtitles: ReadSubtitles_SRT - imports a SubRip-srt-subtitlefile
- Subtitles: SaveSubtitles_SRT - export a SubRip-srt-subtitlefile
Changes from Beta 2.78 to Beta 2.79
- API: Reapack-API-xml-generator.lua - didn't correctly create zip-archive of the API stored in GitHub -> fixed
- ArrangeView Snapshots: DeleteArrangeviewSnapshot - deleted all Arrangeview-Snapshots instead of the slot-one and didn't check for valid value for parameter slot -> fixed
- ArrangeView Snapshots: IsValidArrangeviewSnapshot - regression, didn't return false, if no snapshot was available in a certain slot -> fixed
- ArrangeView Snapshots: RetrieveArrangeviewSnapshot - had inner variable exposed -> fixed
- ConfigurationManagement: CountValuesByPattern - didn't count at all(for some reason), errors in docs -> fixed(thanks to reapero)
- Developer: ultraschall_developertool_Display-Altered-Config-Vars.lua - didn't work with rc-pre-releases of Reaper -> fixed
- Marker Management: AddCustomRegion - was expecting length, although declared as regionend in the docs -> fixed
- Marker Management: MoveRegionsBy - still had debug-code in it, which could display messageboxes and overwrite global variables -> fixed (sorry for that)
- Marker Management: SetCustomRegion - had docs of AddCustomRegion -> fixed
- Project Management: GetProject_MarkersAndRegions - supports now guids of markers and regions, as introduced in Reaper 6.02
|
|
|
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 08:34 AM.
|