Implement groove changes in MMA documents

This commit is contained in:
Matthias Neeracher 2008-01-24 00:57:58 +00:00
parent cb78a2ba75
commit fc1e8277c7
4 changed files with 26 additions and 15 deletions

View File

@ -42,10 +42,6 @@
// Can't handle these yet // Can't handle these yet
break; break;
} }
sprintf(buf, "Groove %s\n", [songGroove UTF8String]);
mmaFile += buf;
sprintf(buf, "KeySig %d%c\n", labs(prop.fKey), prop.fKey>=0 ? '#' : '&');
mmaFile += buf;
if (!(playElements & kVLPlayAccompaniment)) if (!(playElements & kVLPlayAccompaniment))
mmaFile += "AllTracks Off\nSolo On\n"; mmaFile += "AllTracks Off\nSolo On\n";
if (!(playElements & kVLPlayMelody)) if (!(playElements & kVLPlayMelody))

View File

@ -16,16 +16,29 @@ void VLMMAWriter::Visit(VLSong & song)
fMeas = 0; fMeas = 0;
fInitial= true; fInitial= true;
fMeasures.clear(); fMeasures.clear();
fKey = -999;
fGroove = "";
VisitMeasures(song, true); VisitMeasures(song, true);
} }
void VLMMAWriter::VisitMeasure(size_t m, VLProperties & p, VLMeasure & meas) void VLMMAWriter::VisitMeasure(size_t m, VLProperties & p, VLMeasure & meas)
{ {
char buf[8]; char buf[64];
if (p.fKey != fKey) {
fKey = p.fKey;
sprintf(buf, "KeySig %d%c\n", labs(fKey), fKey>=0 ? '#' : '&');
fMeasures += buf;
}
if (p.fGroove != fGroove) {
fGroove = p.fGroove;
fMeasures += "Groove " + fGroove + '\n';
}
sprintf(buf, "%-3d", ++fMeas); sprintf(buf, "%-3d", ++fMeas);
fUseSharps = p.fKey >= 0; fUseSharps = fKey >= 0;
// //
// Generate chords // Generate chords

View File

@ -21,15 +21,17 @@ public:
const std::string & Measures() const { return fMeasures; } const std::string & Measures() const { return fMeasures; }
private: private:
std::string fMeasures; std::string fMeasures;
VLSong * fSong; VLSong * fSong;
bool fUseSharps; bool fUseSharps;
bool fTied; bool fTied;
bool fInitial; bool fInitial;
int fMeas; int fMeas;
size_t fLastDur; size_t fLastDur;
std::string fAccum; std::string fAccum;
int fKey;
std::string fGroove;
}; };
// Local Variables: // Local Variables:

View File

@ -517,4 +517,4 @@ advanceAt:
return [self readFromPlist:outPlist error:outError]; return [self readFromPlist:outPlist error:outError];
} }
@end @end