reaper-oss / sws

The SWS extension is a collection of features that seamlessly integrate into REAPER, the Digital Audio Workstation (DAW) software by Cockos, Inc
https://www.sws-extension.org/
MIT License
448 stars 85 forks source link

FR: "check if it's a valid one"-function for FastStrings and BR-Envelopes #1032

Open mespotine opened 6 years ago

mespotine commented 6 years ago

Almost all datatypes in Reaper are checkable, so when I write a script or a function, I can check, whether an object is a valid ReaProject, MediaItem, MediaTrack, etc.

But I have no chance to check, if an object, given to a parameter, is a valid FastString or a valid BR_Envelope. So, when I give a function, that expects a BR-Envelope something else, I can't check and take appropriate action. Instead, it will produce an error, stopping execution of a script.

So I would love to have functions, with which I can check, whether an object is a valid FastString or a valid BR_Envelope and return a boolean, true(valid) or false(not valid).

cfillion commented 6 years ago

I think it would be better if REAPER extended it's own ValidatePtr to check extension-defined types. This would at the same time allow for runtime validation of custom argument types with much better error messages for scripters.

reaper.BR_FreeEnv(reaper.GetMasterTrack(), false)

^ This currently runs without any error.

EDIT: https://forum.cockos.com/showthread.php?t=208823