inline function
-
@ulrik said in inline function:
@MikeB Your "data" return undefined when called in
setControlValues(data)
yeah -- its called from the function I list above. where he's trying to pass in a "preset" but he never gets one...to pass in.
-
@Lindon -
so hes calling a function in another name space...
using this:
local preset = PresetHandler.loadPresetFile(items[value]);
which calls this:
inline function loadPresetFile(presetName) { Console.print("CAllING LoadPresetFile"); local presetFile = FileSystem.findFiles(getPresetFolder(), presetName + ".preset", true); //return presetFile[0].loadAsObject(); }
which never returns anything....and presetFile is empty anyway...
-
Background info - THIS is a snippet from Casey Kolb from last year.
It worked wonderfully.
Now it doesn't - without changing anything in the script.
Or rather, the "var" has been renamed to "local"!
Of course, your preset list is empty. The presets are not transferred with the snippet.
If you turn the knob in the interface and press the button and then press the button "save preset", a preset is saved. If you do this again, a second preset is saved. If you now switch back and forth between the first and second preset, HISE crashes completely.
HiseSnippet 3011.3oc2ZstbaabEFzRHiIsjskimz9iNcvnoSKUiJMAEkHY7jZpqwpVWXEkUbqqiMDvRxMBDKL.njky3o9EoyzGi9ulGg9Hj+z+62f1ytXAwhaTvLNYZJmIJducNemyd1u8rK1NNDcjqKwQpPwiuzFIUXN4tWZ4MXyAZXKoc2Rpvcj63fbQda3PtvE477ppRaboslqKxPpPgY9BZ+JTbVI1u28fMzL0rzQgUIIcBAqi1COD6EVam1OBaZtilA5X7PgdWu8t5DqMIljQ.llQtpjsl9YZ8QGnQ610jkJ7Qaaf8HNc8z7PtRElcChwkcGPtvxu+mfcwmZhnETk5BBxu5cHlFTDSqUZyAXSiNA1tqjTA4NgdhY78D2UderAdb8gdjayZPIbDh9iBWKJ7lIB7TEgWUA3kBjtl.jl0GRKH2U2Aa6E1BEO2PdWKOjSOMvsKBE+9Jcs+1sj2j.8vxqxPsyP63.EFOhxqUs5xJqVs5R2uTo6cOEZOcHltJdDkSQJtZmiLTvVJ1rffRvjiqmx4ZNJcMw5mA+w.4n74JAJnOxaSxPahETn7hB8YQP9gCdCj1HObuQlaLxyiXko.h0OpPXnbKTOrExUQyzTQO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b7A+c1oeYwBWixu4WtJsrO4nkAqv+A9waTkVt.uQ0fF+QQGC0zcHOO3Q8BSPWmUCX2Vrm.dQ48okUTGm8ub0JUkFBLbOWWm5h+c.gY5io1TLlUlhwTeJFypSwXVaJFSioXLMm3Xnatr9HOxP+kbPEc1l8EcKTv+ferHco+KHjkgZH
-
@MikeB
Of course, your preset list is empty. The presets are not transferred with the snippet.-- yes so I loaded the snippet into a product with presets - to avoid this issue... so your problem is here:
which calls this: inline function loadPresetFile(presetName) { Console.print("CAllING LoadPresetFile"); local presetFile = FileSystem.findFiles(getPresetFolder(), presetName + ".preset", true); //return presetFile[0].loadAsObject(); }
-
@MikeB Please you use code tags for your snippets, it will make them a little easier to copy and take up less vertical room.
-
I have known this for 3 days - I am shown that the problem lies in this line!!!!!
It doesn't help if you point out every time that this is the problem.
The question I am asking here is not WHERE is the problem BUT how can I fix it!
-
Did you try returning a value from the function by uncommenting
//return presetFile[0].loadAsObject();
? -
-
@MikeB That error implies that presetFile is not what you think it is.
Use
if (presetFile.length > 0)
before trying to load it to make sure a preset file has actually been found. Also if you only want a single file and you know the name of the file why not use.getChildFile()
instead offindFiles
? -
It is supposed to be a simple preset browser with no frills.
There are no examples except this one and it doesn't work anymore and HISE hangs on it all the time in the latest version.
Now the professionals in HISE programming have looked at this and have not come up with a solution.
How is a novice programmer supposed to achieve anything here?
Everyone here says - very simple, build your own sequencer or your own preset browser if it doesn't work the way you want.
Actually, I just want my arpeggiator not to stop running when I change presets. That's all.
SOLUTION: own sequencer (there is no description whatsoever, let alone a snippet)
SOLUTION: own preset browser - there is this one snippet - which no longer works today.Translated with www.DeepL.com/Translator (free version)
-
@MikeB here:
HiseSnippet 3271.3oc2as0baabEFTRnSD8kX63IsOzoyNZ5zRUqvPPQIRFOol5Zrh0EVSYG2llXCArjbi.wh.rTxLYxz7So+E5a8sleB8mPdou6+AsmcA.whaTvrIoIkiMGu6d1y46bYOmCVB20kZf87ntJkV9zINXkRWWs2Da1vcFpSrUNXWk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IWSkyAAVlOTbKAC5cNIGXHNPeklCfKPWyOBOw6+FKBnLNXr4iromkjA+lzViaEv.Hl9L51zWF9vS3OeLFJbMc5hqPwR1ehACNB7X9Owv7oMKCOTFzkhEd9hvtl5d17l9NkfmkJrT7GgwW9c0MNWvj6BliQjSgi7RKjfa2sC+1rTJ82T0p2pZ7OG2E9Z8paAeu6tvWOiO9gawGuGe7S6V8+ceTJtU3oXKpAgMIeqPmDVg9WrMnka+HPKena2ziqJF27Cgw1eNe86wG2lu95i+gbbgsB2Q8Pr8.1v7sAu5ejvFbNWFOkqiOi18GwiUJVxgaqtyPcanezdXKwkoWfbCYxnet5IiYNiYeGwtaqdT28fpftgLLUFiBl86M4LZOaybXSsBcqjA8njVWR+d8cK0inl7eh33ulg72sxfE3MLJWym+96YCMRNQlyem8tGVTHda0tDlwvrw3BYfQ9cB+8.Fm10zd86CQPQ.bI08e12Oudlxh+l9hGJ6RfBD7WeVgveawXzGw6.7Cv1X2zstE+sm8eVz2dVmB+1y5W88TWcaOGpWLFGVQySdxm3g22E+4Ol6MkmeGptalK8pGrOnjYtmd5rwthvhsFQGaGh+W72+U+qGjrm0kJVOqWwaw6R+n6s38m.G1KUpap2BbHqHYjiEdO6KfJ9vL9uI36h6qO1hENa7X4in1TmgTahgbPviwLWxfAXWYrmoBsEiwqkJ0O0ig5A5xAs+5NGBAa5tfcBOm1BshaKlk+5Wn5CWD+.H5mtIoW7+uSR+X5XFwdvQ5PPH7X+hmTDxMBOUiekc9uDZoE3427GWiO1O4nsoXv+F9DrnFebofE0BW7GDYLR2vk97v2zcvA8FhY.81V7+KhkUOhOFoE1tgpZsp0TFAY3dtgA2D+NPByr2S84XOqOG6owbrmMli8r4brmlywdZMy8vKtr0XFcj+QNXht6I9EnKUx+4QEQ5J+G.obBkgB
Theres a ton of debugging statements in there to show you how to find out what went wrong for your self - maybe try and follow this approach -
This fixes one and one only of your callbacks so it works - you will need to go through all the others working out what gets sent in and what comes out...
-
There is a preset file with the following content!
-
@d-healey said in inline function:
@MikeB That error implies that presetFile is not what you think it is.
Use
if (presetFile.length > 0)
before trying to load it to make sure a preset file has actually been found. Also if you only want a single file and you know the name of the file why not use.getChildFile()
instead offindFiles
?it isnt because you cant say this apparently:
local presetFile = FileSystem.findFiles(getPresetFolder(),presetName + ".preset", true);
instead you have to say this:
local tempName = presetName + ".preset"; local presetFile = FileSystem.findFiles(getPresetFolder(), tempName, true);
-
I just tried loading the snippet Lindon posted and it seems to work just fine on my system.
You need to add more checking statements to validate that the data you are expecting at each stage is actually returned. Currently the script has no checks and just assumes that all data will be there and will be correct.
-
@Lindon Working here with
local presetFile = FileSystem.findFiles(getPresetFolder(),presetName + ".preset", true);
-
@d-healey -yeah well that was essentially the line I changed to get a file back - then passed the file back into his function and loadAsObject() there... and as you say it now works.
@MikeB - what David and I are both saying is in order to proceed and improve you will need to learn how to debug your own work - theres plenty of examples in the snippet I posted above to get you on the right track.
AND: you need to type check/safety check your calls - make sure you are getting back the object type and values you think you are... As you will see that roughly all I am doing in the snippet I posted : checking what has arrived and what is in variables at each step along the way...until I track down what the problem is.
-
-
@MikeB its actually late afternoon for Dave and me (we are in the same time zone..) - keep plugging away at it.
-
@Lindon
Funny, somehow I sent you to Australia :-)
But you are both in Great Britain....and it's tea time there and coffee and cake here in Germany.
-
@MikeB said in inline function:
@Lindon
Funny, somehow I sent you to Australia :-)
But you are both in Great Britain....and it's tea time there and coffee and cake here in Germany.
Well I did live in Australia for 25 years...so maybe I seem Australian....