Ejemplo n.º 1
0
        private bool GetPCInfo()
        {
            try
            {
                NicknameVal.Text = Environment.UserName;

                foreach (ManagementObject moProcessor in mosProcessor.Get())
                {
                    RealCPU = moProcessor["name"].ToString();
                }
                RealRAM = String.Format("{0} bytes ({1})", TotalRAM, Functions.ReturnLength((long)TotalRAM, false));

                string gpuname = "";
                uint   gpuvram = 0;
                foreach (ManagementObject moGPU in mosGPU.Get())
                {
                    gpuname = moGPU["Name"].ToString();
                    gpuvram = Convert.ToUInt32(moGPU["AdapterRAM"]);
                }
                RealGPU = String.Format("{0} ({1} of VRAM)", gpuname, Functions.ReturnLength(gpuvram, false));

                RealOS = String.Format("{0} ({1})", OSInfo.Name, Environment.Is64BitOperatingSystem ? "64-bit" : "32-bit");

                if (Environment.OSVersion.Version.Major == 10) // If OS is Windows 10, get UBR too
                {
                    RealPatch = String.Format("{0}.{1}.{2} (Update Build Revision {3})",
                                              Environment.OSVersion.Version.Major, Environment.OSVersion.Version.Minor,
                                              Environment.OSVersion.Version.Build, CurrentVerKey.GetValue("UBR", 0).ToString());
                }
                else // Else, give normal version number
                {
                    if (Environment.OSVersion.Version.Major == 6 && Environment.OSVersion.Version.Minor <= 1)
                    {
                        RealPatch = String.Format("{0}.{1}.{2} ({3})",
                                                  Environment.OSVersion.Version.Major, Environment.OSVersion.Version.Minor,
                                                  Environment.OSVersion.Version.Build, Environment.OSVersion.ServicePack);
                    }
                    else
                    {
                        RealPatch = String.Format("{0}.{1}.{2} (Modern UI)",
                                                  Environment.OSVersion.Version.Major, Environment.OSVersion.Version.Minor,
                                                  Environment.OSVersion.Version.Build);
                    }
                }

                SoundCards.SelectedIndex = 0;
                foreach (ManagementObject obj in mosSound.Get())
                {
                    SoundCards.Items.Add(obj["Name"].ToString());
                }

                return(true);
            }
            catch { return(false); }
        }
Ejemplo n.º 2
0
 public static string ReturnSoundFontSize(string preset, string ext, long length)
 {
     if (ext.ToLowerInvariant() != ".sfz")
     {
         string size = Functions.ReturnLength(length, false);
         return(size);
     }
     else
     {
         long size = SFZ.GetSoundFontZSize(preset);
         if (size > 0)
         {
             return(Functions.ReturnLength(size, true));
         }
         else
         {
             return("N/A");
         }
     }
 }
Ejemplo n.º 3
0
        public SoundFontInfo(String SoundFont)
        {
            InitializeComponent();

            ERROR = false;

            // Here we go
            String   next;
            String   sf = "";
            Int32    fonthandle;
            FileInfo f;

            OriginalSF = SoundFont;

            if (SoundFont.ToLower().IndexOf('=') != -1)
            {
                sf = SoundFont.Substring(SoundFont.LastIndexOf('|') + 1);
                if (!File.Exists(sf))
                {
                    Program.ShowError(4, "Error", String.Format("The SoundFont \"{0}\" doesn't exist.", SoundFont), null);
                    ERROR = true;
                    Close();
                    return;
                }
                fonthandle = BassMidi.BASS_MIDI_FontInit(sf);
                f          = new FileInfo(sf);
                next       = sf;
            }
            else
            {
                sf = SoundFont;
                if (!File.Exists(SoundFont))
                {
                    Program.ShowError(4, "Error", String.Format("The SoundFont \"{0}\" doesn't exist.", SoundFont), null);
                    ERROR = true;
                    Close();
                    return;
                }
                fonthandle = BassMidi.BASS_MIDI_FontInit(SoundFont);
                f          = new FileInfo(SoundFont);
                next       = SoundFont;
            }

            BASS_MIDI_FONTINFO fontinfo = BassMidi.BASS_MIDI_FontGetInfo(fonthandle);

            FNBox.Text  = next;
            ISFBox.Text = ReturnName(fontinfo.name, next);
            CIBox.Text  = ReturnCopyright(fontinfo.copyright);
            SamF.Text   = String.Format("{0} ({1})", ReturnSampleType(fontinfo.samtype), fontinfo.samtype);

            if (f.Length > (long)2147483648)
            {
                SofSFLab.Font      = new Font(SofSFLab.Font, FontStyle.Bold);
                SofSFLab.ForeColor = Color.DarkRed;
                SofSFLab.Cursor    = Cursors.Help;
                SizeWarning.SetToolTip(SofSFLab, "SoundFonts bigger than 2GB may not load correctly\non 32-bit applications, cause audio corruptions or even cause loss of data!\n\nBe careful!");
            }

            if (Path.GetExtension(sf).ToLowerInvariant() == ".sfz")
            {
                SofSFLab.Text = String.Format("{0} (Samples: {1}, Presets: {2})",
                                              Functions.ReturnLength(f.Length + SFZ.GetSoundFontZSize(sf), true),
                                              Functions.ReturnLength(SFZ.GetSoundFontZSize(sf), true),
                                              Functions.ReturnLength(f.Length - (long)fontinfo.samsize, false));
            }
            else
            {
                SofSFLab.Text = String.Format("{0} (Samples: {1}, Presets: {2})",
                                              Functions.ReturnLength(f.Length, false),
                                              Functions.ReturnLength(fontinfo.samsize, false),
                                              Functions.ReturnLength(f.Length - (long)fontinfo.samsize, false));
            }

            SFfLab.Text      = SoundFontListExtension.ReturnSoundFontFormatMore(Path.GetExtension(next));
            CommentRich.Text = ReturnComment(fontinfo.comment);
            LELabel.Text     = f.LastWriteTimeUtc.ToString();

            BassMidi.BASS_MIDI_FontFree(fonthandle);
        }