Beispiel #1
0
        // ==============
        // Methods
        // ==============
        /// <summary>
        /// Step 5 / N
        /// </summary>
        /// <param name="plugin"></param>
        /// <param name="buffer"></param>
        /// <returns></returns>
        float[] ProcessToMixer(VstPlugin plugin, VstAudioBuffer[] buffer)
        {
            int indexOutput = 0;
            int oc          = plugin.PluginInfo.AudioOutputCount;

            for (int j = 0; j < BlockSize; j++)
            {
                if (oc <= 2)
                {
                    actualOutput[indexOutput]     = buffer[0][j] * volume;
                    actualOutput[indexOutput + 1] = buffer[(oc > 1)?1:0][j] * volume;
                }
                else if (oc >= 4)
                {
                    actualOutput[indexOutput]     = FloatMathExtension.Combine(volume, buffer[0][j], buffer[2][j]);
                    actualOutput[indexOutput + 1] = FloatMathExtension.Combine(volume, buffer[1][j], buffer[3][j]);
                }

                indexOutput += 2;

                Parent.BufferIncrement++;
            }

            return(actualOutput);
        }
Beispiel #2
0
        private float[] ProcessReplace(int blockSize)
        {
            lock (this)
            {
                if (blockSize != BlockSize)
                {
                    UpdateBlockSize(blockSize);
                }
                try
                {
                    NAudioVST.SendMidi2Plugin(instrument, parent.Parent.Parent, blockSize);

                    instrument.PluginCommandStub.StartProcess();
                    instrument.PluginCommandStub.ProcessReplacing(insI, insO);
                    instrument.PluginCommandStub.StopProcess();

                    if (effect != null)
                    {
                        effect.PluginCommandStub.StartProcess();
                        effect.PluginCommandStub.ProcessReplacing(insO, effO);
                        effect.PluginCommandStub.StopProcess();
                    }
                }
                catch (Exception ex) { System.Windows.Forms.MessageBox.Show(ex.ToString()); }

                int indexOutput = 0;
                int oc          = effect.PluginInfo.AudioOutputCount;

                if (oc <= 2)
                {
                    for (int j = 0; j < BlockSize; j++)
                    {
                        if (effect == null)
                        {
                            output[indexOutput]     = insO[0][j] * volume;
                            output[indexOutput + 1] = insO[(oc > 1)?1:0][j] * volume;
                        }
                        else
                        {
                            output[indexOutput]     = effO[0][j] * volume;
                            output[indexOutput + 1] = effO[(oc > 1)?1:0][j] * volume;
                        }
                        indexOutput += 2;
                        parent.BufferIncrement++;
                    }
                }
                else if (oc >= 4)
                {
                    for (int j = 0; j < BlockSize; j++)
                    {
                        if (effect == null)
                        {
                            output[indexOutput]     = FloatMathExtension.Combine(volume, insO[0][j], insO[2][j]);
                            output[indexOutput + 1] = FloatMathExtension.Combine(volume, insO[1][j], insO[3][j]);
                        }
                        else
                        {
                            output[indexOutput]     = FloatMathExtension.Combine(volume, effO[0][j], effO[2][j]);
                            output[indexOutput + 1] = FloatMathExtension.Combine(volume, effO[1][j], effO[3][j]);
                        }
                        indexOutput += 2;
                        parent.BufferIncrement++;
                    }
                }
            }
            return(output);
        }