Handle stanzas

This commit is contained in:
Matthias Neeracher 2008-07-05 13:55:41 +00:00
parent 510bdc0413
commit 50c44322ec
4 changed files with 25 additions and 11 deletions

View File

@ -24,6 +24,7 @@ struct VLMetaEvent : MIDIMetaEvent {
void VLMIDIWriter::Visit(VLSong & song)
{
fVolta.clear();
MusicSequenceNewTrack(fMusic, &fTrack);
VLMetaEvent meta("VocalEasel");
MusicTrackNewMetaEvent(fTrack, 0.0, &meta);
@ -33,8 +34,11 @@ void VLMIDIWriter::Visit(VLSong & song)
void VLMIDIWriter::VisitMeasure(size_t m, VLProperties & p, VLMeasure & meas)
{
if (fVolta.size() <= m)
fVolta.push_back(0);
fTime = p.fTime;
fMeasure = m;
fStanza = ++fVolta[m];
if (!m)
fChordTime = fNoteTime = fCountIn*fTime.fNum;
@ -49,7 +53,7 @@ void VLMIDIWriter::VisitMeasure(size_t m, VLProperties & p, VLMeasure & meas)
void VLMIDIWriter::VisitNote(VLLyricsNote & n)
{
if (n.fPitch != VLNote::kNoPitch && !(n.fTied & VLNote::kTiedWithPrev)) {
VLMIDIUserEvent event = {8, n.fPitch, fMeasure, fAt};
VLMIDIUserEvent event = {8, n.fPitch, fStanza, fMeasure, fAt};
MusicTrackNewUserEvent(fTrack, fNoteTime,
reinterpret_cast<const MusicEventUserData *>(&event));
}
@ -60,7 +64,7 @@ void VLMIDIWriter::VisitNote(VLLyricsNote & n)
void VLMIDIWriter::VisitChord(VLChord & c)
{
if (c.fPitch != VLNote::kNoPitch) {
VLMIDIUserEvent event = {8, 0, fMeasure, fAt};
VLMIDIUserEvent event = {8, 0, fStanza, fMeasure, fAt};
MusicTrackNewUserEvent(fTrack, fChordTime,
reinterpret_cast<const MusicEventUserData *>(&event));
}

View File

@ -15,6 +15,7 @@
struct VLMIDIUserEvent {
uint32_t fLength;
int8_t fPitch; // 0 -> Chord
uint8_t fStanza;
int16_t fMeasure;
VLFract fAt;
};
@ -29,14 +30,16 @@ public:
virtual void VisitNote(VLLyricsNote & n);
virtual void VisitChord(VLChord & c);
private:
MusicSequence fMusic;
size_t fCountIn;
MusicTrack fTrack;
size_t fMeasure;
MusicTimeStamp fChordTime;
MusicTimeStamp fNoteTime;
VLFraction fAt;
VLFraction fTime;
MusicSequence fMusic;
size_t fCountIn;
MusicTrack fTrack;
size_t fMeasure;
size_t fStanza;
MusicTimeStamp fChordTime;
MusicTimeStamp fNoteTime;
VLFraction fAt;
VLFraction fTime;
std::vector<uint8_t> fVolta;
};
// Local Variables:

View File

@ -51,6 +51,7 @@
fNotePitch = event->fPitch;
fNoteMeasure = event->fMeasure;
fNoteAt = event->fAt;
fStanza = event->fStanza;
[fView highlightTextInStanza:fStanza measure:fNoteMeasure at:fNoteAt one:YES];
} else {
fChordMeasure = event->fMeasure;

View File

@ -173,7 +173,7 @@
2A37F4C4FDCFA73011CA2CEA /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = "<absolute>"; };
2A37F4C5FDCFA73011CA2CEA /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = "<absolute>"; };
32DBCF750370BD2300C91783 /* Vocalese_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Vocalese_Prefix.pch; path = Sources/Vocalese_Prefix.pch; sourceTree = "<group>"; };
8D15AC360486D014006FF6A4 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; name = Info.plist; path = Resources/Info.plist; sourceTree = "<group>"; };
8D15AC360486D014006FF6A4 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = Resources/Info.plist; sourceTree = "<group>"; };
8D15AC370486D014006FF6A4 /* VocalEasel.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = VocalEasel.app; sourceTree = BUILT_PRODUCTS_DIR; };
95003B400D4B9A5D00C9849C /* English */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = English; path = English.lproj/MainMenu.xib; sourceTree = "<group>"; };
95003B420D4B9A5D00C9849C /* English */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = English; path = English.lproj/VLDocument.xib; sourceTree = "<group>"; };
@ -947,12 +947,14 @@
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = Sources/VocalEasel_Prefix.pch;
GCC_VERSION = 4.0;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
INFOPLIST_FILE = Resources/Info.plist;
INSTALL_PATH = "$(HOME)/Applications";
PREBINDING = NO;
PRODUCT_NAME = VocalEasel;
SDKROOT = /Developer/SDKs/MacOSX10.4u.sdk;
WRAPPER_EXTENSION = app;
ZERO_LINK = YES;
};
@ -970,12 +972,14 @@
GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = Sources/VocalEasel_Prefix.pch;
GCC_VERSION = 4.0;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
INFOPLIST_FILE = Resources/Info.plist;
INSTALL_PATH = "$(HOME)/Applications";
PREBINDING = NO;
PRODUCT_NAME = VocalEasel;
SDKROOT = /Developer/SDKs/MacOSX10.4u.sdk;
WRAPPER_EXTENSION = app;
ZERO_LINK = NO;
};
@ -987,11 +991,13 @@
GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = Sources/VocalEasel_Prefix.pch;
GCC_VERSION = 4.0;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
INFOPLIST_FILE = Resources/Info.plist;
INSTALL_PATH = "$(HOME)/Applications";
PRODUCT_NAME = VocalEasel;
SDKROOT = /Developer/SDKs/MacOSX10.4u.sdk;
WRAPPER_EXTENSION = app;
};
name = Default;