Ejemplo n.º 1
0
        private void buttonTrim_Click(object sender, EventArgs e)
        {
            TrackEdit edit = new TrackEdit();

            SaveFileDialog save      = new SaveFileDialog();
            string         minAmount = Convert.ToString(TimeMP3(openWavTrack.inputpath).Minutes);
            string         secAmount = Convert.ToString(TimeMP3(openWavTrack.inputpath).Seconds);

            save.Filter = "Audio File (*.mp3)|*.mp3;";
            if (save.ShowDialog() != DialogResult.OK)
            {
                return;
            }
            double start   = edit.TrimArgs(textBox1.Text, textBox3.Text);
            double end     = edit.TrimArgs(textBox2.Text, textBox4.Text);
            double endTime = edit.TrimArgs(minAmount, secAmount);

            try
            {
                if (start == end || start < 0 || end < 0 || start > end || end > endTime || start > endTime)
                {
                    throw new Exception();
                }
                edit.inputPath  = openWavTrack.inputpath;
                edit.outputPath = save.FileName;
                edit.Trim(TimeSpan.FromSeconds(start), TimeSpan.FromSeconds(end));
            }
            catch (Exception)
            {
            }
        }
Ejemplo n.º 2
0
        private void buttonCombine_Click(object sender, EventArgs e)
        {
            OpenFileDialog opencompile = new OpenFileDialog();

            opencompile.Multiselect = true;

            opencompile.Filter = "Audio File (*.mp3)|*.mp3;";

            if (opencompile.ShowDialog() == DialogResult.OK)
            {
                foreach (string file in opencompile.FileNames)
                {
                    MessageBox.Show(file);
                }
            }

            SaveFileDialog save = new SaveFileDialog();

            save.Filter = "Audio File (*.mp3)|*.mp3;";
            if (save.ShowDialog() != DialogResult.OK)
            {
                return;
            }
            FileStream compile     = new System.IO.FileStream(save.FileName, FileMode.Create);
            TrackEdit  editcompile = new TrackEdit();

            editcompile.inputFiles = opencompile.FileNames;
            editcompile.output     = compile;
            editcompile.Combine();
        }