[Clam-devel] [Patch] - Resize / Setsize Issue in SpectralPeakArray
yushen.han at gmail.com
Fri Jun 20 12:46:48 PDT 2008
I send this patch (my first patch to CLAM) to fix a problem that
leads to a setsize-without-resize error, which is given by array.hxx.
(Actually I do not understand the necessity in array.hxx that requires
us to do both of setsize and resize.)
The error occured when I modified Greg's LoopingSDIFFileReader.cxx to
be SDIFFileReaderWithLoop.cxx in my simpleOboeSynthesizer.
It came from something like:
// typedef Array<TData> DataArray; in array.hxx
DataArray& srcFreqBuffer1 = sourceSpectralPeaks1.GetFreqBuffer();
DataArray& srcMagBuffer1 = sourceSpectralPeaks1.GetMagBuffer(); //
this will give the Setsize error
To fix this, I add Resize() before Setsize() in SpectralPeakArray.hxx,
which is in CLAM/src/Data/BasicProcessing/
(Do you think it is better if we put the code in SpectralPeakArray.cxx
instead of *.hxx?)
/** Sets the actual size of the different instantiated buffers keeping them
* consistent. If allocated size is less than npeaks, a resize is automatically
* performed on all buffers.
// I think we need the Resize() as well. It does not hurt at least. - Yushen Han
void SetnPeaks(TSize npeaks)
if (npeaks>GetnMaxPeaks()) SetnMaxPeaks(npeaks);
I think this may affect quite a few files since SpectralPeakArray is
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 1520 bytes
Desc: not available
More information about the clam-devel