summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--muse/ChangeLog1
-rw-r--r--muse/muse/app.cpp2
-rw-r--r--muse/muse/conf.cpp5
-rw-r--r--muse/muse/driver/jack.cpp24
-rw-r--r--muse/muse/gconfig.cpp1
-rw-r--r--muse/muse/gconfig.h1
-rw-r--r--muse/muse/importmidi.cpp122
-rw-r--r--muse/muse/shortcuts.cpp2
-rw-r--r--muse/muse/widgets/configmidifilebase.ui256
-rw-r--r--muse/muse/widgets/gensetbase.ui2
-rw-r--r--muse/muse/widgets/musewidgetsplug.cpp1
11 files changed, 261 insertions, 156 deletions
diff --git a/muse/ChangeLog b/muse/ChangeLog
index 8fcf6fd1..78c0b47b 100644
--- a/muse/ChangeLog
+++ b/muse/ChangeLog
@@ -1,6 +1,7 @@
24.01.2010
* Added: Midi sync: Added 'Jack timebase master' checkbox, removed requirement of MusE being tempo map master. (T356)
* Added: While on external sync and Jack timebase master, reports correct MusE BBT info to Jack. (Tempo not correct yet). (T356)
+ * Added: Midi import option: Whether to split imported tracks into multiple parts. (T356)
23.01.2010
* Fixed: External midi sync in: MusE transport not rewinding upon reception of start. (T356)
* Added: Midi sync: MusE now transmits and receives some MMC commands, and displays some MTC and SMTPE info. (T356)
diff --git a/muse/muse/app.cpp b/muse/muse/app.cpp
index 4fdcf825..b5f75b43 100644
--- a/muse/muse/app.cpp
+++ b/muse/muse/app.cpp
@@ -1246,7 +1246,7 @@ MusE::MusE(int argc, char** argv) : QMainWindow(0, "mainwindow")
menu_ids[CMD_CONFIG_MIDISYNC] = menuSettings->insertItem(
QIconSet(*settings_midisyncIcon), tr("Midi Sync"), this, SLOT(configMidiSync()), 0);
menu_ids[CMD_MIDI_FILE_CONFIG] = menuSettings->insertItem(
- QIconSet(*settings_midifileexportIcon), tr("Midi File Export"), this, SLOT(configMidiFile()), 0);
+ QIconSet(*settings_midifileexportIcon), tr("Midi File Import/Export"), this, SLOT(configMidiFile()), 0);
menuSettings->insertSeparator();
menu_ids[CMD_APPEARANCE_SETTINGS] = menuSettings->insertItem(
QIconSet(*settings_appearance_settingsIcon), tr("Appearance settings"), this, SLOT(configAppearance()), 0);
diff --git a/muse/muse/conf.cpp b/muse/muse/conf.cpp
index 7096edfb..33a1a965 100644
--- a/muse/muse/conf.cpp
+++ b/muse/muse/conf.cpp
@@ -571,6 +571,8 @@ void readConfiguration(Xml& xml, bool readOnlySequencer)
config.exp2ByteTimeSigs = xml.parseInt();
else if (tag == "expOptimNoteOffs")
config.expOptimNoteOffs = xml.parseInt();
+ else if (tag == "importMidiSplitParts")
+ config.importMidiSplitParts = xml.parseInt();
else if (tag == "midiInputDevice")
midiInputPorts = xml.parseInt();
else if (tag == "midiInputChannel")
@@ -1007,6 +1009,7 @@ void MusE::writeGlobalConfiguration(int level, Xml& xml) const
xml.intTag(level, "smfFormat", config.smfFormat);
xml.intTag(level, "exp2ByteTimeSigs", config.exp2ByteTimeSigs);
xml.intTag(level, "expOptimNoteOffs", config.expOptimNoteOffs);
+ xml.intTag(level, "importMidiSplitParts", config.importMidiSplitParts);
xml.intTag(level, "startMode", config.startMode);
xml.strTag(level, "startSong", config.startSong);
@@ -1311,6 +1314,7 @@ void MidiFileConfig::updateValues()
copyrightEdit->setText(config.copyright);
optNoteOffs->setChecked(config.expOptimNoteOffs);
twoByteTimeSigs->setChecked(config.exp2ByteTimeSigs);
+ splitPartsCheckBox->setChecked(config.importMidiSplitParts);
}
//---------------------------------------------------------
@@ -1329,6 +1333,7 @@ void MidiFileConfig::okClicked()
config.copyright = copyrightEdit->text();
config.expOptimNoteOffs = optNoteOffs->isChecked();
config.exp2ByteTimeSigs = twoByteTimeSigs->isChecked();
+ config.importMidiSplitParts = splitPartsCheckBox->isChecked();
muse->changeConfig(true); // write config file
close();
diff --git a/muse/muse/driver/jack.cpp b/muse/muse/driver/jack.cpp
index 67146cca..6bbb57d9 100644
--- a/muse/muse/driver/jack.cpp
+++ b/muse/muse/driver/jack.cpp
@@ -196,12 +196,30 @@ static void timebase_callback(jack_transport_state_t /* state */,
pos->bar++;
pos->beat++;
pos->bar_start_tick = Pos(pos->bar, 0, 0).tick();
+
//
// dummy:
//
- pos->beats_per_bar = 4;
- pos->beat_type = 4;
- pos->ticks_per_beat = 384;
+
+ // p3.3.26
+ //pos->beats_per_bar = 4;
+ //pos->beat_type = 4;
+ //pos->ticks_per_beat = 384;
+ //
+ /* // From example client transport.c :
+ float time_beats_per_bar = 4.0;
+ float time_beat_type = 0.25; // Huh? Inverted? From docs: "Time signature 'denominator'"
+ double time_ticks_per_beat = 1920.0; // Huh? Ticks per beat should be 24 etc. not 384 or 1920 etc. Otherwise it would be called 'frames_per_beat'.
+ double time_beats_per_minute = 120.0;
+ */
+ //
+ int z, n;
+ sigmap.timesig(p.tick(), z, n);
+ pos->beats_per_bar = z;
+ pos->beat_type = n;
+ //pos->ticks_per_beat = config.division;
+ pos->ticks_per_beat = 24;
+
int tempo = tempomap.tempo(p.tick());
pos->beats_per_minute = (60000000.0 / tempo) * tempomap.globalTempo()/100.0;
}
diff --git a/muse/muse/gconfig.cpp b/muse/muse/gconfig.cpp
index db019ff6..8072e656 100644
--- a/muse/muse/gconfig.cpp
+++ b/muse/muse/gconfig.cpp
@@ -88,6 +88,7 @@ GlobalConfigValues config = {
1, // smf export file format
false, // midi export file 2 byte timesigs instead of 4
true, // optimize midi export file note offs
+ true, // Split imported tracks into multiple parts.
1, // startMode
QString(""), // start song path
384, // gui division
diff --git a/muse/muse/gconfig.h b/muse/muse/gconfig.h
index 94789bd6..5d4d98a8 100644
--- a/muse/muse/gconfig.h
+++ b/muse/muse/gconfig.h
@@ -85,6 +85,7 @@ struct GlobalConfigValues {
int smfFormat; // smf export file type
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.
int startMode; // 0 - start with last song
// 1 - start with default template
diff --git a/muse/muse/importmidi.cpp b/muse/muse/importmidi.cpp
index a50497a6..2c8bfb24 100644
--- a/muse/muse/importmidi.cpp
+++ b/muse/muse/importmidi.cpp
@@ -27,6 +27,7 @@
#include "drummap.h"
#include "xml.h"
#include "audio.h"
+#include "gconfig.h"
//---------------------------------------------------------
// importMidi
@@ -288,61 +289,76 @@ void MusE::processTrack(MidiTrack* track)
lastTick = epos;
}
- int len = song->roundUpBar(lastTick+1);
- int bar2, beat;
- unsigned tick;
- sigmap.tickValues(len, &bar2, &beat, &tick);
-
QString partname = track->name();
+ int len = song->roundUpBar(lastTick+1);
- int lastOff = 0;
- int st = -1; // start tick current part
- int x1 = 0; // start tick current measure
- int x2 = 0; // end tick current measure
-
- for (int bar = 0; bar < bar2; ++bar, x1 = x2) {
- x2 = sigmap.bar2tick(bar+1, 0, 0);
- if (lastOff > x2) {
- // this measure is busy!
- continue;
- }
- iEvent i1 = tevents->lower_bound(x1);
- iEvent i2 = tevents->lower_bound(x2);
-
- if (i1 == i2) { // empty?
- if (st != -1) {
- MidiPart* part = new MidiPart(track);
- part->setTick(st);
- part->setLenTick(x1-st);
-// printf("new part %d len: %d\n", st, x1-st);
- part->setName(partname);
- pl->add(part);
- st = -1;
- }
- }
- else {
- if (st == -1)
- st = x1; // begin new part
- //HACK:
- //lastOff:
- for (iEvent i = i1; i != i2; ++i) {
- Event event = i->second;
- if (event.type() == Note) {
- int off = event.tick() + event.lenTick();
- if (off > lastOff)
- lastOff = off;
- }
- }
- }
- }
- if (st != -1) {
- MidiPart* part = new MidiPart(track);
- part->setTick(st);
-// printf("new part %d len: %d\n", st, x2-st);
- part->setLenTick(x2-st);
- part->setName(partname);
- pl->add(part);
- }
+ // p3.3.27
+ if(config.importMidiSplitParts)
+ {
+
+ int bar2, beat;
+ unsigned tick;
+ sigmap.tickValues(len, &bar2, &beat, &tick);
+
+ int lastOff = 0;
+ int st = -1; // start tick current part
+ int x1 = 0; // start tick current measure
+ int x2 = 0; // end tick current measure
+
+ for (int bar = 0; bar < bar2; ++bar, x1 = x2) {
+ x2 = sigmap.bar2tick(bar+1, 0, 0);
+ if (lastOff > x2) {
+ // this measure is busy!
+ continue;
+ }
+ iEvent i1 = tevents->lower_bound(x1);
+ iEvent i2 = tevents->lower_bound(x2);
+
+ if (i1 == i2) { // empty?
+ if (st != -1) {
+ MidiPart* part = new MidiPart(track);
+ part->setTick(st);
+ part->setLenTick(x1-st);
+ // printf("new part %d len: %d\n", st, x1-st);
+ part->setName(partname);
+ pl->add(part);
+ st = -1;
+ }
+ }
+ else {
+ if (st == -1)
+ st = x1; // begin new part
+ //HACK:
+ //lastOff:
+ for (iEvent i = i1; i != i2; ++i) {
+ Event event = i->second;
+ if (event.type() == Note) {
+ int off = event.tick() + event.lenTick();
+ if (off > lastOff)
+ lastOff = off;
+ }
+ }
+ }
+ }
+ if (st != -1) {
+ MidiPart* part = new MidiPart(track);
+ part->setTick(st);
+ // printf("new part %d len: %d\n", st, x2-st);
+ part->setLenTick(x2-st);
+ part->setName(partname);
+ pl->add(part);
+ }
+ }
+ else
+ {
+ // Just one long part...
+ MidiPart* part = new MidiPart(track);
+ //part->setTick(st);
+ part->setTick(0);
+ part->setLenTick(len);
+ part->setName(partname);
+ pl->add(part);
+ }
//-------------------------------------------------------------
// assign events to parts
diff --git a/muse/muse/shortcuts.cpp b/muse/muse/shortcuts.cpp
index 29dbbce8..057fef49 100644
--- a/muse/muse/shortcuts.cpp
+++ b/muse/muse/shortcuts.cpp
@@ -94,7 +94,7 @@ void initShortCuts()
defShrt(SHRT_CONFIG_SHORTCUTS, 0, "Settings: Configure shortcuts", ARRANG_SHRT, "configure_shortcuts");
defShrt(SHRT_CONFIG_METRONOME, 0, "Settings: Configure metronome", ARRANG_SHRT, "configure_metronome");
defShrt(SHRT_CONFIG_MIDISYNC, 0, "Settings: Midi sync configuration", ARRANG_SHRT, "configure_midi_sync");
- defShrt(SHRT_MIDI_FILE_CONFIG, 0, "Settings: Midi file export configuration", ARRANG_SHRT, "configure_midi_file");
+ defShrt(SHRT_MIDI_FILE_CONFIG, 0, "Settings: Midi file import/export configuration", ARRANG_SHRT, "configure_midi_file");
defShrt(SHRT_APPEARANCE_SETTINGS, 0, "Settings: Appearance settings", ARRANG_SHRT, "configure_appearance_settings");
defShrt(SHRT_CONFIG_MIDI_PORTS, 0, "Settings: Midi ports / Soft Synth", ARRANG_SHRT, "configure_midi_ports");
defShrt(SHRT_CONFIG_AUDIO_PORTS, 0, "Settings: Audio subsystem configuration", ARRANG_SHRT, "configure_audio_ports");
diff --git a/muse/muse/widgets/configmidifilebase.ui b/muse/muse/widgets/configmidifilebase.ui
index dfdfffa4..4ba53d7e 100644
--- a/muse/muse/widgets/configmidifilebase.ui
+++ b/muse/muse/widgets/configmidifilebase.ui
@@ -8,21 +8,174 @@
<rect>
<x>0</x>
<y>0</y>
- <width>449</width>
- <height>282</height>
+ <width>548</width>
+ <height>353</height>
</rect>
</property>
<property name="caption">
- <string>MusE: Config Midi File Export</string>
+ <string>MusE: Config Midi File Import/Export</string>
</property>
<property name="sizeGripEnabled">
<bool>true</bool>
</property>
- <grid>
+ <vbox>
<property name="name">
<cstring>unnamed</cstring>
</property>
- <widget class="QLayoutWidget" row="6" column="0" rowspan="1" colspan="2">
+ <widget class="QGroupBox">
+ <property name="name">
+ <cstring>midiImportGroupBox</cstring>
+ </property>
+ <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>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QCheckBox" row="0" column="0">
+ <property name="name">
+ <cstring>splitPartsCheckBox</cstring>
+ </property>
+ <property name="text">
+ <string>Split tracks into &amp;parts</string>
+ </property>
+ <property name="accel">
+ <string>Alt+P</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Split tracks into parts, or one single part</string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <widget class="QGroupBox">
+ <property name="name">
+ <cstring>midiExportGroupBox</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>7</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="title">
+ <string>Export:</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLineEdit" row="2" column="1">
+ <property name="name">
+ <cstring>copyrightEdit</cstring>
+ </property>
+ </widget>
+ <widget class="QComboBox" row="1" column="1">
+ <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>
+ <property name="name">
+ <cstring>divisionCombo</cstring>
+ </property>
+ </widget>
+ <widget class="QCheckBox" row="3" column="0" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>extendedFormat</cstring>
+ </property>
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="text">
+ <string>Enable extended smf format (currently not implemented)</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox" row="4" column="0" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>twoByteTimeSigs</cstring>
+ </property>
+ <property name="text">
+ <string>Use &amp;2-byte time signatures instead of standard 4</string>
+ </property>
+ <property name="accel">
+ <string>Alt+2</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="2" column="0">
+ <property name="name">
+ <cstring>textLabel2</cstring>
+ </property>
+ <property name="text">
+ <string>Copyright:</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>textLabel3</cstring>
+ </property>
+ <property name="text">
+ <string>Format:</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>textLabel1</cstring>
+ </property>
+ <property name="text">
+ <string>Division:</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox" row="5" column="0" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>optNoteOffs</cstring>
+ </property>
+ <property name="text">
+ <string>Save space by replacing note-offs with &amp;zero velocity note-ons</string>
+ </property>
+ <property name="accel">
+ <string>Alt+Z</string>
+ </property>
+ </widget>
+ <widget class="QComboBox" row="0" column="1">
+ <item>
+ <property name="text">
+ <string>0 (single track)</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>1 (multiple tracks)</string>
+ </property>
+ </item>
+ <property name="name">
+ <cstring>formatCombo</cstring>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <widget class="QLayoutWidget">
<property name="name">
<cstring>Layout1</cstring>
</property>
@@ -86,98 +239,7 @@
</widget>
</hbox>
</widget>
- <widget class="QComboBox" row="0" column="1">
- <item>
- <property name="text">
- <string>0 (single track)</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>1 (multiple tracks)</string>
- </property>
- </item>
- <property name="name">
- <cstring>formatCombo</cstring>
- </property>
- </widget>
- <widget class="QLabel" row="0" column="0">
- <property name="name">
- <cstring>textLabel3</cstring>
- </property>
- <property name="text">
- <string>Format:</string>
- </property>
- </widget>
- <widget class="QComboBox" row="1" column="1">
- <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>
- <property name="name">
- <cstring>divisionCombo</cstring>
- </property>
- </widget>
- <widget class="QLabel" row="1" column="0">
- <property name="name">
- <cstring>textLabel1</cstring>
- </property>
- <property name="text">
- <string>Division:</string>
- </property>
- </widget>
- <widget class="QLabel" row="2" column="0">
- <property name="name">
- <cstring>textLabel2</cstring>
- </property>
- <property name="text">
- <string>Copyright:</string>
- </property>
- </widget>
- <widget class="QLineEdit" row="2" column="1">
- <property name="name">
- <cstring>copyrightEdit</cstring>
- </property>
- </widget>
- <widget class="QCheckBox" row="3" column="0" rowspan="1" colspan="2">
- <property name="name">
- <cstring>extendedFormat</cstring>
- </property>
- <property name="enabled">
- <bool>true</bool>
- </property>
- <property name="text">
- <string>Enable extended smf format (currently not implemented)</string>
- </property>
- </widget>
- <widget class="QCheckBox" row="4" column="0" rowspan="1" colspan="2">
- <property name="name">
- <cstring>twoByteTimeSigs</cstring>
- </property>
- <property name="text">
- <string>Use &amp;2-byte time signatures instead of standard 4</string>
- </property>
- </widget>
- <widget class="QCheckBox" row="5" column="0" rowspan="1" colspan="2">
- <property name="name">
- <cstring>optNoteOffs</cstring>
- </property>
- <property name="text">
- <string>Save space by replacing note-offs with &amp;zero velocity note-ons</string>
- </property>
- </widget>
- </grid>
+ </vbox>
</widget>
<connections>
<connection>
diff --git a/muse/muse/widgets/gensetbase.ui b/muse/muse/widgets/gensetbase.ui
index 85873922..cd6f2888 100644
--- a/muse/muse/widgets/gensetbase.ui
+++ b/muse/muse/widgets/gensetbase.ui
@@ -1,4 +1,4 @@
-<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<!DOCTYPE UI><UI version="3.2" stdsetdef="1">
<class>GlobalSettingsDialogBase</class>
<widget class="QDialog">
<property name="name">
diff --git a/muse/muse/widgets/musewidgetsplug.cpp b/muse/muse/widgets/musewidgetsplug.cpp
index 59d1e826..a32707e5 100644
--- a/muse/muse/widgets/musewidgetsplug.cpp
+++ b/muse/muse/widgets/musewidgetsplug.cpp
@@ -115,6 +115,7 @@ GlobalConfigValues config = {
1, // smf export file format
false, // midi export file 2 byte timesigs instead of 4
true, // optimize midi export file note offs
+ true, // Split imported tracks into multiple parts.
1, // startMode
QString(""), // start song path
384, // gui division