示例#1
0
        public static SFZ LoadSFZ(string SFZPath)
        {
            try
            {
                if (GeneralSFZ != null) GeneralSFZ.Dispose();
                GeneralSFZ = new SFZ();
                GeneralSFZ.Load(SFZPath);
            }
            catch (Exception ex)
            {
                System.Windows.Forms.MessageBox.Show(ex.Message + ex.Source + ex.StackTrace);
            }

            return GeneralSFZ;
        }
示例#2
0
        private void btnLoadSFZ_Click(object sender, EventArgs e)
        {
            OpenFileDialog open = new OpenFileDialog();
            open.Title = "Select SFZ:";
            open.Filter = "SFZ Files (*.sfz)|*.sfz";
            open.ShowDialog();

            if (!File.Exists(open.FileName)) return;

            tvSFZ.Nodes.Clear();

            try
            {
                UtilityAudio.OpenAudio(AudioLibrary.NAudio, eccGeneral.EffectChain);
                UtilityAudio.StopAudio();

                sfz = UtilityAudio.LoadSFZ(open.FileName);
                sfz.SFZUpdated += new SFZ.SFZUpdatedEventHandler(SFZUpdated);

                txtSFZFile.Text = open.FileName;

                foreach (SFZGroup Group in sfz.Groups)
                {
                    TreeNode node = new TreeNode();
                    node.Tag = Group;
                    node.Text = Group.ToString();
                    foreach (SFZRegion Region in Group.Regions)
                    {
                        TreeNode child = new TreeNode();
                        child.Tag = Region;
                        child.Text = Region.ToString();
                        if (Region.IDEffectChain == 0)
                            child.BackColor = Color.White;
                        else child.BackColor = Color.FromArgb(255, 255, 50 * Region.IDEffectChain);

                        node.Nodes.Add(child);
                    }
                    tvSFZ.Nodes.Add(node);
                }
                UtilityAudio.StartAudio();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace);
            }
        }