cadencii.VSTiDriverBase.process C# (CSharp) Method

process() public method

public process ( double left, double right, int length ) : void
left double
right double
length int
return void
        public unsafe void process( double[] left, double[] right, int length )
        {
            if ( left == null || right == null ) {
                return;
            }
            //int length = Math.Min( left.Length, right.Length );
            try {
                initBuffer();
                int remain = length;
                int offset = 0;
                float* left_ch = (float*)bufferLeft.ToPointer();
                float* right_ch = (float*)bufferRight.ToPointer();
                float** out_buffer = (float**)buffers.ToPointer();
                out_buffer[0] = left_ch;
                out_buffer[1] = right_ch;
                while ( remain > 0 ) {
                    int proc = (remain > BUFLEN) ? BUFLEN : remain;
                    aEffect.ProcessReplacing( IntPtr.Zero, new IntPtr( out_buffer ), proc );
                    for ( int i = 0; i < proc; i++ ) {
                        left[i + offset] = left_ch[i];
                        right[i + offset] = right_ch[i];
                    }
                    remain -= proc;
                    offset += proc;
                }
            } catch ( Exception ex ) {
                serr.println( "vstidrv#process; ex=" + ex );
            }
        }