Ejemplo n.º 1
0
        private void PerformRAMCheck()
        {
            ulong check = (ulong)(BytesVal.Value / RatioVal.Value);

            if (check >= (installedMemory / 8))
            {
                if ((check >= installedMemory) || ((RatioVal.Value == 1) && (GetRAMSize.Checked == true)))
                {
                    WarningPanel.Visible  = true;
                    WarningSign.Image     = KeppySynthConfigurator.Properties.Resources.wir;
                    WarningLabel.Text     = String.Format("ERROR:\nSorry, but no.");
                    ApplySettings.Enabled = false;
                }
                else
                {
                    WarningPanel.Visible = true;
                    WarningSign.Image    = KeppySynthConfigurator.Properties.Resources.wi;
                    WarningLabel.Text    = String.Format("WARNING:\nLeave at least {0} of RAM available for Windows.",
                                                         SFListFunc.ReturnSoundFontSize(null, "evbuff", (long)installedMemory / 8));
                    ApplySettings.Enabled = true;
                }
            }
            else
            {
                WarningPanel.Visible  = false;
                ApplySettings.Enabled = true;
            }
        }
Ejemplo n.º 2
0
        public SoundFontInfo(String SoundFont)
        {
            InitializeComponent();

            ERROR = false;

            LastMIDIPath = KeppySynthConfiguratorMain.SynthPaths.GetValue("lastpathmidimport", Environment.GetFolderPath(Environment.SpecialFolder.Desktop)).ToString();

            // 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))
                {
                    Functions.ShowErrorDialog(2, System.Media.SystemSounds.Exclamation, "Error", String.Format("The SoundFont \"{0}\" doesn't exist.", SoundFont), false, null);
                    ERROR = true;
                    Close();
                    return;
                }
                SoundFontT = sf;
                fonthandle = BassMidi.BASS_MIDI_FontInit(sf);
                f          = new FileInfo(sf);
                next       = sf;
            }
            else
            {
                sf = SoundFont;
                if (!File.Exists(SoundFont))
                {
                    Functions.ShowErrorDialog(2, System.Media.SystemSounds.Exclamation, "Error", String.Format("The SoundFont \"{0}\" doesn't exist.", SoundFont), false, null);
                    ERROR = true;
                    Close();
                    return;
                }
                SoundFontT = SoundFont;
                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 + SFZInfo.GetSoundFontZSize(sf)),
                                              Functions.ReturnLength(SFZInfo.GetSoundFontZSize(sf)),
                                              Functions.ReturnLength(f.Length - (long)fontinfo.samsize));
            }
            else
            {
                SofSFLab.Text = String.Format("{0} (Samples: {1}, Presets: {2})",
                                              Functions.ReturnLength(f.Length),
                                              Functions.ReturnLength(fontinfo.samsize),
                                              Functions.ReturnLength(f.Length - (long)fontinfo.samsize));
            }

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

            BassMidi.BASS_MIDI_FontFree(fonthandle);
        }
Ejemplo n.º 3
0
 private void WarningLabel_Click(object sender, EventArgs e)
 {
     MessageBox.Show(String.Format("Leave at least 1/8 of RAM ({0}) available to Windows, to avoid unexpected data loss and system crashes.\n\nRemember, you're responsible of anything that might happen after tampering with this setting.",
                                   SFListFunc.ReturnSoundFontSize(null, "evbuff", (long)installedMemory / 8)),
                     "What does this warning mean?", MessageBoxButtons.OK, MessageBoxIcon.Warning);
 }