Example #1
0
 public void ResetEnvelopes()
 {
     AmpEnv.Reset();
     Filter1Env.Reset();
     Filter2Env.Reset();
     Mod1.Reset();
     Mod2.Reset();
     Mod3.Reset();
     Mod4.Reset();
     Mod5.Reset();
     Mod6.Reset();
 }
Example #2
0
        public void Process(int length)
        {
            lock (lockObject)
            {
                if (OutputBuffer[0].Length < length)
                {
                    OutputBuffer[0] = new double[2 * length];
                    OutputBuffer[1] = new double[2 * length];
                }

                for (int i = 0; i < length; i += bufsize)
                {
                    var f1Env = ModMatrix.Filter1EnvMod;
                    var f2Env = ModMatrix.Filter2EnvMod;
                    for (int n = 0; n < bufsize; n++)
                    {
                        ampEnvBuffer[n]     = AmpEnv.Process(1);
                        filter1EnvBuffer[n] = Filter1Env.Process(1) * f1Env;
                        filter2EnvBuffer[n] = Filter2Env.Process(1) * f2Env;
                    }

                    // Process modulation
                    Mod1.Process(bufsize);
                    Mod2.Process(bufsize);
                    Mod3.Process(bufsize);
                    Mod4.Process(bufsize);
                    Mod5.Process(bufsize);
                    Mod6.Process(bufsize);
                    ModMatrix.Process();

                    Osc1.Process(bufsize);
                    Osc2.Process(bufsize);
                    Osc3.Process(bufsize);
                    Osc4.Process(bufsize);

                    for (int n = 0; n < bufsize; n++)
                    {
                        path1Buffer[n] = Osc1.OutputBuffer[n] * Mixer.Osc1Vol * (1.0 - Mixer.Osc1Mix)
                                         + Osc2.OutputBuffer[n] * Mixer.Osc2Vol * (1.0 - Mixer.Osc2Mix)
                                         + Osc3.OutputBuffer[n] * Mixer.Osc3Vol * (1.0 - Mixer.Osc3Mix)
                                         + Osc4.OutputBuffer[n] * Mixer.Osc4Vol * (1.0 - Mixer.Osc4Mix);

                        path2Buffer[n] = Osc1.OutputBuffer[n] * Mixer.Osc1Vol * Mixer.Osc1Mix
                                         + Osc2.OutputBuffer[n] * Mixer.Osc2Vol * Mixer.Osc2Mix
                                         + Osc3.OutputBuffer[n] * Mixer.Osc3Vol * Mixer.Osc3Mix
                                         + Osc4.OutputBuffer[n] * Mixer.Osc4Vol * Mixer.Osc4Mix;
                    }

                    path1Buffer = Ins1.Process(path1Buffer);
                    path2Buffer = Ins2.Process(path2Buffer);

                    Filter1.Process(path1Buffer, filter1EnvBuffer);
                    Filter2.Process(path2Buffer, filter2EnvBuffer);

                    for (int n = 0; n < bufsize; n++)
                    {
                        processBuffer[n]  = Filter1.OutputBuffer[n] * Mixer.F1Vol + Filter2.OutputBuffer[n] * Mixer.F2Vol;
                        processBuffer[n] *= Mixer.OutputVolume * ampEnvBuffer[n];

                        OutputBuffer[0][i + n] = processBuffer[n];
                        OutputBuffer[1][i + n] = processBuffer[n];
                    }
                }
            }
        }