Exemplo n.º 1
0
        private void PerformRAMCheck()
        {
            ulong check = (ulong)((ArraySize.Value * 4) / RatioVal.Value);

            if (check >= (installedMemory / 8))
            {
                if ((check >= installedMemory) || ((RatioVal.Value == 1) && (GetRAMSize.Checked == true)))
                {
                    WarningSign.Image = OmniMIDIConfigurator.Properties.Resources.wir;
                    WarningLabel.Text = String.Format("ERROR:\nYou cannot use all the available memory!\n(Size: {0} ({1} DWORDs * 4 / {2}))",
                                                      SFListFunc.ReturnSoundFontSize(null, "evbuff", (long)ArraySize.Value * 4 / (long)RatioVal.Value), ArraySize.Value, RatioVal.Value);
                    ApplySettings.Enabled = false;
                }
                else
                {
                    WarningSign.Image = OmniMIDIConfigurator.Properties.Resources.wi;
                    WarningLabel.Text = String.Format("WARNING:\nYou should leave at least {0} of RAM available to Windows.\n(Size: {1} ({2} DWORDs * 4 / {3}))",
                                                      SFListFunc.ReturnSoundFontSize(null, "evbuff", (long)installedMemory / 6),
                                                      SFListFunc.ReturnSoundFontSize(null, "evbuff", (long)ArraySize.Value * 4 / (long)RatioVal.Value), ArraySize.Value, RatioVal.Value);
                    ApplySettings.Enabled = true;
                }
            }
            else if (check > 1 && check < 128)
            {
                WarningSign.Image     = OmniMIDIConfigurator.Properties.Resources.wi;
                WarningLabel.Text     = "WARNING: You might experience lag when going below 128 bytes.";
                ApplySettings.Enabled = true;
            }
            else if (check == 1)
            {
                WarningSign.Image     = OmniMIDIConfigurator.Properties.Resources.wi;
                WarningLabel.Text     = String.Format("The final size will be {0}.\n(({1} DWORDs * 4) / {2})\nGood luck.", SFListFunc.ReturnSoundFontSize(null, "evbuff", (long)ArraySize.Value * 4 / (long)RatioVal.Value), ArraySize.Value, RatioVal.Value);
                ApplySettings.Enabled = true;
            }
            else if (check < 1)
            {
                WarningSign.Image     = OmniMIDIConfigurator.Properties.Resources.infoicon;
                WarningLabel.Text     = "ERROR:\nHooray, you found the easter egg! Now set a valid value.";
                ApplySettings.Enabled = false;
            }
            else
            {
                WarningSign.Image     = OmniMIDIConfigurator.Properties.Resources.successicon;
                WarningLabel.Text     = String.Format("The final size will be {0}.\n({1} DWORDs * 4) / {2})\nLooks good!", SFListFunc.ReturnSoundFontSize(null, "evbuff", (long)ArraySize.Value * 4 / (long)RatioVal.Value), ArraySize.Value, RatioVal.Value);
                ApplySettings.Enabled = true;
            }
        }
Exemplo n.º 2
0
        public SoundFontInfo(String SoundFont)
        {
            InitializeComponent();

            ERROR = false;

            LastMIDIPath = OmniMIDIConfiguratorMain.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(ErrorType.Error, 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(ErrorType.Error, 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), true),
                                              Functions.ReturnLength(SFZInfo.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      = SFListFunc.ReturnSoundFontFormatMore(Path.GetExtension(next));
            CommentRich.Text = ReturnComment(fontinfo.comment);
            LELabel.Text     = f.LastWriteTimeUtc.ToString();

            BassMidi.BASS_MIDI_FontFree(fonthandle);
        }
Exemplo 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);
 }