Exemple #1
0
        public static void Save(string newName, WaveScanner ws, int overhead, bool createLogs)
        {
            List <splitter> chains  = ARSplitter.GetChains(ws.NumFiles, overhead);
            int             chain_n = 1;

            foreach (splitter chain in chains)
            {
                WavCollection samples = ws.GetSamples(chain);
                Wav           total   = samples.GetChain();

                for (int k = 0; k < chain.fillers; k++)
                {
                    total.CatSilence(samples.MaxDuration());
                }

                int    tot = chain.chainLen + chain.fillers;
                string wavName, logName;
                mkNames(newName, tot, chain_n, out wavName, out logName);

                total.Save(wavName);
                if (createLogs)
                {
                    saveLog(logName, chain.fillers, samples);
                }
                chain_n++;
            }
        }
Exemple #2
0
 public Wav(Wav copy)
 {
     header       = new wavHeader(copy.header);
     format       = new wavFormat(copy.format);
     data         = new wavData(copy.data);
     OrigDuration = copy.OrigDuration;
     FileName     = copy.FileName;
     Name         = copy.Name;
 }
Exemple #3
0
            public void Cat(Wav inputFile)
            {
                byte[] temp = createTempCopy(inputFile.data.samples.Length);
                for (int k = 0; k < inputFile.data.samples.Length; k++)
                {
                    temp[k + samples.Length] = inputFile.data.samples[k];
                }

                assignTempCopy(temp);
            }
Exemple #4
0
        public Wav GetChain()
        {
            roundUp();
            Wav total = new Wav();

            foreach (Wav wf in waveList)
            {
                total.Cat(wf);
            }

            return(total);
        }
Exemple #5
0
        public string GetLongestSample(out int dur)
        {
            Wav wf = maxPtr();

            if (wf != null)
            {
                dur = wf.Duration;
                return(wf.Name);
            }

            dur = 0;
            return(null);
        }
Exemple #6
0
 public void Cat(Wav inputFile)
 {
     if (header == null)
     {
         header = new wavHeader(inputFile.header);
         format = new wavFormat(inputFile.format);
         data   = new wavData(inputFile.data);
     }
     else
     {
         data.Cat(inputFile);
     }
 }
Exemple #7
0
        private Wav maxPtr()
        {
            Wav rv     = null;
            int curDur = 0;

            foreach (Wav wf in waveList)
            {
                int dur = wf.OrigDuration;
                if (dur > curDur)
                {
                    curDur = dur;
                    rv     = wf;
                }
            }

            return(rv);
        }