summaryrefslogtreecommitdiff
path: root/muse2/muse
diff options
context:
space:
mode:
authorFlorian Jung <flo@windfisch.org>2011-10-09 17:10:21 +0000
committerFlorian Jung <flo@windfisch.org>2011-10-09 17:10:21 +0000
commit0e67ba1af056a0df0b6b01c70bb6cb12063479a8 (patch)
tree2bb8e8ef8ecc6f32274918a9d69b62b6f11faf98 /muse2/muse
parent9a4a4ee6fd5c2a73216240da912f7273aacaa11e (diff)
settings for importing midi
Diffstat (limited to 'muse2/muse')
-rw-r--r--muse2/muse/conf.cpp3
-rw-r--r--muse2/muse/gconfig.cpp1
-rw-r--r--muse2/muse/gconfig.h1
-rw-r--r--muse2/muse/importmidi.cpp21
-rw-r--r--muse2/muse/midiedit/scoreedit.cpp3
-rw-r--r--muse2/muse/widgets/configmidifilebase.ui491
-rw-r--r--muse2/muse/widgets/musewidgetsplug.cpp1
7 files changed, 285 insertions, 236 deletions
diff --git a/muse2/muse/conf.cpp b/muse2/muse/conf.cpp
index 027ad431..22259041 100644
--- a/muse2/muse/conf.cpp
+++ b/muse2/muse/conf.cpp
@@ -1610,6 +1610,8 @@ void MidiFileConfig::updateValues()
optNoteOffs->setChecked(MusEGlobal::config.expOptimNoteOffs);
twoByteTimeSigs->setChecked(MusEGlobal::config.exp2ByteTimeSigs);
splitPartsCheckBox->setChecked(MusEGlobal::config.importMidiSplitParts);
+ newDrumsCheckbox->setChecked(MusEGlobal::config.importMidiNewStyleDrum);
+ oldDrumsCheckbox->setChecked(!MusEGlobal::config.importMidiNewStyleDrum);
}
//---------------------------------------------------------
@@ -1629,6 +1631,7 @@ void MidiFileConfig::okClicked()
MusEGlobal::config.expOptimNoteOffs = optNoteOffs->isChecked();
MusEGlobal::config.exp2ByteTimeSigs = twoByteTimeSigs->isChecked();
MusEGlobal::config.importMidiSplitParts = splitPartsCheckBox->isChecked();
+ MusEGlobal::config.importMidiNewStyleDrum = newDrumsCheckbox->isChecked();
MusEGlobal::muse->changeConfig(true); // write config file
close();
diff --git a/muse2/muse/gconfig.cpp b/muse2/muse/gconfig.cpp
index 65397fe4..8aff870d 100644
--- a/muse2/muse/gconfig.cpp
+++ b/muse2/muse/gconfig.cpp
@@ -140,6 +140,7 @@ MusEGui::GlobalConfigValues config = {
false, // midi export file 2 byte timesigs instead of 4
true, // optimize midi export file note offs
true, // Split imported tracks into multiple parts.
+ true, // importMidiNewStyleDrum
1, // startMode
QString(""), // start song path
384, // gui division
diff --git a/muse2/muse/gconfig.h b/muse2/muse/gconfig.h
index a6b55557..cf205eba 100644
--- a/muse2/muse/gconfig.h
+++ b/muse2/muse/gconfig.h
@@ -121,6 +121,7 @@ struct GlobalConfigValues {
bool exp2ByteTimeSigs; // Export 2 byte time sigs instead of 4 bytes
bool expOptimNoteOffs; // Save space by replacing note offs with note on velocity 0
bool importMidiSplitParts; // Split imported tracks into multiple parts.
+ bool importMidiNewStyleDrum; // Use new style drum tracks
int startMode; // 0 - start with last song
// 1 - start with default template
diff --git a/muse2/muse/importmidi.cpp b/muse2/muse/importmidi.cpp
index 90e8cecb..86738fe4 100644
--- a/muse2/muse/importmidi.cpp
+++ b/muse2/muse/importmidi.cpp
@@ -181,8 +181,12 @@ bool MusE::importMidi(const QString name, bool merge)
MusECore::MidiTrack* track = new MusECore::MidiTrack();
if ((*t)->isDrumTrack)
- track->setType(MusECore::Track::NEW_DRUM); //FINDMICHJETZT config option
- //track->setType(MusECore::Track::DRUM);
+ {
+ if (MusEGlobal::config.importMidiNewStyleDrum)
+ track->setType(MusECore::Track::NEW_DRUM);
+ else
+ track->setType(MusECore::Track::DRUM);
+ }
track->setOutChannel(channel);
track->setOutPort(port);
@@ -201,12 +205,13 @@ bool MusE::importMidi(const QString name, bool merge)
// Hmm. buildMidiEventList already takes care of this.
// But it seems to work. How? Must test.
if (channel == 9 && MusEGlobal::song->mtype() != MT_UNKNOWN) {
- track->setType(MusECore::Track::NEW_DRUM); //FINDMICHJETZT config option
- /*
+ if (MusEGlobal::config.importMidiNewStyleDrum)
+ track->setType(MusECore::Track::NEW_DRUM);
+ else
+ {
track->setType(MusECore::Track::DRUM);
- //
+
// remap drum pitch with drumOutmap
- //
MusECore::EventList* tevents = track->events();
for (MusECore::iEvent i = tevents->begin(); i != tevents->end(); ++i) {
MusECore::Event ev = i->second;
@@ -222,9 +227,9 @@ bool MusE::importMidi(const QString name, bool merge)
if(mc)
ev.setA((ctl & ~0xff) | MusEGlobal::drumOutmap[ctl & 0x7f]);
}
- }
- */
}
+ }
+ }
processTrack(track);
diff --git a/muse2/muse/midiedit/scoreedit.cpp b/muse2/muse/midiedit/scoreedit.cpp
index 8f647966..cf436465 100644
--- a/muse2/muse/midiedit/scoreedit.cpp
+++ b/muse2/muse/midiedit/scoreedit.cpp
@@ -4603,6 +4603,9 @@ void ScoreCanvas::add_new_parts(const std::map< MusECore::Part*, std::set<MusECo
* - recording/echoing/steprec them
* - load, save them
* o fix valgrind problems
+ * x midi-import settings
+ * o support or handle duplicate enotes somehow!
+ * o steprec, test midi thru
*
* > o drum editor: channel-stuff
* o clearly state in the changelog: when having multiple drumeditors open,
diff --git a/muse2/muse/widgets/configmidifilebase.ui b/muse2/muse/widgets/configmidifilebase.ui
index 920596ec..c050450c 100644
--- a/muse2/muse/widgets/configmidifilebase.ui
+++ b/muse2/muse/widgets/configmidifilebase.ui
@@ -1,238 +1,273 @@
<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0" stdsetdef="1">
- <author></author>
- <comment></comment>
- <exportmacro></exportmacro>
- <class>ConfigMidiFileBase</class>
- <widget class="QDialog" name="ConfigMidiFileBase">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>548</width>
- <height>353</height>
- </rect>
- </property>
- <property name="windowTitle">
- <string>MusE: Config Midi File Import/Export</string>
- </property>
- <property name="sizeGripEnabled">
- <bool>true</bool>
- </property>
- <layout class="QVBoxLayout">
+<ui version="4.0">
+ <class>ConfigMidiFileBase</class>
+ <widget class="QDialog" name="ConfigMidiFileBase">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>548</width>
+ <height>346</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>MusE: Config Midi File Import/Export</string>
+ </property>
+ <property name="sizeGripEnabled">
+ <bool>true</bool>
+ </property>
+ <layout class="QVBoxLayout">
+ <item>
+ <widget class="QGroupBox" name="midiImportGroupBox">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Minimum">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="title">
+ <string>Import:</string>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout">
<item>
- <widget class="QGroupBox" name="midiImportGroupBox">
- <property name="sizePolicy">
- <sizepolicy>
- <hsizetype>5</hsizetype>
- <vsizetype>1</vsizetype>
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="title">
- <string>Import:</string>
- </property>
- <layout class="QGridLayout">
- <item row="0" column="0">
- <widget class="QCheckBox" name="splitPartsCheckBox">
- <property name="text">
- <string>Split tracks into &amp;parts</string>
- </property>
- <property name="shortcut">
- <string>Alt+P</string>
- </property>
- <property name="toolTip" stdset="0">
- <string>Split tracks into parts, or one single part</string>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
+ <widget class="QCheckBox" name="splitPartsCheckBox">
+ <property name="toolTip">
+ <string>Split tracks into parts, or one single part</string>
+ </property>
+ <property name="text">
+ <string>Split tracks into &amp;parts</string>
+ </property>
+ <property name="shortcut">
+ <string>Alt+P</string>
+ </property>
+ </widget>
</item>
<item>
- <widget class="QGroupBox" name="midiExportGroupBox">
- <property name="sizePolicy">
- <sizepolicy>
- <hsizetype>5</hsizetype>
- <vsizetype>7</vsizetype>
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <item>
+ <widget class="QRadioButton" name="newDrumsCheckbox">
+ <property name="text">
+ <string>Use new-style drum tracks</string>
</property>
- <property name="title">
- <string>Export:</string>
+ <property name="checked">
+ <bool>true</bool>
</property>
- <layout class="QGridLayout">
- <item row="2" column="1">
- <widget class="QLineEdit" name="copyrightEdit"/>
- </item>
- <item row="1" column="1">
- <widget class="QComboBox" name="divisionCombo">
- <item>
- <property name="text">
- <string>96</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>192</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>384</string>
- </property>
- </item>
- </widget>
- </item>
- <item row="3" column="0" rowspan="1" colspan="2">
- <widget class="QCheckBox" name="extendedFormat">
- <property name="enabled">
- <bool>true</bool>
- </property>
- <property name="text">
- <string>Enable extended smf format (currently not implemented)</string>
- </property>
- </widget>
- </item>
- <item row="4" column="0" rowspan="1" colspan="2">
- <widget class="QCheckBox" name="twoByteTimeSigs">
- <property name="text">
- <string>Use &amp;2-byte time signatures instead of standard 4</string>
- </property>
- <property name="shortcut">
- <string>Alt+2</string>
- </property>
- </widget>
- </item>
- <item row="2" column="0">
- <widget class="QLabel" name="textLabel2">
- <property name="text">
- <string>Copyright:</string>
- </property>
- <property name="wordWrap">
- <bool>false</bool>
- </property>
- </widget>
- </item>
- <item row="0" column="0">
- <widget class="QLabel" name="textLabel3">
- <property name="text">
- <string>Format:</string>
- </property>
- <property name="wordWrap">
- <bool>false</bool>
- </property>
- </widget>
- </item>
- <item row="1" column="0">
- <widget class="QLabel" name="textLabel1">
- <property name="text">
- <string>Division:</string>
- </property>
- <property name="wordWrap">
- <bool>false</bool>
- </property>
- </widget>
- </item>
- <item row="5" column="0" rowspan="1" colspan="2">
- <widget class="QCheckBox" name="optNoteOffs">
- <property name="text">
- <string>Save space by replacing note-offs with &amp;zero velocity note-ons</string>
- </property>
- <property name="shortcut">
- <string>Alt+Z</string>
- </property>
- </widget>
- </item>
- <item row="0" column="1">
- <widget class="QComboBox" name="formatCombo">
- <item>
- <property name="text">
- <string>0 (single track)</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>1 (multiple tracks)</string>
- </property>
- </item>
- </widget>
- </item>
- </layout>
- </widget>
- </item>
- <item>
- <layout class="QHBoxLayout">
- <property name="margin">
- <number>0</number>
+ </widget>
+ </item>
+ <item>
+ <widget class="QRadioButton" name="oldDrumsCheckbox">
+ <property name="text">
+ <string>Use old-style drum tracks</string>
</property>
- <property name="spacing">
- <number>6</number>
- </property>
- <item>
- <spacer name="Horizontal Spacing2">
- <property name="sizeHint">
- <size>
- <width>20</width>
- <height>20</height>
- </size>
- </property>
- <property name="sizeType">
- <enum>QSizePolicy::Expanding</enum>
- </property>
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- </spacer>
- </item>
- <item>
- <widget class="QPushButton" name="buttonOk">
- <property name="text">
- <string>&amp;OK</string>
- </property>
- <property name="shortcut">
- <string/>
- </property>
- <property name="autoDefault">
- <bool>true</bool>
- </property>
- <property name="default">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="buttonCancel">
- <property name="text">
- <string>&amp;Cancel</string>
- </property>
- <property name="shortcut">
- <string/>
- </property>
- <property name="autoDefault">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- </layout>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item>
+ <widget class="QGroupBox" name="midiExportGroupBox">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Expanding">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="title">
+ <string>Export:</string>
+ </property>
+ <layout class="QGridLayout">
+ <item row="2" column="1">
+ <widget class="QLineEdit" name="copyrightEdit"/>
+ </item>
+ <item row="1" column="1">
+ <widget class="QComboBox" name="divisionCombo">
+ <item>
+ <property name="text">
+ <string>96</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>192</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>384</string>
+ </property>
+ </item>
+ </widget>
+ </item>
+ <item row="3" column="0" colspan="2">
+ <widget class="QCheckBox" name="extendedFormat">
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="text">
+ <string>Enable extended smf format (currently not implemented)</string>
+ </property>
+ </widget>
+ </item>
+ <item row="4" column="0" colspan="2">
+ <widget class="QCheckBox" name="twoByteTimeSigs">
+ <property name="text">
+ <string>Use &amp;2-byte time signatures instead of standard 4</string>
+ </property>
+ <property name="shortcut">
+ <string>Alt+2</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="0">
+ <widget class="QLabel" name="textLabel2">
+ <property name="text">
+ <string>Copyright:</string>
+ </property>
+ <property name="wordWrap">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="0">
+ <widget class="QLabel" name="textLabel3">
+ <property name="text">
+ <string>Format:</string>
+ </property>
+ <property name="wordWrap">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0">
+ <widget class="QLabel" name="textLabel1">
+ <property name="text">
+ <string>Division:</string>
+ </property>
+ <property name="wordWrap">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ <item row="5" column="0" colspan="2">
+ <widget class="QCheckBox" name="optNoteOffs">
+ <property name="text">
+ <string>Save space by replacing note-offs with &amp;zero velocity note-ons</string>
+ </property>
+ <property name="shortcut">
+ <string>Alt+Z</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1">
+ <widget class="QComboBox" name="formatCombo">
+ <item>
+ <property name="text">
+ <string>0 (single track)</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>1 (multiple tracks)</string>
+ </property>
+ </item>
+ </widget>
</item>
+ </layout>
+ </widget>
+ </item>
+ <item>
+ <layout class="QHBoxLayout">
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <item>
+ <spacer name="Horizontal Spacing2">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>QSizePolicy::Expanding</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <widget class="QPushButton" name="buttonOk">
+ <property name="text">
+ <string>&amp;OK</string>
+ </property>
+ <property name="shortcut">
+ <string/>
+ </property>
+ <property name="autoDefault">
+ <bool>true</bool>
+ </property>
+ <property name="default">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="buttonCancel">
+ <property name="text">
+ <string>&amp;Cancel</string>
+ </property>
+ <property name="shortcut">
+ <string/>
+ </property>
+ <property name="autoDefault">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
</layout>
- </widget>
- <layoutdefault spacing="6" margin="11"/>
- <connections>
- <connection>
- <sender>buttonOk</sender>
- <signal>clicked()</signal>
- <receiver>ConfigMidiFileBase</receiver>
- <slot>accept()</slot>
- </connection>
- <connection>
- <sender>buttonCancel</sender>
- <signal>clicked()</signal>
- <receiver>ConfigMidiFileBase</receiver>
- <slot>reject()</slot>
- </connection>
- </connections>
+ </item>
+ </layout>
+ </widget>
+ <layoutdefault spacing="6" margin="11"/>
+ <resources/>
+ <connections>
+ <connection>
+ <sender>buttonOk</sender>
+ <signal>clicked()</signal>
+ <receiver>ConfigMidiFileBase</receiver>
+ <slot>accept()</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>20</x>
+ <y>20</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>20</x>
+ <y>20</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>buttonCancel</sender>
+ <signal>clicked()</signal>
+ <receiver>ConfigMidiFileBase</receiver>
+ <slot>reject()</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>20</x>
+ <y>20</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>20</x>
+ <y>20</y>
+ </hint>
+ </hints>
+ </connection>
+ </connections>
</ui>
diff --git a/muse2/muse/widgets/musewidgetsplug.cpp b/muse2/muse/widgets/musewidgetsplug.cpp
index 26a3054d..c1674e75 100644
--- a/muse2/muse/widgets/musewidgetsplug.cpp
+++ b/muse2/muse/widgets/musewidgetsplug.cpp
@@ -167,6 +167,7 @@ GlobalConfigValues config = {
false, // midi export file 2 byte timesigs instead of 4
true, // optimize midi export file note offs
true, // Split imported tracks into multiple parts.
+ true, // importMidiNewStyleDrum
1, // startMode
QString(""), // start song path
384, // gui division