mirror of
https://github.com/cookiengineer/audacity
synced 2025-10-26 15:23:48 +01:00
Bug1632: correct length of non-WAV exports >= 2^32 samples long...
... WAV format simply can't do that, others (FLAC, ogg, mp3) can and should Some history: This got broken very badly for an interim starting at919d77d176. Exported files were only tens of bytes! This was broken differently afterad04187a41with symptoms as in the bug report.
This commit is contained in:
10
src/Mix.cpp
10
src/Mix.cpp
@@ -540,7 +540,6 @@ size_t Mixer::MixSameRate(int *channelFlags, WaveTrackCache &cache,
|
||||
sampleCount *pos)
|
||||
{
|
||||
const WaveTrack *const track = cache.GetTrack();
|
||||
auto slen = mMaxOut;
|
||||
const double t = ( *pos ).as_double() / track->GetRate();
|
||||
const double trackEndTime = track->GetEndTime();
|
||||
const double trackStartTime = track->GetStartTime();
|
||||
@@ -553,10 +552,13 @@ size_t Mixer::MixSameRate(int *channelFlags, WaveTrackCache &cache,
|
||||
if ((backwards ? t <= tEnd : t >= tEnd))
|
||||
return 0;
|
||||
//if we're about to approach the end of the track or selection, figure out how much we need to grab
|
||||
slen = std::min<decltype(slen)>( slen,
|
||||
((backwards ? t - tEnd : tEnd - t) * track->GetRate() + 0.5)
|
||||
auto slen = limitSampleBufferSize(
|
||||
mMaxOut,
|
||||
// PRL: maybe t and tEnd should be given as sampleCount instead to
|
||||
// avoid trouble subtracting one large value from another for a small
|
||||
// difference
|
||||
sampleCount{ (backwards ? t - tEnd : tEnd - t) * track->GetRate() + 0.5 }
|
||||
);
|
||||
slen = std::min(slen, mMaxOut);
|
||||
|
||||
if (backwards) {
|
||||
auto results = cache.Get(floatSample, *pos - (slen - 1), slen, mMayThrow);
|
||||
|
||||
Reference in New Issue
Block a user