diff options
author | Bent Bisballe Nyeng <deva@aasimon.org> | 2013-04-23 20:43:59 +0200 |
---|---|---|
committer | Bent Bisballe Nyeng <deva@aasimon.org> | 2013-04-23 20:43:59 +0200 |
commit | eafdef4a5e7bb6cbed75b17a38a9b0e30c6e51a6 (patch) | |
tree | 61e74113c3b38df8aff60a764d36a884da1a597a /dgedit/canvastoolselections.cc | |
parent | 75ca97372cdcf9b42ada94bfdd13589d677cba91 (diff) |
Add some sliders to control internal parameters of the editor.
Diffstat (limited to 'dgedit/canvastoolselections.cc')
-rw-r--r-- | dgedit/canvastoolselections.cc | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/dgedit/canvastoolselections.cc b/dgedit/canvastoolselections.cc index 35c8e05..5188cb0 100644 --- a/dgedit/canvastoolselections.cc +++ b/dgedit/canvastoolselections.cc @@ -194,6 +194,17 @@ void CanvasToolSelections::thresholdChanged(double t) threshold = t; } +void CanvasToolSelections::noiseFloorChanged(int t) +{ + double div = 666.0 / 0.00003; + noise_floor = (double)t/div; +} + +void CanvasToolSelections::fadeoutChanged(int t) +{ + fadeout = (double)t/1000.0; +} + void CanvasToolSelections::autoCreateSelections() { float *data = canvas->data; @@ -218,17 +229,16 @@ void CanvasToolSelections::autoCreateSelections() } int minsize = 100; // attack. - float minval = 0.00003; // noise floor int to = i; float runavg = fabs(data[from]); - while((runavg > minval || + while((runavg > noise_floor || to < from + minsize) && to < (int)size) { double p = 0.9; runavg = runavg * p + fabs(data[to]) * (1 - p); to++; } - _selections[from] = Selection(from, to, 2, (to - from) / 3); + _selections[from] = Selection(from, to, 2, ((to - from) / 3) * fadeout); i = to+1; } |