Example of sound processing in AudioServerPlugInDriverInterface DoIOOperation ?

Hello all,


I'm currently trying to write a virtual audio driver that is supposed to act as a virtual audio device and add a processing effect on the sound that goes through it. Starting from the AudioDriverExamples, I'm trying to understand how the various operations done in DoIOOperations are working.


In particular, in WillDoIOOperation I've set up the driver to accept kAudioServerPlugInIOOperationReadInput, kAudioServerPlugInIOOperationWriteMix, and kAudioServerPlugInIOOperationProcessOutput, with the latter not being done in-place.


What I don't understand is what do with in DoIOOperation() for a ProcessOutput. As I understand it, since it's supposed not to be done in-place, I get an input buffer in ioMainBuffer, and an ouput buffer in ioSecondaryBuffer, so I should just do my sound processing on ioMainBuffer and store the result in ioSecondaryBuffer. But this doesn't seem to work, I've dumped the first values which are in ioMainBuffer and on every other call, that buffer is filled with 0s.


Also, if I'm reading and writing data with the ReadInput and WriteMix operations, what is the relation between that data and what is passed in ioMainBuffer in a ProcessOutput operation ?


Thanks for any help.