hello,
I have a pretty strange thing happening here, seems like csound is losing the connection with the dac under certain circumstances.
I have a large Python application using the csoundAPI, and I use vst instruments within csound.
The loading of vst instruments takes some seconds when csound starts, and it seems like this sometimes makes csound lose connection with the soundcard.
The result is that csound does not output any audio,
** but the "overall amp" message printed when csound quits clearly indicates that csound has generated audio, since the values are not zero **
This happens approx. one out of of three times when I start the application.
And:
If use the soundcard's ASIO configuration utility to set the card's hardware buffers really high,
the problem disappears (or happen more seldom).
I feel this is not a good situation, as I do not feel confident that this won't backfire on me some day.
I was thinking it might have to do with multithreading issues and that my application maybe did not perform the startup tasks always in the same order, and that this might be the reason for the inconsistent behaviour (
e.g. not failing every time).
Now I've implemented wait flags in my startup methods, which ensures that the same order of execution is performed every time. I've done it this way:
python sends an instrument event to csound, this instrument loads the vst plugins
csound sends a message back to python when the plugins are done loading
This is an excerpt from my python code:
# load vst plugins delayed
self.csMessages.csoundEventGeneric([1, 0, 1]) # load vst plugins
while self.csoundVstPluginsReady == 0: # wait until vst plugins loaded in csound
time.sleep(0)
self.csMessages.csoundEventGeneric([2, 0, 1]) # load banks for vst plugins
... and so on
I know that vstplugins would normally be loaded via global statements (instr 0), but then I have no control what happens in the time interval while csound is loading them. This is why I put the vst loading (vstinit opcode) in an instrument.
any ideas as to what might be going on is greatly appreciated.
best
Oeyvind