Old project won't open in latest build
-
Do you need classes to sort your functions (like the
ui.knob()
methods) or do you want to access object properties viathis
? The latter could be also achieved by passing the object as parameter (this is how you could do object oriented stuff in C):inline function setInvisible(this) { this.set("visible", false); }; // Usage setInvisible(volumeSlider);
If you just want to categorize the functions, I am thinking of adding a namespace keyword so that you can do stuff like this:
namespace ui { inline function knob(name, x, y) { // [...] } } // Usage ui.knob("name", 20, 20);
The compiler can resolve the dot operator at compile time to the function pointer so there's no overhead compared to plain inline functions (unlike using functions from actual Javascript objects).
-
The organisational aspect of it is helpful, especially with things like the UI library, also having access to
this
is helpful, although not necessary in the case of my UI library. For my mixer channel library it's important that it's a class because I need to be able to create multiple instances of it - one for each mixer channel. The namespace keyword would definitely be useful for building libraries that are going to be using a lot of inline functions. Would it also support namespaced variables? -
Yes, that could be possible (I have to think it through a little bit).
Why don't you do something like this with your channels:
inline function createMixerChannel(index) { local Panel = Content.addPanel("Channel"+index, index * 20, 0); [...] // JSON stuff and callback definitions return Panel; }; var channels = []; for(i = 0; i < channelAmount; ++i) { channels[i] = createMixerChannel(i); }
-
The channel class I've created is more than just the UI it also houses the mute, solo, purge, change volume, change pan, and change width functions. It makes it really easy to do something like
channel1.solo(true, mixerObject);
and this not only solos channel1 it also mutes all the other (non-soloed) channel. I'm not sure this sort of functionality could work as smoothly if they weren't part of an object. This sort of thing though will run in the message thread so I don't think it would be too much of a problem. -
Using a combination of the techniques you've presented I think I've actually come up with a way to create my channel class with inline functions and it should be much more efficient (I need to do a little more testing though to be sure). The name spacing idea would definitely improve the categorisation of the functions though.
-
Great to hear. BTW, did you know you can define parent components (it will use the coordinate space of the parent and will be invisible when the parent is hidden)? I can imagine this concept could also be helpful for your channels:
HiseSnippet 801.3ocsU12SSCDF.+51ZBTcDw3Gfl8Wij4ncLdIRLBavzoxXwRHlXL3Q6M5EZuq45UvIguy9IP8t9BsCJHyDujkt64s6We5877LlQsQggTFP4IGMM.ATdpp0TB2suKDS.C2Cnrj5AvPNhomHp2z.XXHxAnnT8sRAJKVCDu94a5A8fDaTtH.3XJ1F8QrOlmK8a67Arm2.nC5HreAq6tyPaJoO0iFI3oppAH.ZeN7LzHnzrJpfKvnKCAJFpq0oM6byS+wtskqdsyV60trEvNhwPD9wB2AJpJ+VrTT22AyoLKNjiDwrZOpyTKW5kjji9XbH9TOjbiIvRvThXPeWrmy3rzVH.nTabdRrZRR7EpGfcv2HOOY9rXE54dTLcpTYVjpMCRl2GRCndNx.bO3oT.uZI3srpkMCGvy0HY64oRuG5RTBp7KE09TBWjNaGh3uCgOyk2rigwJaWWSS78KjqeAjoOFRPd5uVOyVniSrnlMheznkdmtq0Ru65qrs1pqp+k2ac3nDm9pVg3KXI.w3XT3.F0WZTd.tptltdiKwNb2FuRuyVcaEKvMFIgDSiMqqccZ7Ws3AjiYuHNmRlkyDYMaj7TbPlaH9MCnIp9qjdSDRPM.JuE1m5GPIh+HPL8c41XlF9IQDaNVfGkLhxQGRZth1UZKpcs1s0LYRYpjzwnddHVYZkEerGvsljH+SQrVh7jWDJyNw8rYukp83tkl8JbX.J0vaPOSjznbjKJMF0RLKWjcxGhBEvTxPBlmeb2sz.j90SVjjFPgo73RjkRKFR9R.vhRfETS2DmOJ1jCb2RLQgN0IxCxms5W1wLUgHWOS80PIKgX9zhcTmiVBFk1Rnz26GItKqNFyscKm2JkvqHQ9+l2zFr0U2exDjMOG1ZpC97+Z2z4.kOQi3XxYG.4L72EyRFE4aIFWYiDjPDkxgx4KUj2sR1aH2KyLVHhiQ1vmTklx8JoJMyTB7g1L5I1I2HksvWHVhfIR7fvEESjE60MytIJ41WLW4DaaYh3kBxK2iNysGqM2dzct8X841iMlaO1bt8XqGvC4P7ci3T+jxB.3OPOHq3M
-
That seems very useful, I can thing of several situations in which it would be helpful. Thanks!
-
I have another preset that won't open and crashes the latest build (github build). It's strange, the autosaves won't open either but I have a backup I made that does open.
-
Hmm, I can load both patches with the latest version - but I don't have your external scripts, so maybe it is crashing the scripting engine there.
Does it crash on load or do you have to press a key?
-
Aha! I just moved my external files and it loaded up no problem. It was crashing as soon as I opened the preset, no clicking on anything. So my next task is to narrow down which file is causing the crash and then which bit of code.