示例#1
0
        static void Main(string[] args)
        {
            //Start.
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            //Argument mode.
            if (args.Length > 0)
            {
                //Switch type.
                switch (Path.GetExtension(args[0]))
                {
                //Sound archive.
                case ".sdat":
                    Application.Run(new MainWindow(args[0]));
                    break;

                //Sound sequence.
                case ".sseq":
                    Application.Run(new SequenceEditor(args[0]));
                    break;

                //Sound archive.
                case ".ssar":
                    Application.Run(new SequenceArchiveEditor(args[0]));
                    break;

                //Sound bank.
                case ".sbnk":
                    Application.Run(new BankEditor(args[0]));
                    break;

                //Sound wave archive.
                case ".swar":
                    Application.Run(new WaveArchiveEditor(args[0]));
                    break;

                //Stream.
                case ".strm":
                    RiffWave r = new RiffWave();
                    NitroFileLoader.Stream s = new NitroFileLoader.Stream();
                    s.Read(args[0]);
                    r.FromOtherStreamFile(s);
                    r.Write(MainWindow.NitroPath + "/" + "tmpStream" + 0 + ".wav");
                    Application.Run(new StreamPlayer(null, MainWindow.NitroPath + "/" + "tmpStream" + 0 + ".wav", Path.GetFileNameWithoutExtension(args[0])));
                    break;
                }
            }
            else
            {
                //Start the editor.
                Application.Run(new MainWindow());
            }
        }
示例#2
0
 /// <summary>
 /// Load a stream.
 /// </summary>
 /// <param name="s">The sound file.</param>
 public void LoadStream(SoundFile s)
 {
     Riff = new RiffWave();
     Riff.FromOtherStreamFile(s);
     MemoryStream   = new MemoryStream(Riff.Write());
     WaveFileReader = new WaveFileReader(MemoryStream);
     SoundOut.Dispose();
     SoundOut   = new WaveOut();
     LoopStream = new LoopStream(this, WaveFileReader, Riff.Loops && Loop, s.LoopStart, (Riff.Loops && Loop) ? s.LoopEnd : (uint)s.Audio.NumSamples);
     try {
         SoundOut.Init(LoopStream);
     } catch (NAudio.MmException e) { SoundOut = new NullWavePlayer(); }
 }
示例#3
0
        /// <summary>
        /// Write a wave file.
        /// </summary>
        /// <param name="r">The riff wave.</param>
        public void WriteWave(RiffWave r)
        {
            //Make it so the sample block is not written.
            r.Loops = false;

            //Write the file and fix chunks.
            long bak = BaseStream.Position;

            Write(r.Write());
            long bak2 = BaseStream.Position;

            BaseStream.Position = bak;
            Write("LIST".ToCharArray());
            BaseStream.Position += 4;
            Write("wave".ToCharArray());
            BaseStream.Position = bak2;
        }
示例#4
0
        /// <summary>
        /// Write the text format, and dump files.
        /// </summary>
        /// <param name="path">The path.</param>
        /// <param name="name">The name.</param>
        public void WriteTextFormat(string path, string name)
        {
            //SWLS.
            List <string> swls = new List <string>();
            int           ind  = 0;

            Directory.CreateDirectory(path + "/" + name);
            foreach (var w in File.Waves)
            {
                swls.Add(name + "/" + ind.ToString("D4") + ".adpcm.swav");
                w.Write(path + "/" + name + "/" + ind.ToString("D4") + ".adpcm.swav");
                RiffWave r = new RiffWave();
                r.FromOtherStreamFile(w);
                r.Write(path + "/" + name + "/" + ind.ToString("D4") + ".wav");
                ind++;
            }
            System.IO.File.WriteAllLines(path + "/" + name + ".swls", swls);
        }
示例#5
0
        /// <summary>
        /// Export the wave.
        /// </summary>
        public override void NodeExport()
        {
            //Get the file.
            SaveFileDialog s = new SaveFileDialog();

            s.Filter           = "Supported Audio Files|*.wav;*.swav;*.strm|Wave|*.wav|Sound Wave|*.swav|Sound Stream|*.strm";
            s.RestoreDirectory = true;
            s.FileName         = "Wave " + tree.SelectedNode.Index + ".swav";
            s.ShowDialog();

            //If valid.
            if (s.FileName != "")
            {
                //Wave.
                Wave w = WA.Waves[tree.SelectedNode.Index];

                //Switch type.
                switch (Path.GetExtension(s.FileName))
                {
                case ".wav":
                    RiffWave r = new RiffWave();
                    r.FromOtherStreamFile(w);
                    r.Write(s.FileName);
                    break;

                case ".swav":
                    w.Write(s.FileName);
                    break;

                case ".strm":
                    NitroFileLoader.Stream stm = new NitroFileLoader.Stream();
                    stm.FromOtherStreamFile(w);
                    stm.Write(s.FileName);
                    break;

                default:
                    MessageBox.Show("Unsupported file format!");
                    return;
                }
            }
        }