... tolerant comparison of pps values allows more cache reuse and avoids the
changing alignment of pixels to samples that causes the "shimmery" update.
Simplify the partial copying of wave and spectrum caches. Use memcpy for speed.
Don't memcpy out of the caches into temporary buffers for TrackArtist,
just pass
pointers.
More vectors in the cache classes, fewer deletes.
Pulled big loop, and its body, out of the spectrogram routine into functions.
Don't read "/Spectrum/" preferences anywhere but in SpectrumPrefs.cpp.
Don't store global values in TrackArtist.
Possibly some day, there will be other instances of SpectrogramSettings so we
can have independent per-track settings.
Zooming-in of spectrograms (or other view changes that invalidate the
whole pixel cache of the WaveClip) used to do at least one opening and
closing of a block file for each column of pixels. With this change,
open each block file not more than once for each repopulation of the
cache.
Improved speed may be more noticeable on less powerful computers, or when
the audio file is in a slower storage device.
That is the function that computes the heights of dark and pale blue lines in
the waveform display.
It's not simple but now the flow of control is less strange and it is better
commented.
This doesn't fix or enhance anything, but it might find use later, such as in
a project to adapt the resolution of the display in reponse to slow scrolling
updates.
This will matter if the smooth-scrolling version of scrubbing is enabled
The problem was accumulation of roundoff errors when deciding which pixel
column data to copy from old caches to new caches, when the number of samples
scrolled was not an integer multiple of samples per pixel (itself, not always
an integer)
Thus repeated scrolling by small amounts caused the wave display or spectrogram
to creep relative to the time ruler!
The functions wxString::Format, wxString::Printf (and others indirectly) have become stricter about parameter types that don't match (format specifier vs. function parameters). So the bugs (that were already present in audacity before) become visible in wx3.0 as error message dialogs. I've checked all occurrences of Printf, wxPrintf, PrintfV, Format, FormatV, wxLogDebug and wxLogError systematically and made the type match.
Note: In Shuttle.cpp this patch supersedes one related change done in r13466 because a wxLongLong_t can be bigger than an int and in a generic function like "TransferLongLong" this should be taken into account.
For Resample.* and QualityPrefs.cpp, this commit has my restructuring for distinguishing constant-rate vs variable-rate resamplers more generally. I think it's complete and ready for const-rate, but I have more review and testing to do for the var-rate cases.
Variable-rate resampling is not implemented here, so Time Tracks are still broken, but this is a milestone in getting to a more general and correct structure.
Also I think this fixes AboutDialog issues Steve noticed.
* Fix P2 bug described by Bill Wharrie in "Problem dragging clips between tracks with different sample rates" thread on audacity-quality. Made sure the clips get resampled to the destination WaveTrack rate, and marked changed.
* Comment out unused override of WaveTrack::MoveClipToTrack().
* Added an ANSWER-ME about what appears to be a useless declaration and assignment.
In WaveClip.cpp, remove wxASSERT that Michael was trying to convince me to do yesterday. In debugging this, found a case when it's not a bad call. Thanks, Michael! :-)
In TrackPanel.cpp, removed some cruft.
* Fix memory leaks.
* Add comments about initializations and checking for successful results.
* Add checks for NULL deref.
* Consistency in "TODO" vs "TO-DO" comments!
Correct Sequence::ConvertToSampleFormat() errors resulting in wrong block file sizes, per offline discussions with Martyn and James.
In WaveClip::ConvertToSampleFormat(), distinguish between failure and no change.
Changed deprecated calls to wxArray::Count() to GetCount(),
In Sequence::Blockify(), no reason to call Alloc() if we know we have no samples, so rearranged that code.
Changes per Martyn's suggestion (http://bugzilla.audacityteam.org/show_bug.cgi?id=451#c24), i.e., deal with sample format mismatch in WaveClip::Paste() and Sequence::Paste().
Also add error checking for bad s parameter values passed to Sequence::Paste().