From ca9592111cb0f22246e7b74287eb31f4b2fed59b Mon Sep 17 00:00:00 2001 From: Matthias Neeracher Date: Fri, 4 May 2007 05:38:21 +0000 Subject: [PATCH] Handle pickup notes --- Sources/VLModel.cpp | 10 +++++++--- Sources/VLModel.h | 2 +- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/Sources/VLModel.cpp b/Sources/VLModel.cpp index 56f35cc..fc81369 100644 --- a/Sources/VLModel.cpp +++ b/Sources/VLModel.cpp @@ -159,7 +159,7 @@ void VLNote::Name(std::string & name, bool useSharps) const name = PitchName(fPitch, useSharps); } -void VLNote::LilypondName(std::string & name, VLFraction at, VLFraction prevDur, VLFraction nextDur, bool & triplet, const VLProperties & prop) const +void VLNote::LilypondName(std::string & name, VLFraction at, VLFraction prevDur, VLFraction nextDur, bool & triplet, bool & pickup, const VLProperties & prop) const { std::string n = LilypondPitchName(fPitch, prop.fKey >= 0); if (fPitch != kNoPitch) { @@ -167,6 +167,9 @@ void VLNote::LilypondName(std::string & name, VLFraction at, VLFraction prevDur, n += '\''; for (int commas = (kMiddleC-kOctave-fPitch)/kOctave; commas>0; --commas) n += ','; + pickup = false; + } else if (pickup) { + n = "s"; } std::vector durations; @@ -1285,6 +1288,7 @@ void VLSong::LilypondNotes(std::string & notes) const size_t seenEnding = 0; int numEndings = 0; size_t endMeasure = fMeasures.size()-EmptyEnding(); + bool pickup = fMeasures[0].NoChords(); for (size_t measure=0; measurefDuration; - i->LilypondName(note, at, prevDur, nextDur, triplet, fProperties[fMeasures[measure].fPropIdx]); + i->LilypondName(note, at, prevDur, nextDur, triplet, pickup, fProperties[fMeasures[measure].fPropIdx]); prevDur = i->fDuration; at += i->fDuration; notes += note+" "; @@ -1354,7 +1358,7 @@ void VLSong::LilypondNotes(std::string & notes) const // while ((trip = notes.find("} ~")) != std::string::npos) notes.replace(trip, 3, "~ } ", 4); - + if (fGoToCoda == measure+1) notes += "\n" + indent diff --git a/Sources/VLModel.h b/Sources/VLModel.h index 44bc363..1a85b62 100644 --- a/Sources/VLModel.h +++ b/Sources/VLModel.h @@ -140,7 +140,7 @@ struct VLNote { VLNote(std::string name); void Name(std::string & name, bool useSharps = false) const; - void LilypondName(std::string & name, VLFraction at, VLFraction prevDur, VLFraction nextDur, bool & triplet, const VLProperties & prop) const; + void LilypondName(std::string & name, VLFraction at, VLFraction prevDur, VLFraction nextDur, bool & triplet, bool & pickup, const VLProperties & prop) const; void MMAName(std::string & name, VLFraction at, VLFraction dur, VLFraction prevDur, VLFraction nextDur, const VLProperties & prop) const; };