Time Limit To Init Function


#1

Possibly a stupid question, but is there a limit to the time/number of cycles an initialisation function can take?

I'm wondering about making an object that will process a previously-recorded sample when the patch starts, and am wondering if the processing function will get killed after a time.

a|x


#2

yes, assuming you producing audio , and the function is in the audio thread.
1/3000s - patchtime.

(where patchtime is the time take by the rest of your patch to execute)

if you don't complete in this time, you will get audio glitches, because the output audio buffer will not have been fully processed.

(bare in mind: k-rate code is executed in audio thread, and the entire patch is 'rendered' before the output buffer is copied to the codec)

if your not producing audio output it doesn't matter...

if your function is taking a long time (or indeterminate time) then it should be executed in a separate thread.


#3

OK, not what I really meant, though.
I meant is there a limit on the time an init function can take. Maybe I'm misunderstanding what init code does, but I assumed it was possible to run some setup code before the k/s-rate rendering loops kicked off.

a|x


#4

I guess I could just kick off a thread on the first k-rate cycle, and it will take as long as it takes, during which time, no audio output will be produced.

a|x


#5

sorry, missed the word init - audio is no issue then...

but you will might fall foul of the watchdog if you take too long, which will disconnect the UI from the board.

try it and see...
(quicker than we checking the firmware code, esp since Ive got the wrong version checked out and built)


#6

I'll give it a go. Launching a new thread seems the better option, though.

a|x