summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--muse2/muse/functions.cpp7
-rw-r--r--muse2/muse/functions.h2
-rw-r--r--muse2/muse/midiedit/drumedit.cpp8
3 files changed, 12 insertions, 5 deletions
diff --git a/muse2/muse/functions.cpp b/muse2/muse/functions.cpp
index 3c6bbc89..ba5f33c4 100644
--- a/muse2/muse/functions.cpp
+++ b/muse2/muse/functions.cpp
@@ -108,7 +108,8 @@ bool quantize_notes(const set<Part*>& parts)
return false;
quantize_notes(parts, quantize_dialog->range, (config.division*4)/(1<<quantize_dialog->raster_power2),
- quantize_dialog->strength, quantize_dialog->swing, quantize_dialog->threshold);
+ quantize_dialog->quant_len, quantize_dialog->strength, quantize_dialog->swing,
+ quantize_dialog->threshold);
return true;
}
@@ -314,7 +315,7 @@ unsigned quantize_tick(unsigned tick, unsigned raster, int swing)
return tick_dest3;
}
-void quantize_notes(const set<Part*>& parts, int range, int raster, int strength, int swing, int threshold)
+void quantize_notes(const set<Part*>& parts, int range, int raster, bool quant_len, int strength, int swing, int threshold)
{
map<Event*, Part*> events = get_events(parts, range);
bool undo_started=false;
@@ -338,7 +339,7 @@ void quantize_notes(const set<Part*>& parts, int range, int raster, int strength
unsigned end_tick = begin_tick + len;
int len_diff = quantize_tick(end_tick, raster, swing) - end_tick;
- if (abs(len_diff) > threshold)
+ if ((abs(len_diff) > threshold) && quant_len)
len = len + len_diff*strength/100;
if (len <= 0)
diff --git a/muse2/muse/functions.h b/muse2/muse/functions.h
index 2b6dc711..4d7be6e2 100644
--- a/muse2/muse/functions.h
+++ b/muse2/muse/functions.h
@@ -42,7 +42,7 @@ std::map<Event*, Part*> get_events(const std::set<Part*>& parts, int range);
void modify_velocity(const std::set<Part*>& parts, int range, int rate, int offset=0);
void modify_off_velocity(const std::set<Part*>& parts, int range, int rate, int offset=0);
void modify_notelen(const std::set<Part*>& parts, int range, int rate, int offset=0);
-void quantize_notes(const std::set<Part*>& parts, int range, int raster, int strength=100, int swing=0, int threshold=0);
+void quantize_notes(const std::set<Part*>& parts, int range, int raster, bool len=false, int strength=100, int swing=0, int threshold=0);
void erase_notes(const std::set<Part*>& parts, int range);
void delete_overlaps(const std::set<Part*>& parts, int range);
void set_notelen(const std::set<Part*>& parts, int range, int len);
diff --git a/muse2/muse/midiedit/drumedit.cpp b/muse2/muse/midiedit/drumedit.cpp
index 9e64d7a7..97ab092e 100644
--- a/muse2/muse/midiedit/drumedit.cpp
+++ b/muse2/muse/midiedit/drumedit.cpp
@@ -908,7 +908,13 @@ void DrumEdit::cmd(int cmd)
case DrumCanvas::CMD_RESET: reset(); break;
case DrumCanvas::CMD_MODIFY_VELOCITY: modify_velocity(partlist_to_set(parts())); break;
case DrumCanvas::CMD_CRESCENDO: crescendo(partlist_to_set(parts())); break;
- case DrumCanvas::CMD_QUANTIZE: quantize_notes(partlist_to_set(parts())); break;
+ case DrumCanvas::CMD_QUANTIZE:
+ if (quantize_dialog->exec())
+ quantize_notes(partlist_to_set(parts()), quantize_dialog->range,
+ (config.division*4)/(1<<quantize_dialog->raster_power2),
+ /* quant_len= */false, quantize_dialog->strength,
+ quantize_dialog->swing, quantize_dialog->threshold);
+ break;
case DrumCanvas::CMD_ERASE_EVENT: erase_notes(partlist_to_set(parts())); break;
case DrumCanvas::CMD_DEL: erase_notes(partlist_to_set(parts()),1); break; //delete selected events
case DrumCanvas::CMD_DELETE_OVERLAPS: delete_overlaps(partlist_to_set(parts())); break;