Exemplo n.º 1
0
 public static Howl FromFile(string filename)
 {
     using (BinaryReaderEx br = new BinaryReaderEx(File.OpenRead(filename)))
     {
         return(Howl.FromReader(br));
     }
 }
Exemplo n.º 2
0
        public void ExportAll(int bnum, string path, string path2 = null)
        {
            int i = 0;

            foreach (KeyValuePair <int, byte[]> s in samples)
            {
                Export(s.Key, Howl.GetFreq(s.Key), path, path2, s.Key.ToString("0000") + "_" + s.Key.ToString("X4"));
                i++;
            }
        }
Exemplo n.º 3
0
        public void Export(int id, int freq, string path, string path2 = null, string name = null)
        {
            string pathSfxVag = Path.Combine(path, "wav");
            string pathSfxWav = Path.Combine(path, "vag");

            Helpers.CheckFolder(pathSfxVag);
            Helpers.CheckFolder(pathSfxWav);

            if (Contains(id))
            {
                string vagpath = Path.Combine(path, (path2 == null ? "vag" : path2));
                Directory.CreateDirectory(vagpath);

                //string vagname = vagpath + "\\" +  (name == null ?  (Howl.sampledict.ContainsKey(id) ? Howl.sampledict[id] : "sample_" + id.ToString("0000")) : name) + ".vag";
                string vagname = vagpath + "\\" + Howl.GetName(id, Howl.samplenames);


                /*
                 * if (name != null)
                 * {
                 *  vagname += (name != null ? name : "sample") + (Howl.samplenames.ContainsKey(id) ? "_" + Howl.samplenames[id] : "") + ".vag";
                 * }
                 * else
                 * {
                 *  vagname += "sample_" + id.ToString("0000") + ".vag";
                 * }
                 */

                Console.WriteLine(vagname);

                using (BinaryReaderEx br = new BinaryReaderEx(new MemoryStream(samples[id])))
                {
                    VagSample vag = new VagSample();
                    if (freq != -1)
                    {
                        vag.sampleFreq = freq;
                    }
                    if (Howl.samplenames.ContainsKey(id))
                    {
                        vag.SampleName = Howl.samplenames[id];
                    }
                    vag.ReadFrames(br, samples[id].Length);

                    vag.Save(vagname);
                    vag.ExportWav(vagname.Replace("vag", "wav")); //lmao
                }
            }
        }