|
From: Tapio V. <aa...@us...> - 2011-01-31 13:17:01
|
Module: editor
Branch: master
Commit: 9414295e5d21dc530690d9718019d9124891d1bf
Author: Tapio Vierros <tap...@gm...>
Date: Mon Jan 31 15:09:31 2011 +0200
SongParser now puts line break flags to sentences' first notes.
Also visualization is now on the left side.
---
notelabel.cc | 2 +-
songparser-txt.cc | 1 -
songparser-xml.cc | 3 +--
songparser.cc | 7 +++++++
4 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/notelabel.cc b/notelabel.cc
index f8254da..bcfc307 100644
--- a/notelabel.cc
+++ b/notelabel.cc
@@ -77,7 +77,7 @@ void NoteLabel::createPixmap(QSize size)
// Render sentence end indicator
if (m_note.lineBreak) {
painter.setPen(QPen(QBrush(QColor(255, 0, 0)), 4));
- painter.drawLine(image.width()-2, 0, image.width()-2, image.height()-1);
+ painter.drawLine(2, 0, 2, image.height()-1);
}
painter.end();
diff --git a/songparser-txt.cc b/songparser-txt.cc
index 6f9a625..381724a 100644
--- a/songparser-txt.cc
+++ b/songparser-txt.cc
@@ -146,7 +146,6 @@ bool SongParser::txtParseNote(QString line, VocalTrack &vocal) {
if (n.type == Note::SLEEP) {
if (notes.empty()) return true; // Ignore sleeps at song beginning
n.begin = n.end = prevtime; // Normalize sleep notes
- notes.back().lineBreak = true; // lineBreak flag for notes preceding SLEEPs
}
notes.push_back(n);
return true;
diff --git a/songparser-xml.cc b/songparser-xml.cc
index 78a6016..2099271 100644
--- a/songparser-xml.cc
+++ b/songparser-xml.cc
@@ -95,8 +95,7 @@ void SongParser::xmlParse()
noteElem = noteElem.nextSiblingElement();
}
- // Now add sentence end indicators
- if (!notes.empty()) notes.back().lineBreak = true;
+ // Now add sentence end indicator
Note n;
n.type = Note::SLEEP;
n.note = 0;
diff --git a/songparser.cc b/songparser.cc
index 40a59dd..ae4d9cc 100644
--- a/songparser.cc
+++ b/songparser.cc
@@ -92,6 +92,13 @@ void SongParser::finalize() {
if (vocal.notes.empty()) continue;
// Set begin/end times
vocal.beginTime = vocal.notes.front().begin, vocal.endTime = vocal.notes.back().end;
+ // Setup sentence start indicators
+ bool sentenceStart = true;
+ for (Notes::iterator it = vocal.notes.begin(); it != vocal.notes.end(); ++it) {
+ it->lineBreak = sentenceStart;
+ if (it->type == Note::SLEEP) sentenceStart = true;
+ else sentenceStart = false;
+ }
// Note normalization
const int limLow = 0, limHigh = 48;
if (vocal.noteMin <= limLow || vocal.noteMax >= limHigh) {
|