Пример #1
0
        private void DoSingleProcess(AudioProcess proc)
        {
            try
            {
                string inputfile, outputfile;

                if (GetSingleInputFile(out inputfile, out outputfile))
                {
                    var buf2 = AudioFileReader.ReadAllSamples(inputfile);

                    var buf3 = proc.Do(buf2);

                    // TODO: 勝手に違う拡張子のファイルを探すのはやめる
                    WaveFileWriter.WriteAllSamples(outputfile, buf3, buf3.Length, 44100, 32);  // FIXME: サンプリングレートとビット深度
                }
            }
            catch (Exception e)
            {
                MessageBox.Show("エラーが起きちゃった・・・ごめんね・・・。\r\n\r\nstack trace: \r\n" + e.ToString(), "エラー", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Пример #2
0
        public void EffectSelector_SelectedIndexChanged(
            FlowLayoutPanel myFlowLayoutPanel,
            Label explanationLabel,
            ComboBox myComboBox,
            object sender,
            EventArgs e)
        {
            myFlowLayoutPanel.Controls.Clear();

            explanationLabel.Text = "Explanation here. Explanation here. Explanation here. Explanation here. Explanation here.";

            Type procType = Type.GetType("MiriaCore.AudioProcesses." + myComboBox.SelectedItem.ToString());

            inst = (AudioProcess)Activator.CreateInstance(procType);

            foreach (var prop in procType.GetProperties())
            {
                // パブリックかどうかをチェックする必要はないね?

                var p = new FlowLayoutPanel();
                p.FlowDirection = FlowDirection.LeftToRight;
                p.BorderStyle   = BorderStyle.None;
                p.AutoScroll    = false;
                p.WrapContents  = false;
                p.AutoSize      = true;
                p.Controls.Add(new Label()
                {
                    Text = prop.Name, Margin = new System.Windows.Forms.Padding(7)
                });
                var tbox = new TextBox()
                {
                    Text = prop.GetValue(inst).ToString(), Name = prop.Name
                };
                tbox.TextChanged += tbox_TextChanged;
                p.Controls.Add(tbox);

                myFlowLayoutPanel.Controls.Add(p);
            }
        }