What would be the right way to read the samples from host’s audio callback IO buffer into a Csound object, process them and write them back, but with different sizes of ksmps and host’s IO buffer?
I.e. if a host’s audio callback has an i.e. 512 frame samples and Csound object has 256 ksmps.
The most logical way would be to simply make two iterations of usual steps:
- read ksmps number of values from host’s input buffer and write them into Csound Spin buffer
- make PerformKsmps()
- read result values from Csound Spout buffer and write them to the host’s output buffer
However, that doesn’t work as expected, for some reason I get corrupted audio.
On the other hand, if ksmps size matches host’s IO buffer then everything works perfectly (of course in this case it involves only one iteration through the above steps).
What am I missing here?