Exemplo n.º 1
0
        private void timer1_Tick(object sender, EventArgs e)
        {
            msec += 10;

            int BPM      = (int)BPMupdown.Value;
            int TickMsec = 60000 / (96 * BPM / 4);

            if (Playing)
            {
                while (msec > TickMsec)
                {
                    msec -= TickMsec;

                    TestFrameLoader.Tuesday_ClockTick(1, 1);
                    TestFrameLoader.Tuesday_ClockTick(1, 0);
                    for (int i = 0; i < msec * 2; i++)
                    {
                        TestFrameLoader.Tuesday_DoTimer();
                    }

                    Gate   = TestFrameLoader.Tuesday_GetGate();
                    Accent = TestFrameLoader.Tuesday_GetAccent();
                    CVOut  = TestFrameLoader.Tuesday_GetCV();
                    VelOut = TestFrameLoader.Tuesday_GetVel();


                    //#define DAC_VOLT(x) ((int)((4096.0 * (x)) / (2.5 * 2.048)))
                    //#define DAC_NOTE(x) DAC_VOLT((x) / 12.0)
                    double volt = (CVOut / 4096.0) * (2.5 * 2.048);
                    double note = volt * 12.0;
                    TS.Set(440 * Math.Pow(2, note / 12), Gate ? 0.2 : 0);
                }
            }
        }