private static void DrawDebugInfos() { string txt = String.Empty; CFonts.Style = EStyle.Normal; CFonts.SetFont("Normal"); SColorF Gray = new SColorF(1f, 1f, 1f, 0.5f); float dy = 0; if (CConfig.DebugLevel >= EDebugLevel.TR_CONFIG_ONLY_FPS) { txt = CTime.GetFPS().ToString("FPS: 000"); CFonts.Height = 30f; RectangleF rect = new RectangleF(CSettings.iRenderW - CFonts.GetTextWidth(txt), dy, CFonts.GetTextWidth(txt), CFonts.GetTextHeight(txt)); CDraw.DrawColor(Gray, new SRectF(rect.X, rect.Top, rect.Width, rect.Height, CSettings.zNear)); CFonts.DrawText(txt, rect.X, rect.Y, CSettings.zNear); dy += rect.Height; } if (CConfig.DebugLevel >= EDebugLevel.TR_CONFIG_LEVEL1) { txt = CSound.GetStreamCount().ToString(CLanguage.Translate("TR_DEBUG_AUDIO_STREAMS") + ": 00"); RectangleF rect = new RectangleF(CSettings.iRenderW - CFonts.GetTextWidth(txt), dy, CFonts.GetTextWidth(txt), CFonts.GetTextHeight(txt)); CDraw.DrawColor(Gray, new SRectF(rect.X, rect.Top, rect.Width, rect.Height, CSettings.zNear)); CFonts.DrawText(txt, rect.X, rect.Y, CSettings.zNear); dy += rect.Height; } if (CConfig.DebugLevel >= EDebugLevel.TR_CONFIG_LEVEL1) { txt = CVideo.GetNumStreams().ToString(CLanguage.Translate("TR_DEBUG_VIDEO_STREAMS") + ": 00"); RectangleF rect = new RectangleF(CSettings.iRenderW - CFonts.GetTextWidth(txt), dy, CFonts.GetTextWidth(txt), CFonts.GetTextHeight(txt)); CDraw.DrawColor(Gray, new SRectF(rect.X, rect.Top, rect.Width, rect.Height, CSettings.zNear)); CFonts.DrawText(txt, rect.X, rect.Y, CSettings.zNear); dy += rect.Height; } if (CConfig.DebugLevel >= EDebugLevel.TR_CONFIG_LEVEL1) { txt = CDraw.TextureCount().ToString(CLanguage.Translate("TR_DEBUG_TEXTURES") + ": 00000"); RectangleF rect = new RectangleF(CSettings.iRenderW - CFonts.GetTextWidth(txt), dy, CFonts.GetTextWidth(txt), CFonts.GetTextHeight(txt)); CDraw.DrawColor(Gray, new SRectF(rect.X, rect.Top, rect.Width, rect.Height, CSettings.zNear)); CFonts.DrawText(txt, rect.X, rect.Y, CSettings.zNear); dy += rect.Height; } if (CConfig.DebugLevel >= EDebugLevel.TR_CONFIG_LEVEL2) { txt = CSound.RecordGetToneAbs(0).ToString(CLanguage.Translate("TR_DEBUG_TONE_ABS") + " P1: 00"); RectangleF rect = new RectangleF(CSettings.iRenderW - CFonts.GetTextWidth(txt), dy, CFonts.GetTextWidth(txt), CFonts.GetTextHeight(txt)); CDraw.DrawColor(Gray, new SRectF(rect.X, rect.Top, rect.Width, rect.Height, CSettings.zNear)); CFonts.DrawText(txt, rect.X, rect.Y, CSettings.zNear); dy += rect.Height; txt = CSound.RecordGetMaxVolume(0).ToString(CLanguage.Translate("TR_DEBUG_MAX_VOLUME") + " P1: 0.000"); rect = new RectangleF(CSettings.iRenderW - CFonts.GetTextWidth(txt), dy, CFonts.GetTextWidth(txt), CFonts.GetTextHeight(txt)); CDraw.DrawColor(Gray, new SRectF(rect.X, rect.Top, rect.Width, rect.Height, CSettings.zNear)); CFonts.DrawText(txt, rect.X, rect.Y, CSettings.zNear); dy += rect.Height; txt = CSound.RecordGetToneAbs(1).ToString(CLanguage.Translate("TR_DEBUG_TONE_ABS") + " P2: 00"); rect = new RectangleF(CSettings.iRenderW - CFonts.GetTextWidth(txt), dy, CFonts.GetTextWidth(txt), CFonts.GetTextHeight(txt)); CDraw.DrawColor(Gray, new SRectF(rect.X, rect.Top, rect.Width, rect.Height, CSettings.zNear)); CFonts.DrawText(txt, rect.X, rect.Y, CSettings.zNear); dy += rect.Height; txt = CSound.RecordGetMaxVolume(1).ToString(CLanguage.Translate("TR_DEBUG_MAX_VOLUME") + " P2: 0.000"); rect = new RectangleF(CSettings.iRenderW - CFonts.GetTextWidth(txt), dy, CFonts.GetTextWidth(txt), CFonts.GetTextHeight(txt)); CDraw.DrawColor(Gray, new SRectF(rect.X, rect.Top, rect.Width, rect.Height, CSettings.zNear)); CFonts.DrawText(txt, rect.X, rect.Y, CSettings.zNear); dy += rect.Height; } if (CConfig.DebugLevel >= EDebugLevel.TR_CONFIG_LEVEL3) { txt = CSongs.NumSongsWithCoverLoaded.ToString(CLanguage.Translate("TR_DEBUG_SONGS") + ": 00000"); RectangleF rect = new RectangleF(CSettings.iRenderW - CFonts.GetTextWidth(txt), dy, CFonts.GetTextWidth(txt), CFonts.GetTextHeight(txt)); CDraw.DrawColor(Gray, new SRectF(rect.X, rect.Top, rect.Width, rect.Height, CSettings.zNear)); CFonts.DrawText(txt, rect.X, rect.Y, CSettings.zNear); dy += rect.Height; } if (CConfig.DebugLevel >= EDebugLevel.TR_CONFIG_LEVEL_MAX) { txt = _Cursor.X.ToString(CLanguage.Translate("TR_DEBUG_MOUSE") + " : (0000/") + _Cursor.Y.ToString("0000)"); RectangleF rect = new RectangleF(CSettings.iRenderW - CFonts.GetTextWidth(txt), dy, CFonts.GetTextWidth(txt), CFonts.GetTextHeight(txt)); CDraw.DrawColor(Gray, new SRectF(rect.X, rect.Top, rect.Width, rect.Height, CSettings.zNear)); CFonts.DrawText(txt, rect.X, rect.Y, CSettings.zNear); dy += rect.Height; } }
private void DrawToneHelper(int n, int BaseLine, float XOffset) { int TonePlayer = CSound.RecordGetToneAbs(_PlayerNotes[n].PlayerNr); SRectF Rect = _PlayerNotes[n].Rect; while (TonePlayer - BaseLine < 0) { TonePlayer += 12; } while (TonePlayer - BaseLine > 12) { TonePlayer -= 12; } if (XOffset < 0f) { XOffset = 0f; } if (XOffset > Rect.W) { XOffset = Rect.W; } float dy = Rect.H / (CSettings.NumNoteLines); SRectF rect = new SRectF( Rect.X - dy + XOffset, Rect.Y + dy * (CSettings.NumNoteLines - 1 - (TonePlayer - BaseLine) / 2f), dy, dy, Rect.Z ); SColorF color = new SColorF( _PlayerNotes[n].Color.R, _PlayerNotes[n].Color.G, _PlayerNotes[n].Color.B, _PlayerNotes[n].Color.A * _PlayerNotes[n].Alpha); STexture ToneHelper = CTheme.GetSkinTexture(_Theme.SkinToneHelperName); CDraw.DrawTexture(ToneHelper, rect, color); while (TonePlayer - BaseLine < 12) { TonePlayer += 12; } while (TonePlayer - BaseLine > 24) { TonePlayer -= 12; } rect = new SRectF( Rect.X - dy + XOffset, Rect.Y + dy * (CSettings.NumNoteLines - 1 - (TonePlayer - BaseLine) / 2f), dy, dy, Rect.Z ); CDraw.DrawTexture(ToneHelper, rect, color); }
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); }