Bug2586: .aup with envelopes in wave tracks should import correctly

This commit is contained in:
Paul Licameli 2020-11-19 16:48:41 -05:00
parent 14c300c672
commit 6dea5434a6
2 changed files with 8 additions and 2 deletions

View File

@ -1172,8 +1172,9 @@ void WaveClip::ConvertToSampleFormat(sampleFormat format,
/*! @excsafety{No-fail} */
void WaveClip::UpdateEnvelopeTrackLen()
{
mEnvelope->SetTrackLen
((mSequence->GetNumSamples().as_double()) / mRate, 1.0 / GetRate());
auto len = (mSequence->GetNumSamples().as_double()) / mRate;
if (len != mEnvelope->GetTrackLen())
mEnvelope->SetTrackLen(len, 1.0 / GetRate());
}
void WaveClip::TimeToSamplesClip(double t0, sampleCount *s0) const

View File

@ -213,6 +213,7 @@ private:
WaveTrack *mWaveTrack;
WaveClip *mClip;
std::vector<WaveClip *> mClips;
ProgressResult mUpdateResult;
TranslatableString mErrorMsg;
@ -367,6 +368,9 @@ ProgressResult AUPImportFileHandle::Import(WaveTrackFactory *WXUNUSED(trackFacto
processed += fi.len;
}
for (auto pClip : mClips)
pClip->UpdateEnvelopeTrackLen();
wxASSERT( mUpdateResult == ProgressResult::Success );
// If the active project is "dirty", then bypass the below updates as we don't
@ -1031,6 +1035,7 @@ bool AUPImportFileHandle::HandleWaveClip(XMLTagHandler *&handler)
}
mClip = static_cast<WaveClip *>(handler);
mClips.push_back(mClip);
return true;
}