1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-09-17 16:50:26 +02:00

Imprement progress dialog.

Signed-off-by: Max Maisel <max.maisel@posteo.de>
This commit is contained in:
Max Maisel 2020-03-08 10:00:59 +01:00
parent 1d7b143c91
commit 277f64c4ca

View File

@ -995,7 +995,6 @@ void EffectCompressor2::SwapPipeline()
std::cerr << "\n" << std::flush; std::cerr << "\n" << std::flush;
#endif #endif
++mProgressVal;
for(size_t i = 0; i < PIPELINE_DEPTH-1; ++i) for(size_t i = 0; i < PIPELINE_DEPTH-1; ++i)
mPipeline[i].swap(mPipeline[i+1]); mPipeline[i].swap(mPipeline[i+1]);
#ifdef DEBUG_COMPRESSOR2_TRACE #ifdef DEBUG_COMPRESSOR2_TRACE
@ -1063,6 +1062,9 @@ bool EffectCompressor2::ProcessOne(TrackIterRange<WaveTrack> range)
// Increment s one blockfull of samples // Increment s one blockfull of samples
pos += blockLen; pos += blockLen;
if(!UpdateProgress())
return false;
} }
// Handle short selections // Handle short selections
@ -1079,6 +1081,8 @@ bool EffectCompressor2::ProcessOne(TrackIterRange<WaveTrack> range)
#endif #endif
SwapPipeline(); SwapPipeline();
FillPipeline(); FillPipeline();
if(!UpdateProgress())
return false;
} }
while(PipelineHasData()) while(PipelineHasData())
@ -1086,6 +1090,8 @@ bool EffectCompressor2::ProcessOne(TrackIterRange<WaveTrack> range)
StorePipeline(range); StorePipeline(range);
SwapPipeline(); SwapPipeline();
DrainPipeline(); DrainPipeline();
if(!UpdateProgress())
return false;
} }
#ifdef DEBUG_COMPRESSOR2_TRACE #ifdef DEBUG_COMPRESSOR2_TRACE
std::cerr << "StoreLastBlock\n" << std::flush; std::cerr << "StoreLastBlock\n" << std::flush;
@ -1289,6 +1295,14 @@ void EffectCompressor2::StorePipeline(TrackIterRange<WaveTrack> range)
mPipeline[0].size = 0; mPipeline[0].size = 0;
} }
bool EffectCompressor2::UpdateProgress()
{
mProgressVal +=
(double(1+mProcStereo) * mPipeline[PIPELINE_DEPTH-1].trackSize)
/ (double(GetNumWaveTracks()) * mTrackLen);
return !TotalProgress(mProgressVal);
}
void EffectCompressor2::OnUpdateUI(wxCommandEvent & WXUNUSED(evt)) void EffectCompressor2::OnUpdateUI(wxCommandEvent & WXUNUSED(evt))
{ {
if(!mIgnoreGuiEvents) if(!mIgnoreGuiEvents)