Ejemplo n.º 1
0
        private void exportButton_Click(object sender, EventArgs e)
        {
            //Test.
            if (impFileBox.Text.Equals(""))
            {
                MessageBox.Show("No Input File Selected!");
                return;
            }
            if (outFileBox.Text.Equals(""))
            {
                MessageBox.Show("No Output File Selected!");
                return;
            }

            //Sound file.
            SoundFile s;

            if (SwavMode)
            {
                s = new Wave();
            }
            else
            {
                s = new NitroFileLoader.Stream();
            }

            //Switch input file.
            SoundFile i;

            switch (Path.GetExtension(impFileBox.Text))
            {
            case ".swav":
                i = new Wave();
                break;

            case ".strm":
                i = new NitroFileLoader.Stream();
                break;

            default:
                i = new RiffWave();
                break;
            }
            i.Read(impFileBox.Text);

            //Get conversion type.
            Type convType;

            switch (outputFormat.SelectedIndex)
            {
            case 0:
                convType = typeof(PCM8Signed);
                break;

            case 1:
                convType = typeof(PCM16);
                break;

            default:
                convType = typeof(ImaAdpcm);
                break;
            }

            //Convert the file.
            s.FromOtherStreamFile(i, convType);

            //Save the file.
            s.Write(outFileBox.Text);
        }