mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-16 03:36:32 +01:00
Make normalize cancel button work.
git-svn-id: svn://localhost/ardour2/branches/3.0@7935 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
d731e4dba1
commit
6f9e9ad23e
6 changed files with 45 additions and 3 deletions
|
|
@ -35,6 +35,11 @@ public:
|
|||
void ascend ();
|
||||
void descend (float);
|
||||
|
||||
bool cancelled () const;
|
||||
|
||||
protected:
|
||||
void cancel ();
|
||||
|
||||
private:
|
||||
/** Report overall progress.
|
||||
* @param p Current progress (from 0 to 1)
|
||||
|
|
@ -49,6 +54,7 @@ private:
|
|||
};
|
||||
|
||||
std::list<Level> _stack;
|
||||
bool _cancelled;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1143,7 +1143,9 @@ AudioRegion::set_scale_amplitude (gain_t g)
|
|||
send_change (PropertyChange (Properties::scale_amplitude));
|
||||
}
|
||||
|
||||
/** @return the maximum (linear) amplitude of the region */
|
||||
/** @return the maximum (linear) amplitude of the region, or a -ve
|
||||
* number if the Progress object reports that the process was cancelled.
|
||||
*/
|
||||
double
|
||||
AudioRegion::maximum_amplitude (Progress* p) const
|
||||
{
|
||||
|
|
@ -1173,6 +1175,9 @@ AudioRegion::maximum_amplitude (Progress* p) const
|
|||
|
||||
fpos += to_read;
|
||||
p->set_progress (float (fpos - _start) / _length);
|
||||
if (p->cancelled ()) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
return maxamp;
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@
|
|||
using namespace std;
|
||||
|
||||
ARDOUR::Progress::Progress ()
|
||||
: _cancelled (false)
|
||||
{
|
||||
descend (1);
|
||||
}
|
||||
|
|
@ -70,3 +71,15 @@ ARDOUR::Progress::set_progress (float p)
|
|||
|
||||
set_overall_progress (overall);
|
||||
}
|
||||
|
||||
void
|
||||
ARDOUR::Progress::cancel ()
|
||||
{
|
||||
_cancelled = true;
|
||||
}
|
||||
|
||||
bool
|
||||
ARDOUR::Progress::cancelled () const
|
||||
{
|
||||
return _cancelled;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue