Exemplo n.º 1
0
void MidiImportOperations::adaptForPercussion(int trackIndex, bool isDrumTrack)
      {
                  // small hack: don't use multiple voices for tuplets in percussion tracks
      if (isValidIndex(trackIndex)) {
            if (isDrumTrack)
                  operations_[trackIndex].useMultipleVoices = false;
            }
      else {
            defaultOpers.useMultipleVoices = isDrumTrack
                        ? false : TrackOperations().useMultipleVoices;
            }
      }
Exemplo n.º 2
0
OperationsModel::OperationsModel()
            : root(std::unique_ptr<Node>(new Node()))
            , controller(std::unique_ptr<Controller>(new Controller()))
      {
      beginResetModel();
                  // - initialize opeations with their default values
                  // - string lists below should match Operation enum values
      Node *quantValue = new Node;
      quantValue->name = "Quantization";
      quantValue->oper.type = MidiOperation::Type::QUANT_VALUE;
      quantValue->oper.value = (int)TrackOperations().quantize.value;
      quantValue->values.push_back("Value from preferences");
      quantValue->values.push_back("Quarter");
      quantValue->values.push_back("Eighth");
      quantValue->values.push_back("16th");
      quantValue->values.push_back("32nd");
      quantValue->values.push_back("64th");
      quantValue->values.push_back("128th");
      quantValue->parent = root.get();
      root->children.push_back(std::unique_ptr<Node>(quantValue));
      controller->quantValue = quantValue;


      Node *reduceToShorter = new Node;
      reduceToShorter->name = "Reduce to shortest note in bar";
      reduceToShorter->oper.type = MidiOperation::Type::QUANT_REDUCE;
      reduceToShorter->oper.value = Quantization().reduceToShorterNotesInBar;
      reduceToShorter->parent = quantValue;
      quantValue->children.push_back(std::unique_ptr<Node>(reduceToShorter));


//      Node *humanPerformance = new Node;
//      humanPerformance->name = "Human performance";
//      humanPerformance->oper.type = MidiOperation::Type::QUANT_HUMAN;
//      humanPerformance->oper.value = Quantization().humanPerformance;
//      humanPerformance->parent = quantValue;
//      quantValue->children.push_back(std::unique_ptr<Node>(humanPerformance));
//      controller->quantHuman = humanPerformance;


      Node *useDots = new Node;
      useDots->name = "Use dots";
      useDots->oper.type = MidiOperation::Type::USE_DOTS;
      useDots->oper.value = TrackOperations().useDots;
      useDots->parent = root.get();
      root->children.push_back(std::unique_ptr<Node>(useDots));

      Node *useMultipleVoices = new Node;
      useMultipleVoices->name = "Multiple voices";
      useMultipleVoices->oper.type = MidiOperation::Type::USE_MULTIPLE_VOICES;
      useMultipleVoices->oper.value = TrackOperations().useMultipleVoices;
      useMultipleVoices->parent = root.get();
      root->children.push_back(std::unique_ptr<Node>(useMultipleVoices));
      controller->multipleVoices = useMultipleVoices;


      // ------------- tuplets --------------

      Node *searchTuplets = new Node;
      searchTuplets->name = "Search tuplets";
      searchTuplets->oper.type = MidiOperation::Type::TUPLET_SEARCH;
      searchTuplets->oper.value = TrackOperations().tuplets.doSearch;
      searchTuplets->parent = root.get();
      root->children.push_back(std::unique_ptr<Node>(searchTuplets));
      controller->searchTuplets = searchTuplets;


      Node *duplets = new Node;
      duplets->name = "Duplets (2)";
      duplets->oper.type = MidiOperation::Type::TUPLET_2;
      duplets->oper.value = TrackOperations().tuplets.duplets;
      duplets->parent = searchTuplets;
      searchTuplets->children.push_back(std::unique_ptr<Node>(duplets));
      controller->duplets = duplets;


      Node *triplets = new Node;
      triplets->name = "Triplets (3)";
      triplets->oper.type = MidiOperation::Type::TUPLET_3;
      triplets->oper.value = TrackOperations().tuplets.triplets;
      triplets->parent = searchTuplets;
      searchTuplets->children.push_back(std::unique_ptr<Node>(triplets));
      controller->triplets = triplets;


      Node *quadruplets = new Node;
      quadruplets->name = "Quadruplets (4)";
      quadruplets->oper.type = MidiOperation::Type::TUPLET_4;
      quadruplets->oper.value = TrackOperations().tuplets.quadruplets;
      quadruplets->parent = searchTuplets;
      searchTuplets->children.push_back(std::unique_ptr<Node>(quadruplets));
      controller->quadruplets = quadruplets;


      Node *quintuplets = new Node;
      quintuplets->name = "Quintuplets (5)";
      quintuplets->oper.type = MidiOperation::Type::TUPLET_5;
      quintuplets->oper.value = TrackOperations().tuplets.quintuplets;
      quintuplets->parent = searchTuplets;
      searchTuplets->children.push_back(std::unique_ptr<Node>(quintuplets));
      controller->quintuplets = quintuplets;


      Node *septuplets = new Node;
      septuplets->name = "Septuplets (7)";
      septuplets->oper.type = MidiOperation::Type::TUPLET_7;
      septuplets->oper.value = TrackOperations().tuplets.septuplets;
      septuplets->parent = searchTuplets;
      searchTuplets->children.push_back(std::unique_ptr<Node>(septuplets));
      controller->septuplets = septuplets;


      Node *nonuplets = new Node;
      nonuplets->name = "Nonuplets (9)";
      nonuplets->oper.type = MidiOperation::Type::TUPLET_9;
      nonuplets->oper.value = TrackOperations().tuplets.nonuplets;
      nonuplets->parent = searchTuplets;
      searchTuplets->children.push_back(std::unique_ptr<Node>(nonuplets));
      controller->nonuplets = nonuplets;

      // ------------------------------------

      Node *pickupMeasure = new Node;
      pickupMeasure->name = "Recognize pickup measure";
      pickupMeasure->oper.type = MidiOperation::Type::PICKUP_MEASURE;
      pickupMeasure->oper.value = TrackOperations().pickupMeasure;
      pickupMeasure->parent = root.get();
      root->children.push_back(std::unique_ptr<Node>(pickupMeasure));
      controller->pickupMeasure = pickupMeasure;


      Node *swing = new Node;
      swing->name = "Detect swing";
      swing->oper.type = MidiOperation::Type::SWING;
      swing->oper.value = (int)TrackOperations().swing;
      swing->values.push_back("None (1:1)");
      swing->values.push_back("Swing (2:1)");
      swing->values.push_back("Shuffle (3:1)");
      swing->parent = root.get();
      root->children.push_back(std::unique_ptr<Node>(swing));


      Node *changeClef = new Node;
      changeClef->name = "Clef may change along the score";
      changeClef->oper.type = MidiOperation::Type::CHANGE_CLEF;
      changeClef->oper.value = TrackOperations().changeClef;
      changeClef->parent = root.get();
      root->children.push_back(std::unique_ptr<Node>(changeClef));


      Node *splitDrums = new Node;
      splitDrums->name = "Split drum set";
      splitDrums->oper.type = MidiOperation::Type::SPLIT_DRUMS;
      splitDrums->oper.value = TrackOperations().drums.doSplit;;
      splitDrums->parent = root.get();
      root->children.push_back(std::unique_ptr<Node>(splitDrums));
      controller->splitDrums = splitDrums;


      Node *showStaffBracket = new Node;
      showStaffBracket->name = "Show staff bracket";
      showStaffBracket->oper.type = MidiOperation::Type::SHOW_STAFF_BRACKET;
      showStaffBracket->oper.value = TrackOperations().drums.showStaffBracket;
      showStaffBracket->parent = splitDrums;
      splitDrums->children.push_back(std::unique_ptr<Node>(showStaffBracket));
      controller->showStaffBracket = showStaffBracket;


      Node *doLHRH = new Node;
      doLHRH->name = "Left/right hand separation";
      doLHRH->oper.type = MidiOperation::Type::DO_LHRH_SEPARATION;
      doLHRH->oper.value = LHRHSeparation().doIt;
      doLHRH->parent = root.get();
      root->children.push_back(std::unique_ptr<Node>(doLHRH));
      controller->LHRHdoIt = doLHRH;


      Node *LHRHMethod = new Node;
      LHRHMethod->name = "Separation method";
      LHRHMethod->oper.type = MidiOperation::Type::LHRH_METHOD;
      LHRHMethod->oper.value = (int)LHRHSeparation().method;
      LHRHMethod->values.push_back("Hand width");
      LHRHMethod->values.push_back("Fixed pitch");
      LHRHMethod->parent = doLHRH;
      doLHRH->children.push_back(std::unique_ptr<Node>(LHRHMethod));
      controller->LHRHMethod = LHRHMethod;


      Node *LHRHPitchOctave = new Node;
      LHRHPitchOctave->name = "Split pitch octave";
      LHRHPitchOctave->oper.type = MidiOperation::Type::LHRH_SPLIT_OCTAVE;
      LHRHPitchOctave->oper.value = (int)LHRHSeparation().splitPitchOctave;
      LHRHPitchOctave->values.push_back("C-1");
      LHRHPitchOctave->values.push_back("C0");
      LHRHPitchOctave->values.push_back("C1");
      LHRHPitchOctave->values.push_back("C2");
      LHRHPitchOctave->values.push_back("C3");
      LHRHPitchOctave->values.push_back("C4");
      LHRHPitchOctave->values.push_back("C5");
      LHRHPitchOctave->values.push_back("C6");
      LHRHPitchOctave->values.push_back("C7");
      LHRHPitchOctave->values.push_back("C8");
      LHRHPitchOctave->values.push_back("C9");
      LHRHPitchOctave->parent = LHRHMethod;
      LHRHMethod->children.push_back(std::unique_ptr<Node>(LHRHPitchOctave));
      controller->LHRHPitchOctave = LHRHPitchOctave;


      Node *LHRHPitchNote = new Node;
      LHRHPitchNote->name = "Split pitch note";
      LHRHPitchNote->oper.type = MidiOperation::Type::LHRH_SPLIT_NOTE;
      LHRHPitchNote->oper.value = (int)LHRHSeparation().splitPitchNote;
      LHRHPitchNote->values.push_back("C");
      LHRHPitchNote->values.push_back("C#");
      LHRHPitchNote->values.push_back("D");
      LHRHPitchNote->values.push_back("D#");
      LHRHPitchNote->values.push_back("E");
      LHRHPitchNote->values.push_back("F");
      LHRHPitchNote->values.push_back("F#");
      LHRHPitchNote->values.push_back("G");
      LHRHPitchNote->values.push_back("G#");
      LHRHPitchNote->values.push_back("A");
      LHRHPitchNote->values.push_back("A#");
      LHRHPitchNote->values.push_back("B");
      LHRHPitchNote->parent = LHRHMethod;
      LHRHMethod->children.push_back(std::unique_ptr<Node>(LHRHPitchNote));
      controller->LHRHPitchNote = LHRHPitchNote;

      //--------------------------------------------------------------------
      connect(this,
              SIGNAL(dataChanged(QModelIndex,QModelIndex)),
              SLOT(onDataChanged(QModelIndex)));
      controller->updateNodeDependencies(nullptr, true);
      endResetModel();
      }