summaryrefslogtreecommitdiff
path: root/muse2/muse/functions.cpp
diff options
context:
space:
mode:
authorFlorian Jung <flo@windfisch.org>2011-05-23 12:27:43 +0000
committerFlorian Jung <flo@windfisch.org>2011-05-23 12:27:43 +0000
commitcebe18a6c4211f23bc7cad82b4d9a9611a46234f (patch)
treece63faea8d1f544a013220b016f5b7f2b30c4a34 /muse2/muse/functions.cpp
parent53a36a7047584ce0e66e00815c501f59cac2fa14 (diff)
the "remove" function now supports velo- and length-thresholds
Diffstat (limited to 'muse2/muse/functions.cpp')
-rw-r--r--muse2/muse/functions.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/muse2/muse/functions.cpp b/muse2/muse/functions.cpp
index ba5f33c4..1ad81693 100644
--- a/muse2/muse/functions.cpp
+++ b/muse2/muse/functions.cpp
@@ -119,7 +119,8 @@ bool erase_notes(const set<Part*>& parts)
if (!erase_dialog->exec())
return false;
- erase_notes(parts,erase_dialog->range);
+ erase_notes(parts,erase_dialog->range, erase_dialog->velo_threshold, erase_dialog->velo_thres_used,
+ erase_dialog->len_threshold, erase_dialog->len_thres_used );
return true;
}
@@ -366,7 +367,7 @@ void quantize_notes(const set<Part*>& parts, int range, int raster, bool quant_l
}
}
-void erase_notes(const set<Part*>& parts, int range)
+void erase_notes(const set<Part*>& parts, int range, int velo_threshold, bool velo_thres_used, int len_threshold, bool len_thres_used)
{
map<Event*, Part*> events = get_events(parts, range);
@@ -378,8 +379,10 @@ void erase_notes(const set<Part*>& parts, int range)
{
Event& event=*(it->first);
Part* part=it->second;
-
- audio->msgDeleteEvent(event, part, false, false, false);
+ if ( (!velo_thres_used && !len_thres_used) ||
+ (velo_thres_used && event.velo() < velo_threshold) ||
+ (len_thres_used && int(event.lenTick()) < len_threshold) )
+ audio->msgDeleteEvent(event, part, false, false, false);
}
song->endUndo(SC_EVENT_REMOVED);