Play proper pitch for extended notes (Tracker #3284515)

This commit is contained in:
Matthias Neeracher 2011-08-26 16:15:10 +00:00
parent c14ace59f8
commit ec927024f5
3 changed files with 8 additions and 4 deletions

View File

@ -887,18 +887,21 @@ void VLSong::DelNote(size_t measure, VLFraction at)
fMeasures.pop_back();
}
void VLSong::ExtendNote(size_t measure, VLFraction at)
VLNote VLSong::ExtendNote(size_t measure, VLFraction at)
{
VLNoteList::iterator i = fMeasures[measure].fMelody.begin();
VLNoteList::iterator end= fMeasures[measure].fMelody.end();
if (i==end)
return VLNote(); // Empty song, do nothing
for (VLFraction t(0); i != end && t+i->fDuration <= at; ++i)
t += i->fDuration;
if (i == end)
--i;
if (i->fPitch == VLNote::kNoPitch)
return; // Don't extend rests
return *i; // Don't extend rests
for (;;) {
VLNoteList::iterator j=i;
@ -942,6 +945,7 @@ void VLSong::ExtendNote(size_t measure, VLFraction at)
}
break;
}
return *i;
}
bool VLSong::IsNonEmpty() const

View File

@ -334,7 +334,7 @@ public:
void AddNote(VLLyricsNote note, size_t measure, VLFraction at);
void DelChord(size_t measure, VLFraction at);
void DelNote(size_t measure, VLFraction at);
void ExtendNote(size_t measure, VLFraction at);
VLNote ExtendNote(size_t measure, VLFraction at);
void AddRepeat(size_t beginMeasure, size_t endMeasure, int times);
void DelRepeat(size_t beginMeasure, size_t endMeasure);
void AddEnding(size_t beginMeasure, size_t endMeasure, size_t volta);

View File

@ -32,7 +32,7 @@
}
[[self document] willChangeSong];
if (fCursorAccidental == kMusicExtendCursor)
[self song]->ExtendNote(fCursorMeasure, fCursorAt);
newNote = [self song]->ExtendNote(fCursorMeasure, fCursorAt);
else if (fClickMode == 'k')
[self song]->DelNote(fCursorMeasure, fCursorAt);
else