Logo Search packages:      
Sourcecode: canorus version File versions  Download package

void CALyricsContext::repositSyllables (  ) 

Keeps the content and order of the syllables, but changes startTimes and lengths according to the notes in associatedVoice. This function is usually called when associatedVoice is changed or the whole lyricsContext is initialized for the first time. If the notes and syllables aren't synchronized (too little syllables for notes) it adds empty syllables.

Definition at line 84 of file lyricscontext.cpp.

References addEmptySyllable(), CAVoice::getNoteList(), and removeAt().

Referenced by CAMusElementFactory::configureRest(), CAMainWin::deleteSelection(), and CAMainWin::pasteAt().

      if (associatedVoice()) {
            QList<CANote*> noteList = associatedVoice()->getNoteList();
            int i,j;
            for (i=0, j=0; i<noteList.size() && j<_syllableList.size(); i++, j++) {
                  if (i>0 && noteList[i-1]->timeStart()==noteList[i]->timeStart()) { // chord
                  _syllableList[j]->setTimeStart( noteList[i]->timeStart() );
                  _syllableList[j]->setTimeLength( noteList[i]->timeLength() );
            int firstEmpty = j;
            for (; j<_syllableList.size() && j>0; j++) { // add syllables at the end, if too much of them exist
                  if ( !_syllableList[j]->text().isEmpty() )
                        firstEmpty = j+1;
                  _syllableList[j]->setTimeLength( 256 );
            for (j=firstEmpty; j<_syllableList.size() && j>0; j++) removeAt(j); // remove empty "leftover" syllables from the end 
            for (; i<noteList.size(); i++) { // add empty syllables at the end, if missing
                  if (i>0 && noteList[i]->timeStart()==noteList[i-1]->timeStart()) // chord
                  addEmptySyllable( noteList[i]->timeStart(), noteList[i]->timeLength() );

Generated by  Doxygen 1.6.0   Back to index