3using System.Collections.Generic;
7using System.Threading.Tasks;
17 List<double[]> m_rgrgSamples;
31 m_rgrgSamples = rgrgSamples;
33 m_evtCancel = evtCancel;
49 get {
return m_rgrgSamples; }
60 throw new Exception(
"The new sample rate (" + nNewSamplesPerSecond.ToString() +
") must be less than the old sample rate (" + m_fmt.
nSamplesPerSec.ToString() +
").");
63 throw new Exception(
"The new sample rate (" + nNewSamplesPerSecond.ToString() +
") must be a factor of the old sample rate (" + m_fmt.
nSamplesPerSec.ToString() +
").");
66 List<
double[]> rgrgNewSamples =
new List<
double[]>();
67 List<double> rgSamples =
new List<double>();
69 int nTotal = m_rgrgSamples.Count * m_rgrgSamples[0].Length;
70 Stopwatch sw =
new Stopwatch();
74 for (
int i = 0; i < m_rgrgSamples.Count; i++)
76 for (
int j = 0; j < m_rgrgSamples[i].Length; j++)
80 double fVal = m_rgrgSamples[i][j];
86 if (sw.Elapsed.TotalMilliseconds > 1000)
88 double dfPct = (double)nIdx / (
double)nTotal;
89 m_log.
WriteLine(
"Downsampling at " + dfPct.ToString(
"P") +
"...");
97 rgrgNewSamples.Add(rgSamples.ToArray());
98 rgSamples =
new List<double>();
105 return new WAVProcessor(fmt, rgrgNewSamples, m_log, m_evtCancel);
The CancelEvent provides an extension to the manual cancel event that allows for overriding the manua...
bool WaitOne(int nMs=int.MaxValue)
Waits for the signal state to occur.
The Log class provides general output in text form.
void WriteLine(string str, bool bOverrideEnabled=false, bool bHeader=false, bool bError=false, bool bDisable=false)
Write a line of output.
The WAVProcessor is used to process WAV files and perform tasks such as downsampling.
WAVProcessor DownSample(int nNewSamplesPerSecond)
The DownSample method reduces the number of samples per second in the resulting sample set.
WaveFormat Format
Returns the WaveFormat.
List< double[]> Samples
Returns the WAV frequency samples.
WAVProcessor(WaveFormat fmt, List< double[]> rgrgSamples, Log log, CancelEvent evtCancel)
The constructor.
The MyCaffe.basecode contains all generic types used throughout MyCaffe.
The MyCaffe.db.stream namespace contains all data streaming related classes.
The MyCaffe namespace contains the main body of MyCaffe code that closesly tracks the C++ Caffe open-...