As mentionned in the name of this topic, I'm trying to create a custom wrapper in order to switch patches thanks to buttons and a lcd screen.
- I don't need anything but the analog/audio I/O so I got rid of the rest (the hooks, the midi part...)
- My LCD code is working perfectly (apart from the delays which need to be optimized so I plan to publish it when the corrections will be done since I've seen that there are several topics about that)
- I also created an auxiliary task for the menu which is also working fine
-I code in French and pretty dirty sorry about that... but I tried to make it look better for the part relating to this topic...
Here is the code :
So I assumed (wrongly as it seems) that the right steps to follow when switching patch were those :
1 - disable the render loop
2 - turning off dsp
3 - closing patch
4 - checking if everything is fine with the new patch
5 - turning on dsp
6 - opening the patch
7 - allowing the render loop to process
But here are the issues :
- First I get 1 to 4 blocks drop (underrun detected) + a mode switch on audio thread when switching patch
-The real issue : the first patch opens and plays nicely but the next ones open but don't play any sound even if I reopen the same first patch which was working to begin with...
-When I stop render.cpp from running I get this error : "free(): corrupted unsorted chunks: 0x008b4088 ***
Some thougths about it :
-Is there an order to proceed closing/reopening that doesn't drop blocks ?
-Does libpd.closepatch() close more than just the patch ? Do I have to re-init libpd ?
Thanks a lot if you read it until that point (and sorry about my poor english...)