Exemple #1
0
void PianoView::addChord(Chord* chord)
      {
      for (Chord* c : chord->graceNotes())
            addChord(c);
      for (Note* note : chord->notes()) {
            if (note->tieBack())
                  continue;
            for (NoteEvent& e : note->playEvents())
                  scene()->addItem(new PianoItem(note, &e));
            }
      }
Exemple #2
0
void MainWindow::initStaff()
{
    // par1: 15px
    // par2: 145px
    widget_staff->setWidget(NULL);
    rpStaff->~QObject();

    partitura = new Partitura(sharp, 1);
    partitura->setAuxPent(new Partitura(flat, 2));
    undoGroup->addStack(partitura->getUndoStack());

    rpStaff = new RenderPartitura(midiRef->getCurrentKey(), currentStatus->getMeter(), partitura, this);
    widget_staff->setWidget(rpStaff);
    connect(midiRef, SIGNAL(durationChanged(QAction*)), rpStaff, SLOT(changeCursor(QAction*)));
    connect(midiRef, SIGNAL(dotEnable(bool)), rpStaff, SLOT(setPuntillo(bool)));
    connect(rpStaff, SIGNAL(addChord(QPoint)), this, SLOT(editChord(QPoint)));

    partitura->addCompas(new Compas());
    partitura->addCompas(new Compas());
    partitura->getAuxPent()->addCompas(new Compas());
    partitura->getAuxPent()->addCompas(new Compas());

    midiRef->setDefaultDuration();
}
Exemple #3
0
void PianoView::updateNotes()
      {
      scene()->blockSignals(true);  // block changeSelection()
      scene()->clearFocus();
      scene()->clear();
      createLocators();

      int staffIdx   = staff->idx();
      int startTrack = staffIdx * VOICES;
      int endTrack   = startTrack + VOICES;

      Segment::Type st = Segment::Type::ChordRest;
      for (Segment* s = staff->score()->firstSegment(st); s; s = s->next1(st)) {
            for (int track = startTrack; track < endTrack; ++track) {
                  Chord* chord = static_cast<Chord*>(s->element(track));
                  if (chord == 0 || chord->type() != ElementType::CHORD)
                        continue;
                  addChord(chord);
                  }
            }
      for (int i = 0; i < 3; ++i)
            moveLocator(i);
      scene()->blockSignals(false);
      }
Exemple #4
0
/* Creates an empty Progression object by setting the appropriate tonic chord,
   which would be linked to every other chord added, as well as itself. */
ProgressionGraph::ProgressionGraph(bool isMinor)
	: tonicChord(((isMinor) ? "i" : "I"), Note(0), Note(2), Note(4)) {
	addChord(tonicChord);
}