Audio plug-in in DAW reinitializes my arrays everytime I press play?


#1

Hey guys,

I am developing an audio plug-in where I learn some parameters from the audio in an array.

The trouble is when pausing and playing in a DAW (Reaper in this case). It seems to call prepareToPlay everytime I start playback hence, reinitializing all my arrays and losing all the info I have learnt.
How would you suggest tackling this issue?

Since the issue is happening only in the DAW, debugging is not the sweetest process, so I though I will ask here to hear any opinions.

Of course I can post code if needed.

Thanks in advance,

Tan


#2

Store some info internally in your plugin which can be used to determine if the plugin has already been prepared or not. Note that you should be prepared to completely reinitialize too, because the samplerate and/or maximum used block size may change from the current values.


#3

Thanks for the input. It seems that not every DAW calls the prepareToPlay function in the same manner. Anyway I put some "if"s in my initialization scripts to avoid them being called all the time and now it seems to be working fine.

Thanks a lot