Rate limit progress-report, reduce excessive UI load
Session-archive or region analysis can produce excessive progress callbacks (for each N samples read from disk).
This commit is contained in:
parent
b3d3944451
commit
d2b24e8689
@ -23,19 +23,24 @@
|
||||
#include "progress_reporter.h"
|
||||
|
||||
ProgressReporter::ProgressReporter ()
|
||||
: _p (-1)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
ProgressReporter::~ProgressReporter ()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
ProgressReporter::set_overall_progress (float p)
|
||||
{
|
||||
/* rate-limit, move in 0.2% steps */
|
||||
int pt = 500 * p;
|
||||
if (pt == _p && p > 0 && p < 1.0) {
|
||||
return;
|
||||
}
|
||||
_p = pt;
|
||||
|
||||
update_progress_gui (p);
|
||||
ARDOUR::GUIIdle ();
|
||||
}
|
||||
|
||||
|
@ -35,6 +35,7 @@ private:
|
||||
* @param p Progress, from 0 to 1.
|
||||
*/
|
||||
virtual void update_progress_gui (float p) = 0;
|
||||
int _p;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user