Example #1
0
void TestMidi::midi3()
      {
      MCursor c;
      c.createScore("test3a");
      c.addPart("voice");
      c.move(0, 0);     // move to track 0 tick 0

      c.addKeySig(1);
      c.addTimeSig(Fraction(4,4));
      c.addChord(60, TDuration(TDuration::V_QUARTER));
      c.addChord(61, TDuration(TDuration::V_QUARTER));
      c.addChord(62, TDuration(TDuration::V_QUARTER));
      c.addChord(63, TDuration(TDuration::V_QUARTER));
      Score* score = c.score();

      score->doLayout();
      score->rebuildMidiMapping();
      c.saveScore();
      saveMidi(score, "test3.mid");

      Score* score2 = new Score(mscore->baseStyle());
      score2->setName("test3b");
      QVERIFY(importMidi(score2, "test3.mid"));

      score2->doLayout();
      score2->rebuildMidiMapping();
      MCursor c2(score2);
      c2.saveScore();

      QVERIFY(compareScores(score, score2));

      delete score;
      delete score2;
      }
Example #2
0
void MusE::importMidi(const QString &file)
      {
      QString fn;
      if (file.isEmpty()) {
               fn = MusEGui::getOpenFileName(MusEGlobal::lastMidiPath, MusEGlobal::midi_file_pattern, this,
               tr("MusE: Import Midi"), 0);
            if (fn.isEmpty())
                  return;
            MusEGlobal::lastMidiPath = fn;
            }
      else
            fn = file;

      int n = QMessageBox::question(this, appName,
         tr("Add midi file to current project?\n"),
         tr("&Add to Project"),
         tr("&Replace"),
         tr("&Abort"), 0, 2);

      switch (n) {
            case 0:
                  importMidi(fn, true);
                  MusEGlobal::song->update();
                  break;
            case 1:
                  loadProjectFile(fn, false, false);    // replace
                  break;
            default:
                  return;
            }
      }
Example #3
0
void LOS::importMidi(const QString &file)
{
    QString fn;
    if (file.isEmpty())
    {
        fn = getOpenFileName(lastMidiPath, midi_file_pattern, this,
                tr("LOS: Import Midi"), 0);
        if (fn.isEmpty())
            return;
        lastMidiPath = fn;
    }
    else
        fn = file;

    int n = QMessageBox::question(this, appName,
            tr("Add midi file to current project?\n"),
            tr("&Add to Project"),
            tr("&Replace"),
            tr("&Cancel"), 0, 2);

    switch (n)
    {
        case 0:
            song->invalid = true;
            importMidi(fn, true);
            song->invalid = false;
            song->update();
            break;
        case 1:
            song->invalid = true;
            loadProjectFile(fn, false, false); // replace
            song->invalid = false;
            break;
        default:
            return;
    }
}
Example #4
0
void LOS::importMidi()
{
    QString empty("");
    importMidi(empty);
}
Example #5
0
void MusE::importMidi()
      {
      QString empty("");
      importMidi(empty);
      }