예제 #1
0
 public override bool UpdateGame()
 {
     for (int i = 1; i <= CGame.NumPlayer; i++)
     {
         CSound.AnalyzeBuffer((i - 1));
         Equalizers[htEqualizer("EqualizerPlayer" + i)].Update(CSound.ToneWeigth((i - 1)));
     }
     return(true);
 }
예제 #2
0
        public override bool UpdateGame()
        {
            for (int i = 0; i < CSettings.MaxNumPlayer; i++)
            {
                CSound.AnalyzeBuffer(i);
            }

            if (_DelayTest != null)
            {
                for (int i = 0; i < _DelayTest.Length - 1; i++)
                {
                    if (_DelayTestRunning && !_DelayTest[i].Timer.IsRunning)
                    {
                        if (CSound.GetPosition(_DelaySound) > 0f)
                        {
                            _DelayTest[i].Timer.Reset();
                            _DelayTest[i].Timer.Start();
                        }
                    }
                    if (_DelayTest[i].Timer.IsRunning)
                    {
                        int player = 0;
                        if (i == 0)
                        {
                            player = SelectSlides[htSelectSlides(SelectSlideRecordChannel1)].Selection;
                        }

                        if (i == 1)
                        {
                            player = SelectSlides[htSelectSlides(SelectSlideRecordChannel2)].Selection;
                        }

                        if (_DelayTest[i].Timer.ElapsedMilliseconds > MaxDelayTime * 1000f || player == 0)
                        {
                            _DelayTest[i].Delay = 0f;
                            _DelayTest[i].Timer.Stop();
                            _DelayTestRunning = false;
                        }
                        else if (CSound.RecordGetMaxVolume(player - 1) > 0.1f &&
                                 (CSound.RecordGetToneAbs(player - 1) == 9 || CSound.RecordGetToneAbs(player - 1) == 21 || CSound.RecordGetToneAbs(player - 1) == 33))
                        {
                            _DelayTest[i].Delay = _DelayTest[i].Timer.ElapsedMilliseconds;
                            _DelayTest[i].Timer.Stop();
                            _DelayTestRunning = false;
                        }
                    }
                }
                Texts[htTexts(TextDelayChannel1)].Text = _DelayTest[0].Delay.ToString("000") + " ms";
                Texts[htTexts(TextDelayChannel2)].Text = _DelayTest[1].Delay.ToString("000") + " ms";
            }


            if (CheckMicConfig())
            {
                ChannelEnergy[0] = 0f;
                int player = SelectSlides[htSelectSlides(SelectSlideRecordChannel1)].Selection;
                if (player > 0)
                {
                    ChannelEnergy[0] = CSound.RecordGetMaxVolume(player - 1);
                    Equalizers[htEqualizer(EqualizerChannel1)].Update(CSound.ToneWeigth(player - 1));
                }
                else
                {
                    Equalizers[htEqualizer(EqualizerChannel1)].Reset();
                }

                ChannelEnergy[1] = 0f;
                player           = SelectSlides[htSelectSlides(SelectSlideRecordChannel2)].Selection;
                if (player > 0)
                {
                    ChannelEnergy[1] = CSound.RecordGetMaxVolume(player - 1);
                    Equalizers[htEqualizer(EqualizerChannel2)].Update(CSound.ToneWeigth(player - 1));
                }
                else
                {
                    Equalizers[htEqualizer(EqualizerChannel2)].Reset();
                }
            }
            else
            {
                for (int i = 0; i < ChannelEnergy.Length; i++)
                {
                    ChannelEnergy[i] = 0f;
                }
                Equalizers[htEqualizer(EqualizerChannel1)].Reset();
                Equalizers[htEqualizer(EqualizerChannel2)].Reset();
            }

            return(true);
        }