Exemplo n.º 1
0
        public void LengthSet(int length)
        {
            basicAI.StaticConfig.ClockConfig.TotalSampleLengthPerChannel = length;

            //这里需要把ReadSamplePerTime也设置一下
            int gcd = Caculator.GCD((int)length, (int)basicAI.StaticConfig.ClockConfig.SampleRate);

            if (gcd <= 20000)
            {
                basicAI.StaticConfig.ClockConfig.ReadSamplePerTime = gcd;
            }
            else
            {
                basicAI.StaticConfig.ClockConfig.ReadSamplePerTime = Caculator.GCD(gcd, 20000);
            }

            basicAI.ChangeStaticConfig(basicAI.StaticConfig);
        }
Exemplo n.º 2
0
        public void SampleRateSet(double sampleRate)
        {
            basicAI.StaticConfig.ClockConfig.SampleRate = sampleRate;

            //这里需要把ReadSamplePerTime也设置一下
            int gcd = Caculator.GCD((int)sampleRate, basicAI.StaticConfig.ClockConfig.TotalSampleLengthPerChannel);

            if (gcd <= 20000)
            {
                basicAI.StaticConfig.ClockConfig.ReadSamplePerTime = gcd;
            }
            else
            {
                basicAI.StaticConfig.ClockConfig.ReadSamplePerTime = Caculator.GCD(gcd, 20000);
            }

            basicAI.ChangeStaticConfig(basicAI.StaticConfig);
        }