블로그 이미지
fiadot_old

칼퇴근을 위한 게임 서버 개발 방법론에 대한 심도있는 고찰 및 성찰을 위한 블로그!

Rss feed Tistory
DSP 2005. 4. 1. 11:32

process() / processReplace()

What are the differences between process() and processReplacing()?
Here I may again just quote from the SDK:
"Audio processing in the plug is accomplished by one of 2 methods, namely process(), and processReplacing(). The first one must be provided, while the second one is optional (but it is highly recommended to always implement both methods). While process() takes input data, applies its pocessing algorithm, and then adds the result to the output (accumulating), processReplacing() overwrites the output buffer. The host provides both input and output buffers for either process method.
The reasoning behind the accumulating version process() is that it is much more efficient in the case where many processors operate on the same output (aux-send bus), while for simple chained connection schemes (inserts), the replacing method processReplacing() is more efficient."

Generally it is a good idea to
- support both types by calling canProcessReplacing() in your constructor
- write a doProcess() function and call this from both methods

출처 : http://www.u-he.com/vstsource/




>So even if the host is so stupid to call process() instead of
>processReplace() where is the harm? Please, don't write something like:
>"Always use process() and processReplace() is optional." We're no kids here,
>explain (briefly) why we shouldn't leave the process() method empty and
>provide only a processReplace()? All my tests show that it works flawlessly.


if it works now that's not a proof that it will do so in the future,
or with other host applications.


in cubase, the current architecture is that a synth output streams into its
own channel, which has a single port by definition. thus, the replacing()
method is called.


however please consider a different scenario, where several plug-ins
(synths or whatever) stream to the *same* port (bus), as for instance
the send fx in cubase do...if there were only replacing methods, the hosting
application would need to make all those plugs stream to a buffer, and
then merge (add, mix) all these buffers together into the destination
buffer which is a very significant performance 'penalty' because of
memory caching issues. if however the plug reads a value from a buffer,
modifies it, and writes it back, this can be handled way more efficiently
by the cache.


you can make no assumption about what the host does with your plug. the idea
is that any application hosting vst plugs should be absolutely free to
use these black boxes as desired, and the (only) one compromise for
the plug to be made because of performance issues is the process ()
method.


either your algorithm is simple, then it will do no harm to copy/paste
the code; or it is more elaborated in which case you will probably
have a subroutine doing the actual stuff such that again copying/pasting
the process method is not a big deal.


also note that you should really always provide both methods, as when
you only provide process(), and your plug should be used streaming to
a single port, host has to first clear the buffer and then call
process() which in turn does one more unnecessary buffer memory access.
hope that helps,
charlie
-------------------------------------------------------
on the in/out port question, he wrote:

출처 : http://lalists.stanford.edu/lad/1999/05/0708.html


I personally think, process() is aux effector, other than prcessReplace() is insert effector(each track).
(I don't know more this one. don't ask why.. )
,
TOTAL TODAY