Device restart after patch loading

Hi,

When I try to load some self-made C++ patches, I get my magus restarted and no patch stored.
Do you know what could be wrong with these patches ?
I can upload a patch if required.

You certainly should upload it. I would suggest to check that your buffer allocation if you’re writing in C++. Or you might simply using too much CPU and device hangs.

Do you get an error message sent over sysex?
Please post a link (to the patch library) then I can take a look

How sweet, a competition in response speed and I’ve won it!

It’s this vocoder I try to adapt from a bela user.
No error message.

Ok, first of all you don’t need to use ugly things like malloc, this is C++ and we support the “new” operator obviously. So:

	a =  (float*) malloc(nsamps*sizeof(float));

could be just

        a = new float[nsamps];

It’s not the problem here, just looks horrible. And add destructor for your patch to clean things.

You should probably comment out most of the code and see at which point it starts to fail. Or try less bands, I don’t know how much load current code generates, but Bela has a way more powerful CPU.

If you have missed this, it’s possible to build native patches now - so you might be able to use that for troubleshooting, maybe even debugging will work.

Last suggestion is to become Martin - his patches don’t have any bugs apparently (he said that, really).

Actually, looks like the patch isn’t broken, it’s just exceeding current OWL’s CPU. I’ve tried it on a more powerful device and it runs!

It might work with -O3 build, or with some extra optimizations.

I thought we don’t support malloc?

At least we define it and use the same allocator - OwlProgram/basicmaths.h at master · pingdynasty/OwlProgram · GitHub

I don’t know how broken it is, but the patch was running on Daisy. 29% on H7 should be slightly above F4 performance. But I wonder if we can have a more graceful way to terminate hanging patches.

Ok I was assuming I’d have to rewrite it. wasn’t sure about malloc…
Thanks

Will try native patches asap ! Sounds like it’s going to help.

Yes right so we have a malloc macro in basicmaths.h, so as long as you #include that or Patch.h it should be fine.

The patch runs okay with 8 bands, at 85% on my Lich.