Beispiel #1
0
        private void GetInfo()
        {
            this.DebugInfo.Interval = 1;
            if (Tabs.SelectedIndex == 0)
            {
                // Time to write all the stuff to the string builder
                if (Path.GetFileName(CurrentApp) == "0")
                {
                    OpenAppLocat.Enabled = false;
                    currentappreturn     = "Nothing";
                }
                else
                {
                    currentappreturn = System.IO.Path.GetFileName(CurrentApp);
                }

                if (BitApp == "0")
                {
                    bitappreturn = "...";
                }
                else
                {
                    bitappreturn = BitApp;
                }

                HCountV.Text   = String.Format("{0} handles", Handles);
                RAMUsageV.Text = GetCurrentRAMUsage(RAMUsage);
                CMA.Text       = String.Format("{0} ({1})", currentappreturn, bitappreturn); // Removes garbage characters

                Int32 AVColor = (int)Math.Round((double)(100 * Convert.ToInt32(GetActiveVoices())) / Convert.ToInt32(Settings.GetValue("MaxVoices", "512")));

                if (Convert.ToInt32(GetActiveVoices()) > Convert.ToInt32(Settings.GetValue("MaxVoices", "512")))
                {
                    AV.Font = new Font(AV.Font, FontStyle.Bold);
                }
                else
                {
                    AV.Font = new Font(AV.Font, FontStyle.Regular);
                }

                AV.ForeColor = ValueBlend.GetBlendedColor(AVColor.LimitIntToRange(0, 100));
                AV.Text      = GetActiveVoices();
                AvV.Text     = GetAverageVoices();

                if (Convert.ToInt32(Settings.GetValue("CurrentEngine", "3")) == 0)
                {
                    RT.Font = new System.Drawing.Font(RT.Font, System.Drawing.FontStyle.Italic);
                    RT.Text = "Unavailable"; // If BASS is in encoding mode, BASS usage will stay at constant 100%.
                }
                else
                {
                    Int32 RTColor = (int)Math.Round((double)(100 * CurCPU) / Convert.ToInt32(Settings.GetValue("MaxRenderingTime", "75")));

                    if ((CurCPU > Convert.ToInt32(Settings.GetValue("MaxRenderingTime", "75"))) && (Convert.ToInt32(Settings.GetValue("MaxRenderingTime", "75")) != 0))
                    {
                        RT.Font = new System.Drawing.Font(RT.Font, System.Drawing.FontStyle.Bold);
                        RT.Text = String.Format("{0}% (Beyond limit!)", CurCPU.ToString("0.0"), Settings.GetValue("MaxRenderingTime", "75").ToString());
                    }
                    else
                    {
                        RT.Font = new System.Drawing.Font(RT.Font, System.Drawing.FontStyle.Regular);
                        RT.Text = String.Format("{0}%", CurCPU.ToString("0.0")); // Else, it'll give you the info about how many cycles it needs to work.
                    }

                    RT.ForeColor = ValueBlend.GetBlendedColor(RTColor.LimitIntToRange(0, 100));
                }

                if (Convert.ToInt32(Settings.GetValue("CurrentEngine", "0")) == 2)
                {
                    ASIOL.Text = String.Format("Input {0}ms, Output {1}ms", ASIOInLat, ASIOOutLat);
                }
                else
                {
                    ASIOL.Text = (Handles > 0) ? "Not in use." : "Unavailable";
                }

                if (KDMAPIStatus == 0)
                {
                    KDMAPI.Text = (Handles > 0) ? "Disabled, using WinMM" : "Unavailable";
                }
                else
                {
                    KDMAPI.Text = "Enabled, using KDMAPI";
                }

                CurSFsList.Text = (SFsList != 0) ? String.Format("List {0}", SFsList) : "Unavailable";

                /*
                 * WIP
                 * if (BufferOverload == 0)
                 * {
                 *  BufStatus.ForeColor = (Handles > 0) ? Color.FromArgb(32, 150, 0) : Color.Black;
                 *  BufStatus.Font = new Font(BufStatus.Font, FontStyle.Regular);
                 *  BufStatus.Text = (Handles > 0) ? "Healthy." : "Unavailable.";
                 * }
                 * else
                 * {
                 *  BufStatus.ForeColor = Color.FromArgb(209, 0, 31);
                 *  BufStatus.Font = new Font(BufStatus.Font, FontStyle.Bold);
                 *  if (Convert.ToInt32(Settings.GetValue("vms2emu", "0")) == 0)
                 *      BufStatus.Text = "Full, skipping notes.";
                 *  else
                 *      BufStatus.Text = "Full, slowing down playback.";
                 * }
                 * WIP
                 */
            }
            else if (Tabs.SelectedIndex == 1)
            {
                String FormatForVoices = "{0} voices";
                CHV1.Text  = String.Format(FormatForVoices, CHs[0]);
                CHV2.Text  = String.Format(FormatForVoices, CHs[1]);
                CHV3.Text  = String.Format(FormatForVoices, CHs[2]);
                CHV4.Text  = String.Format(FormatForVoices, CHs[3]);
                CHV5.Text  = String.Format(FormatForVoices, CHs[4]);
                CHV6.Text  = String.Format(FormatForVoices, CHs[5]);
                CHV7.Text  = String.Format(FormatForVoices, CHs[6]);
                CHV8.Text  = String.Format(FormatForVoices, CHs[7]);
                CHV9.Text  = String.Format(FormatForVoices, CHs[8]);
                CHV10.Text = String.Format(FormatForVoices, CHs[9]);
                CHV11.Text = String.Format(FormatForVoices, CHs[10]);
                CHV12.Text = String.Format(FormatForVoices, CHs[11]);
                CHV13.Text = String.Format(FormatForVoices, CHs[12]);
                CHV14.Text = String.Format(FormatForVoices, CHs[13]);
                CHV15.Text = String.Format(FormatForVoices, CHs[14]);
                CHV16.Text = String.Format(FormatForVoices, CHs[15]);
            }
            else if (Tabs.SelectedIndex == 2)
            {
                this.DebugInfo.Interval = 500;
                AM.Text = String.Format("{0} ({1:0.#}%, {2} bytes)", (avmemint + "MB").ToString(), Math.Round(percentage, 1).ToString(), avmem.ToString("N0", CultureInfo.GetCultureInfo("de")));
            }
        }
Beispiel #2
0
        private void DebugInfo_Tick(object sender, EventArgs e)
        {
            try
            {
                try
                {
                    if (Tabs.SelectedIndex == 0)
                    {
                        currentapp  = Watchdog.GetValue("currentapp", "None").ToString();           // Gets app's name. If the name of the app is invalid, it'll return "Not available"
                        bitapp      = Watchdog.GetValue("bit", "...").ToString();                   // Gets app's architecture. If the app doesn't return a value, it'll return "Unknown"
                        ramusage    = Convert.ToUInt64(Debug.GetValue("ramusage", 0).ToString());   // Gets app's working set size in bytes. (Eg. How much the app is using for both RAM and paging file)
                        handlecount = Convert.ToInt32(Debug.GetValue("handlecount", 0).ToString()); // Gets app's handles count.
                        sndbfvalue  = Convert.ToInt32(Settings.GetValue("sndbfvalue", 0));          // Size of the decoded data, in bytes

                        // Time to write all the stuff to the string builder
                        if (System.IO.Path.GetFileName(currentapp.RemoveGarbageCharacters()) == "0")
                        {
                            OpenAppLocat.Enabled = false;
                            currentappreturn     = "None";
                        }
                        else
                        {
                            currentappreturn = System.IO.Path.GetFileName(currentapp.RemoveGarbageCharacters());
                        }

                        if (bitapp.RemoveGarbageCharacters() == "0")
                        {
                            bitappreturn = "...";
                        }
                        else
                        {
                            bitappreturn = bitapp.RemoveGarbageCharacters();
                        }

                        HCountV.Text   = String.Format("{0} handles", handlecount);
                        RAMUsageV.Text = GetCurrentRAMUsage(ramusage);
                        CMA.Text       = String.Format("{0} ({1})", currentappreturn, bitappreturn); // Removes garbage characters

                        // Get current active voices
                        UpdateActiveVoicesPerChannel();

                        Int32 AVColor = (int)Math.Round((double)(100 * Convert.ToInt32(GetActiveVoices())) / Convert.ToInt32(Settings.GetValue("polyphony", "512")));

                        if (Convert.ToInt32(GetActiveVoices()) > Convert.ToInt32(Settings.GetValue("polyphony", "512")))
                        {
                            AV.Font = new System.Drawing.Font(AV.Font, System.Drawing.FontStyle.Bold);
                        }
                        else
                        {
                            AV.Font = new System.Drawing.Font(AV.Font, System.Drawing.FontStyle.Regular);
                        }

                        AV.ForeColor = ValueBlend.GetBlendedColor(AVColor.LimitToRange(0, 100));
                        AV.Text      = GetActiveVoices();
                        AvV.Text     = GetAverageVoices();

                        if (Convert.ToInt32(Settings.GetValue("encmode", "0")) == 1)
                        {
                            RT.Font = new System.Drawing.Font(RT.Font, System.Drawing.FontStyle.Italic);
                            RT.Text = "Unavailable"; // If BASS is in encoding mode, BASS usage will stay at constant 100%.
                        }
                        else
                        {
                            Int32 RTColor = (int)Math.Round((double)(100 * Convert.ToInt32(Debug.GetValue("currentcpuusage0", "0"))) / Convert.ToInt32(Settings.GetValue("cpu", "75")));

                            if (Convert.ToInt32(Debug.GetValue("currentcpuusage0", "0").ToString()) > Convert.ToInt32(Settings.GetValue("cpu", "75").ToString()) && Settings.GetValue("cpu", "75").ToString() != "0")
                            {
                                RT.Font = new System.Drawing.Font(RT.Font, System.Drawing.FontStyle.Bold);
                                RT.Text = String.Format("{0}% (Beyond limit!)", Debug.GetValue("currentcpuusage0").ToString(), Settings.GetValue("cpu", "75").ToString());
                            }
                            else
                            {
                                RT.Font = new System.Drawing.Font(RT.Font, System.Drawing.FontStyle.Regular);
                                RT.Text = String.Format("{0}%", Debug.GetValue("currentcpuusage0", "0").ToString()); // Else, it'll give you the info about how many cycles it needs to work.
                            }

                            RT.ForeColor = ValueBlend.GetBlendedColor(RTColor.LimitToRange(0, 100));
                        }

                        if (Convert.ToInt32(Settings.GetValue("xaudiodisabled", "0")) == 0)
                        {
                            DDSLabel.Visible   = true;
                            DDS.Visible        = true;
                            AERTLabel.Visible  = false;
                            AERT.Visible       = false;
                            ASIOLLabel.Visible = false;
                            ASIOL.Visible      = false;
                            DDSLabel.Enabled   = true;
                            DDS.Enabled        = true;
                            DDS.Text           = String.Format("{0} ({1} x 4)", (sndbfvalue * 4), sndbfvalue);
                        }
                        else if (Convert.ToInt32(Settings.GetValue("xaudiodisabled", "0")) == 1)
                        {
                            DDSLabel.Visible   = true;
                            DDS.Visible        = true;
                            AERTLabel.Visible  = false;
                            AERT.Visible       = false;
                            ASIOLLabel.Visible = false;
                            ASIOL.Visible      = false;
                            DDSLabel.Enabled   = false;
                            DDS.Enabled        = false;
                            DDS.Text           = "Unavailable";
                        }
                        else if (Convert.ToInt32(Settings.GetValue("xaudiodisabled", "0")) == 2)
                        {
                            DDSLabel.Visible   = false;
                            DDS.Visible        = false;
                            AERTLabel.Visible  = false;
                            AERT.Visible       = false;
                            ASIOLLabel.Visible = true;
                            ASIOL.Visible      = true;
                            ASIOL.Text         = String.Format("Input {0}ms, Output {1}ms", Debug.GetValue("asioinlatency", "0").ToString(), Debug.GetValue("asiooutlatency", "0").ToString());
                        }
                        else
                        {
                            DDSLabel.Visible   = false;
                            DDS.Visible        = false;
                            AERTLabel.Visible  = true;
                            AERT.Visible       = true;
                            ASIOLLabel.Visible = false;
                            ASIOL.Visible      = false;
                            AERT.Text          = String.Format("{0}%", Debug.GetValue("currentcpuusageE0", "0").ToString());
                        }
                    }
                    else if (Tabs.SelectedIndex == 1)
                    {
                        UpdateActiveVoicesPerChannel();
                        String FormatForVoices = "{0} voices";
                        CHV1.Text  = String.Format(FormatForVoices, ch1);
                        CHV2.Text  = String.Format(FormatForVoices, ch2);
                        CHV3.Text  = String.Format(FormatForVoices, ch3);
                        CHV4.Text  = String.Format(FormatForVoices, ch4);
                        CHV5.Text  = String.Format(FormatForVoices, ch5);
                        CHV6.Text  = String.Format(FormatForVoices, ch6);
                        CHV7.Text  = String.Format(FormatForVoices, ch7);
                        CHV8.Text  = String.Format(FormatForVoices, ch8);
                        CHV9.Text  = String.Format(FormatForVoices, ch9);
                        CHV10.Text = String.Format(FormatForVoices, ch10);
                        CHV11.Text = String.Format(FormatForVoices, ch11);
                        CHV12.Text = String.Format(FormatForVoices, ch12);
                        CHV13.Text = String.Format(FormatForVoices, ch13);
                        CHV14.Text = String.Format(FormatForVoices, ch14);
                        CHV15.Text = String.Format(FormatForVoices, ch15);
                        CHV16.Text = String.Format(FormatForVoices, ch16);
                    }
                    else if (Tabs.SelectedIndex == 2)
                    {
                        MTRT.Text  = String.Format("{0}ms", Debug.GetValue("td1", 0).ToString());
                        AERTi.Text = String.Format("{0}ms", Debug.GetValue("td2", 0).ToString());
                        SLRT.Text  = String.Format("{0}ms", Debug.GetValue("td3", 0).ToString());
                        NCRT.Text  = String.Format("{0}ms", Debug.GetValue("td4", 0).ToString());
                    }
                }
                finally
                {
                    GC.Collect();
                    GC.WaitForPendingFinalizers();
                }
            }
            catch (Exception ex)
            {
                // If something goes wrong, here's an error handler
                MessageBox.Show(ex.ToString() + "\n\nPress OK to stop the debug mode.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                Application.ExitThread();
            }
        }