summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--muse2/muse/functions.cpp11
-rw-r--r--muse2/muse/functions.h2
-rw-r--r--muse2/muse/midiedit/scoreedit.cpp8
-rw-r--r--muse2/muse/widgets/function_dialogs/remove.cpp20
-rw-r--r--muse2/muse/widgets/function_dialogs/remove.h4
-rw-r--r--muse2/muse/widgets/function_dialogs/removebase.ui129
6 files changed, 162 insertions, 12 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);
diff --git a/muse2/muse/functions.h b/muse2/muse/functions.h
index 4d7be6e2..18f6e3ec 100644
--- a/muse2/muse/functions.h
+++ b/muse2/muse/functions.h
@@ -43,7 +43,7 @@ void modify_velocity(const std::set<Part*>& parts, int range, int rate, int offs
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, bool len=false, int strength=100, int swing=0, int threshold=0);
-void erase_notes(const std::set<Part*>& parts, int range);
+void erase_notes(const std::set<Part*>& parts, int range, int velo_threshold=0, bool velo_thres_used=false, int len_threshold=0, bool len_thres_used=false);
void delete_overlaps(const std::set<Part*>& parts, int range);
void set_notelen(const std::set<Part*>& parts, int range, int len);
void move_notes(const std::set<Part*>& parts, int range, signed int ticks);
diff --git a/muse2/muse/midiedit/scoreedit.cpp b/muse2/muse/midiedit/scoreedit.cpp
index b0e0eaf6..2636d4f2 100644
--- a/muse2/muse/midiedit/scoreedit.cpp
+++ b/muse2/muse/midiedit/scoreedit.cpp
@@ -4255,27 +4255,23 @@ void staff_t::apply_lasso(QRect rect, set<Event*>& already_processed)
/* BUGS and potential bugs
- * o quantize always quantizes length. make this selectable!
* o when the keymap is not used, this will probably lead to a bug
* same when mastertrack is disabled
* o tied notes don't work properly when there's a key-change in
* between, for example, when a cis is tied to a des
*
* CURRENT TODO
- * o drum list: scroll while dragging
+ * o legato: extend length to next note
*
* IMPORTANT TODO
* o do partial recalculating; recalculating can take pretty long
* (0,5 sec) when displaying a whole song in scores
* o transpose etc. must also transpose key-pressure events
* o transpose: support in-key-transpose
- * o legato: extend length to next note
- * o delete: add velo and len threshold
* o thin out: remove unneeded ctrl messages
- * o in drum roll: changing the list causes undo to be triggered, WTF?
- * o changing list is dead slow
*
* less important stuff
+ * o drum list: scroll while dragging
* o controller view in score editor
* o quantize-templates (everything is forced into a specified
* rhythm)
diff --git a/muse2/muse/widgets/function_dialogs/remove.cpp b/muse2/muse/widgets/function_dialogs/remove.cpp
index 5ad272ab..4a875135 100644
--- a/muse2/muse/widgets/function_dialogs/remove.cpp
+++ b/muse2/muse/widgets/function_dialogs/remove.cpp
@@ -25,6 +25,10 @@ Remove::Remove(QWidget* parent)
void Remove::pull_values()
{
range = range_group->checkedId();
+ len_thres_used=len_checkbox->isChecked();
+ len_threshold=len_spinbox->value();
+ velo_thres_used=velo_checkbox->isChecked();
+ velo_threshold=velo_spinbox->value();
}
void Remove::accept()
@@ -38,6 +42,10 @@ int Remove::exec()
if ((range < 0) || (range > 3)) range=0;
range_group->button(range)->setChecked(true);
+ len_checkbox->setChecked(len_thres_used);
+ len_spinbox->setValue(len_threshold);
+ velo_checkbox->setChecked(velo_thres_used);
+ velo_spinbox->setValue(velo_threshold);
return QDialog::exec();
}
@@ -56,6 +64,14 @@ void Remove::read_configuration(Xml& xml)
case Xml::TagStart:
if (tag == "range")
range=xml.parseInt();
+ else if (tag == "velo_threshold")
+ velo_threshold=xml.parseInt();
+ else if (tag == "velo_thres_used")
+ velo_thres_used=xml.parseInt();
+ else if (tag == "len_threshold")
+ len_threshold=xml.parseInt();
+ else if (tag == "len_thres_used")
+ len_thres_used=xml.parseInt();
else
xml.unknown("Erase");
break;
@@ -74,5 +90,9 @@ void Remove::write_configuration(int level, Xml& xml)
{
xml.tag(level++, "erase");
xml.intTag(level, "range", range);
+ xml.intTag(level, "velo_threshold", velo_threshold);
+ xml.intTag(level, "velo_thres_used", velo_thres_used);
+ xml.intTag(level, "len_threshold", len_threshold);
+ xml.intTag(level, "len_thres_used", len_thres_used);
xml.tag(level, "/erase");
}
diff --git a/muse2/muse/widgets/function_dialogs/remove.h b/muse2/muse/widgets/function_dialogs/remove.h
index 5615ed42..4c1a91e9 100644
--- a/muse2/muse/widgets/function_dialogs/remove.h
+++ b/muse2/muse/widgets/function_dialogs/remove.h
@@ -27,6 +27,10 @@ class Remove : public QDialog, public Ui::RemoveBase
Remove(QWidget* parent = 0);
int range;
+ int velo_threshold;
+ bool velo_thres_used;
+ int len_threshold;
+ bool len_thres_used;
void read_configuration(Xml& xml);
void write_configuration(int level, Xml& xml);
diff --git a/muse2/muse/widgets/function_dialogs/removebase.ui b/muse2/muse/widgets/function_dialogs/removebase.ui
index 3381795c..79d541cc 100644
--- a/muse2/muse/widgets/function_dialogs/removebase.ui
+++ b/muse2/muse/widgets/function_dialogs/removebase.ui
@@ -10,7 +10,7 @@
<x>0</x>
<y>0</y>
<width>275</width>
- <height>195</height>
+ <height>443</height>
</rect>
</property>
<property name="windowTitle">
@@ -70,6 +70,101 @@
</widget>
</item>
<item>
+ <widget class="QGroupBox" name="groupBox_2">
+ <property name="title">
+ <string>Thresholds</string>
+ </property>
+ <property name="flat">
+ <bool>false</bool>
+ </property>
+ <property name="checkable">
+ <bool>false</bool>
+ </property>
+ <layout class="QGridLayout" name="gridLayout">
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <item row="0" column="1">
+ <widget class="QSpinBox" name="velo_spinbox">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="accelerated">
+ <bool>true</bool>
+ </property>
+ <property name="suffix">
+ <string/>
+ </property>
+ <property name="minimum">
+ <number>0</number>
+ </property>
+ <property name="maximum">
+ <number>127</number>
+ </property>
+ <property name="singleStep">
+ <number>1</number>
+ </property>
+ <property name="value">
+ <number>16</number>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1">
+ <widget class="QSpinBox" name="len_spinbox">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="suffix">
+ <string> ticks</string>
+ </property>
+ <property name="maximum">
+ <number>10000</number>
+ </property>
+ <property name="value">
+ <number>12</number>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="0">
+ <widget class="QCheckBox" name="velo_checkbox">
+ <property name="text">
+ <string>Velocity</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0">
+ <widget class="QCheckBox" name="len_checkbox">
+ <property name="text">
+ <string>Length</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="0" colspan="2">
+ <widget class="QLabel" name="label">
+ <property name="text">
+ <string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
+&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
+p, li { white-space: pre-wrap; }
+&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Sans'; font-size:9pt; font-weight:400; font-style:normal;&quot;&gt;
+&lt;p style=&quot; margin-top:0px; margin-bottom:7px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;If nothing is checked, everything is removed.&lt;/p&gt;
+&lt;p style=&quot; margin-top:0px; margin-bottom:7px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;If velocity is checked, only notes with velo &amp;lt; threshold are removed.&lt;/p&gt;
+&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;If both are checked, notes with velo &amp;lt; threshold OR with length &amp;lt; threshold are removed.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+ </property>
+ <property name="textFormat">
+ <enum>Qt::AutoText</enum>
+ </property>
+ <property name="wordWrap">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item>
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="spacing">
<number>6</number>
@@ -149,5 +244,37 @@
</hint>
</hints>
</connection>
+ <connection>
+ <sender>velo_checkbox</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>velo_spinbox</receiver>
+ <slot>setEnabled(bool)</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>83</x>
+ <y>192</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>198</x>
+ <y>193</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>len_checkbox</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>len_spinbox</receiver>
+ <slot>setEnabled(bool)</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>83</x>
+ <y>221</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>198</x>
+ <y>222</y>
+ </hint>
+ </hints>
+ </connection>
</connections>
</ui>