public void Update() { if (!Running) { return; } float time = CSound.GetPosition(_Stream) * 1000f; if (time <= 0f) { return; } bool isActive = false; if (time <= _MaxDelayTime) { for (int i = 0; i < _DelaysChannel.Length; i++) { if (_DelaysChannel[i].Channel < 0 || _DelaysChannel[i].Finished) { continue; } if (CRecord.GetTone(_DelaysChannel[i].Channel) == 9) { Delays[i] = (int)time; _DelaysChannel[i].Finished = true; } else { isActive = true; } } } if (!isActive) { _Stop(); } }
public virtual void Update() { if (!_Initialized) { return; } if (_actsong != _PreviewSelected) { SelectSong(_PreviewSelected); } if (_streams.Count > 0 && _video != -1) { if (CVideo.VdFinished(_video) || CSound.IsFinished(_actsongstream)) { CVideo.VdClose(_video); _video = -1; return; } float time = CSound.GetPosition(_actsongstream); float vtime = 0f; CVideo.VdGetFrame(_video, ref _vidtex, time, ref vtime); if (_VideoFadeTimer.ElapsedMilliseconds <= 3000L) { _vidtex.color.A = (_VideoFadeTimer.ElapsedMilliseconds / 3000f); } else { _vidtex.color.A = 1f; _VideoFadeTimer.Stop(); } } }
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); }
public override bool UpdateGame() { bool Finish = false; if (CSound.IsPlaying(_CurrentStream) || CSound.IsPaused(_CurrentStream)) { _CurrentTime = CSound.GetPosition(_CurrentStream); if (_FinishTime != 0 && _CurrentTime >= _FinishTime) { Finish = true; } } else { Finish = true; } if (Finish) { LoadNextSong(); } UpdateSongText(); if (_FadeOut) { return(true); } UpdateTimeLine(); CGame.UpdatePoints(_CurrentTime); UpdateLyrics(); float[] Alpha = CalcFadingAlpha(); if (Alpha != null) { Lyrics[htLyrics(LyricMain)].Alpha = Alpha[0]; Lyrics[htLyrics(LyricSub)].Alpha = Alpha[1]; Lyrics[htLyrics(LyricMainTop)].Alpha = Alpha[0]; Lyrics[htLyrics(LyricSubTop)].Alpha = Alpha[1]; Statics[htStatics(StaticLyrics)].Alpha = Alpha[0]; Statics[htStatics(StaticLyricsTop)].Alpha = Alpha[0]; Statics[htStatics(StaticLyricHelper)].Alpha = Alpha[0]; Statics[htStatics(StaticLyricHelperTop)].Alpha = Alpha[0]; for (int p = 0; p < CGame.NumPlayer; p++) { SingNotes[htSingNotes(SingBars)].SetAlpha(NoteLines[p], Alpha[CGame.Player[p].LineNr * 2]); } if (Alpha.Length > 2) { Lyrics[htLyrics(LyricMainDuet)].Alpha = Alpha[0]; Lyrics[htLyrics(LyricSubDuet)].Alpha = Alpha[1]; Statics[htStatics(StaticLyricsDuet)].Alpha = Alpha[0]; Statics[htStatics(StaticLyricHelperDuet)].Alpha = Alpha[0]; Lyrics[htLyrics(LyricMain)].Alpha = Alpha[2]; Lyrics[htLyrics(LyricSub)].Alpha = Alpha[3]; Statics[htStatics(StaticLyrics)].Alpha = Alpha[2]; Statics[htStatics(StaticLyricHelper)].Alpha = Alpha[2]; } } for (int p = 0; p < CGame.NumPlayer; p++) { Texts[htTexts(TextScores[p, CGame.NumPlayer - 1])].Text = CGame.Player[p].Points.ToString("00000"); } if (_CurrentVideo != -1 && !_FadeOut && CConfig.VideosInSongs == EOffOn.TR_CONFIG_ON) { float vtime = 0f; CVideo.VdGetFrame(_CurrentVideo, ref _CurrentVideoTexture, _CurrentTime, ref vtime); } return(true); }