Engine.loadUserPreset() doesn't work in Logic
-
It seems like Engine.loadUserPreset() is broken in Logic. In every other daw and format this works but in Logic it doesn't do anything.
Been going a little nuts on this one.
HiseSnippet 1301.3ocsVsraabCEkirG2ZkzllhrpqF3UxEFt5gel.TaKKqTgX4HX4j1Bih.pgbjHzLjBjbrshqAxh9AzujBz0cQ21ei9Gzcco6kyLRZjrheHfNKj88EuGd4gWdaHEtTkRHQVYOoeOJx5w1M6y0c1uClwQ0pXTbnnMy04DpRiJ2uGVonDjk0buz3g0hyih99mcJi8wbW5HUHzaELW5gr.ldj1F69JlueULgdBKHk2qsaMWAeeguHDPyb14Q8vtcwsoGgMtkwF8cXUGj0WaWzqkaQuMKsUgsKr8lqscgBquUq0xWzkr91kJsQIhWwsvarEDzBGPXZgroFqoJXQKKH8a1QbNONAukoXs7oFgBnlPliUi1uCymzXPoQgPVy2XTgZt3B0yrqyHrg5GUv9hHCNihHcQyJysAoBO.HYkBRyGComZ2zUx5oGYwfmGYWiqoROLb1jFJw9hxDXYuu.7fqWM.2kVUBBCiH2F4yuhC7yxuHaVF2mwoNdgbWMSvcD7xgZsfWvDuT3myUDzSvgUZEmyv9gzkydY1EOf2FhZUeAl7FEU1PRUTctkL7ouw7SgU6EoZIHEWAYY.XZS06OX8xsTRlVZ4UUF8Q4aerueKfjjaRfr7KRgwiDZ5q44hvR1qx5LoIOuoZKYo7oxoZ1Pdk2Vf43gAsnxzUBiivg03LfEteL.23pRJGE7Zbl908nIxUE9DyIq4+uIeAkTVMLmDDBtpi3MedBuooOiPkHFrHeh8q3hVEPQfO8UZzapUAqwCVFXEgrziJ0LylwpB8L3JeLcbQ6JTUWsnGjngmjPilwSZ7IWTRWzN4XDcQ5T1ejvOtqldArFekcEAU4n6vTNmKjccXbmn1T6fT3yn03wrLCM+bFQCsMrs9KH9NTV6NZiDAjnbLToM2VOjhkbi2LUcQ..SrDxpUFTJb+36rXkB0e6t8S2ZSo6aNRWHxQT.iP7oMDJlgxjpG5epzzdMYuOphe4y9sW92u+W1IHcaVDJ.eQ5ttpPOO1EQ8G8X9AJMfsZAPaSj0WZC22bHTObnu1Q0EVG39aWJ4DQj+o2bORmzTKdyUEtspY71mv.Xa1hOwNspza0OzM0V8Cmt6v58OaktduAH0p8f16Kt.37+ZhfooAiz96W+qWOt1hING8kv3hoWOwN9PtrTbNzWAEQKy7GYruLqiyRlKJMApPLiZom6nkgzUFX4fK5g4Jn3q1SA4ILv3gG1WMxknqSxoGtoug5FqIbsN18wLMRMzowzl64NExOLn8HjomhiAxYvGA8Un9T8GwVSfI61oLVNogp3yDRntZdkMsspg99Mv5NCrqFqRjrgpAEKBsrPBkjwreTXPb8yDVwHUwxeugFbLvXDfgSA8NN4WszDeq7.0Cp+onbbHSo2SRwCKoIYXko8mgQEiriEm2.SH.U99F2vZZYQHmX1omFantPlbLLokQTuIsLnNeCqYuBFN5FuoCSSHHg9X83iXXF9JwfoER520MucCGW59oaS7.l6H+sN2w8EhO0tAS61Y5XLyTvH7hx+GXLYZsOy9.OOpqdD.m2t5OLqilcGo+XQnoSYcLzLFZTZCWRZBsxboP14bpuxzPLioeVrbdiroBzjxIQBWCeIFKXjsRLVXfQ3Y.Wo3ctwujalG7Siz.XhGMu7h10MxNS4Ib34G16bcGeotQfEm0.KMqAt1rF35yZfaLqAt4rF3V2cfl4Q1KTKBhu1fP0abPzaaVVGDMvRDaE8efffMCF
-
@whoopsydoodle Try passing a file object instead of relative path.
-
@d-healey negative. I had high hopes this would be it. But same result.
reg file = FileSystem.getFolder(FileSystem.AppData).getChildFile("User Presets/Test/Test1.preset"); inline function onButton1Control(component, value) { Engine.loadUserPreset(file); }; Content.getComponent("Button1").setControlCallback(onButton1Control);
This also doesn't work in Logic. Again, seems to work everywhere else.
-
@whoopsydoodle Isn't it
UserPresets
? But you can useFileSystem.UserPresets
Edit: You're right, for expansions it's "UserPresets" but for normal projects it's "User Preset", weird.
@whoopsydoodle said in Engine.loadUserPreset() doesn't work in Logic:
Again, seems to work everywhere else.
Is everywhere else using a VST3? Have you tested the AU in Reaper?
-
@d-healey I've tried the AU in plugin doc, bluecat patchwork and ableton
-
@whoopsydoodle Ok can you make a minimal example to demonstrate the issue that project that I can compile and test?
-
HiseSnippet 1262.3ocsVEtaaaCDlxIZa1sacEX+dPv+xYvvyR1I1tCa0wI1aFMt0HNsaCECEzRz1bQhTPhJItc4e6gZ.6AXOG6MXuAaGEksjbbV6BV0OrAui2ce7i2c7FGvsIgg7.jVoyV5SPZ2WexRlXwQKvTFZ3wRAmvmSsMNiDJP8V5iCCINHMsc9V4NzJtKJ96udbOrKlYSREgPufSsImP8nhToi69Dpq6.rC4LpWlc2r6PaN6HtKOBPyN50Q9X6ywyIOEK2VAcz2gCWfz9BcqYSssl0pQayNlcZ0rio49sm1rtksy9cZz3fFNyrZiOnMXzGz2gJ3ASDXAIDosaOtyxIK3WxTA3EzP5TWhbgIZBDYk3AbWG4QTJEczBpqy3UzTHB7x3TRaGEo8Y5inNz0xSIuOMVgQpEYIPsB4g2N4fmYV3UOC71Bjzx.ocUP5g5SrCn9hTMR7bO8gLAIXFFtmxBE0dQE9CM8i3vNXhZd3yICBfEqsnxA0qW0.9YuupTo.xbiYTWhwWaL.9axxPAwq1bhHl8BpjQ3g99GiE38jZiwtTWkxOOjD.LCIjHB+RY1U7Ol07iEUVFDJykxHFyhX1BJmYvY8hDBNyTBx.taEatmOmAvspwEX2HxdkdSohkJ1mMGrqlKG6HihJHUjvE750fiWcHkHZkKpTNw4k2qVnTdbHNB65NERDqrYrk3KCvdJWPdFqhB.WWxXSUylsUcINyEXrsoVVhD7uYXEVj2TRPtiOrQHMHetk9smakM02VwKY1HmMjQEOymvtsBBTBYJyCSPErUQbV3mjjENwkBIEHJjr8g5OgwmZhhAb1lEnmOTllrxMfGgn3SBDT4AP6XxEPyDUxcQ8iIgmK39PfVe+AsvxGT08UbPKpmb4gtZcH69ycWlF+uoqfbkP0tC6D2syDEhufLjoReTDzkTGAzDRW6WzPnED57EB4pOG7.ggAFUVueBAGjzhgFNh6AfCGrbE+khW82JIcUV.tLayRnxxeB80qXvt+4q+0Gm022SjzYR46APsffxleFTCDGgGnmUTtH8iYijS20G4eK2QtJrZ57U8quudSylM5zxpw9VHJT0mQgU6VGzwpkkYFEVJ5I4hVcq9.cES2KfeIT0hhyFJ76EzeSICixxbxIv8g5hr7iLDAQjpqzz+JeLKDJMBOLDhPjmbGyvtgoaQ0XZ6lKKQCugOgJH01yoJULTTK6T8HCy5qM5PGmsGhSg7CuaA8GSbIhaQ2DHYxdQObvlJFfufG.Lp7Yyr5FD45NFKVrReXNlH4.MDHKGROd.PI4z+zHOE+IMyJVjZ82KSCNExX3fhWBxMLpWqwFeU+OJGD+Sww3DZn3v.BdMklDgpa6u0VoP1o7KGicbfT42U6Vyo83QLG4I8kJEi3AIWCapIM0aSMq34ansz0vzN23gYXj.tSjKVjeNA4zTIJfr3bONKe.FttDKyNs0+aCO7tBwGpOlJrWrcLVXKXDZj+9.iIib8w58mMiXKRA3t5C9g2OyWgNkGI6TNBKBnPiRcnHYBzDyl.QmwHtxGX0JHeJTsttbsjAlPXNwK9a3KQoobsVhRyUJQdX6.9qrUOfJGp6ihk.XhEO.bQ8Qx0Fa4kSO3MmWYam2U2vPq6pgMtqF17tZ392UCO3tZXq6pgse6FJGI3vHA2SU1fPiF2O9sMMs9wyLDmsh9Gfh5DmO
This one is with the object, the snippet in my first post is with it trying to load from a relative path.
-
I've now gotten further confirmation from someone who is a long time Hise user that this has been a bug for a while and to complicate things further, sometimes it works and sometimes it doesn't. Some users have the issue, others don't.
I am not sure if it's possibly related to what version of Logic. I have one person who is on the latest version who says they don't have the bug. Another person says they do have the bug. I'm waiting to hear back what version of Logic that second tester is running.
-
@whoopsydoodle I just made a test project and it's working here.
It's based on your snippet but I made a couple of adjustments - I don't think any of them will make a functional difference though.
I use the
FileSystem.UserPresets
constant.
I moved the file into the inline function
I add a check of the button's value so we're not triggering the loadUserPreset call twice -
@d-healey haha. I don't know why but that project fails AUval here. It won't even load. I even tried changing the 4 letter plugin code and it still fails.
I tried taking your code and putting it into my original test project and it compiles and loads fine but still doesn't work.
-
@whoopsydoodle said in Engine.loadUserPreset() doesn't work in Logic:
I don't know why but that project fails AUval here
That's a mystery to solve.
@whoopsydoodle said in Engine.loadUserPreset() doesn't work in Logic:
my original test project
Send me your project and your compiled AU
-
@d-healey DM'd
-
I've done some extensive testing now.
I didn't realise you were exporting as an effect plugin. I was testing an instrument. I tried an effect and I got the same result as you. You should make a bug report on github with a link back to this thread.
The script you sent me from that other developer is using a broadcaster with a delayed listener to load the preset. I tried using a timer to see if that helped but it didn't.
I recommend you try and copy their setup and see if that solves it.
-
Wow, how annoying, apparently it needs to process the audio once before it can load user presets. Can you confirm that?
- Load an instance of your plugin, but don't start the playback
- Try to load the user preset through the button. Doesn't work. Load it through the preset browser => works.
- Start playback (it must have a clip under the transport line so it actually starts processing the plugin
- Stop playback. Press the button. Now the preset loads through the button.
The debugger shows me that it gets stuck at an initialization check before executing the script. There are a few safe checks in HISE that handle script execution differently if the audio engine isn't initialized yet (mainly to speed up the loading time when you first run all scripts on a new plugin instance), but Logic seems to mess that up (again).
-
Found it, it was actually a failsafe that should guard against recursive loops when you try to load a user preset in the onInit callback, but that caused Logic to skip the preset load when the audio engine isn't initialized:
- fix Logic not loading user presets before the audio engine is initi… · christophhart/HISE@04bf696
The open source framework for sample based instruments - - fix Logic not loading user presets before the audio engine is initi… · christophhart/HISE@04bf696
GitHub (github.com)
It should work now correctly.
-
@Christoph-Hart thanks for tackling this issue so quickly!
Tested as working on my end.