Open file via midi crashes Max

Florent Ghys's icon

Hi there,

I am having troubles trying to open and close patchers from external midi controllers.
I am using the message ; max openfile and ; max closefile. They work fine when I click on them with the mouse, but when a bang arrives from a midi controller, Max crashes.
I have tried a FCB 1010 and a Launchpad. I have also tried to add a delay 1000 to the bang in case, but no result.

Max Patch
Copy patch and select New From Clipboard in Max.

Here a sample of the patch I am using :

Should I use pcontrol instead ?
Thanks a lot for your help.
Florent

Chris Muir's icon

Have you tried throwing a deferlow or two in? The idea is to get the control of file IO stuff off of the scheduler.

Florent Ghys's icon

Thanks a lot Chris !
deferlow solved my problem.
Not sure about what it does exactly but it makes my patch work.
This is great.