예제 #1
0
 SearchXmlHandler(MusicBrainzDownloader& dlg) : SimpleSaxHandler<SearchXmlHandler>("metadata"), m_dlg(dlg)
 {
     Node& meta (getRoot()); meta.onStart = &SearchXmlHandler::onMetaStart;
         Node& relList (makeNode(meta, "release-list"));
             Node& rel (makeNode(relList, "release")); rel.onStart = &SearchXmlHandler::onRelStart;
                 Node& trackList (makeNode(rel, "track-list")); trackList.onStart = &SearchXmlHandler::onTrackListStart;
 }
예제 #2
0
파일: MidiParser.cpp 프로젝트: belaamg/munt
bool MidiParser::doParse() {
	if (!parseHeader()) return false;
	if (format == 0xF0) return parseSysex();
	qDebug() << "MidiParser: MIDI file format" << format;
	switch(format) {
		case 0:
			if (numberOfTracks != 1) {
				qDebug() << "MidiParser: MIDI file format error: MIDI files format 0 must have 1 MIDI track, not" << numberOfTracks;
				return false;
			}
			return parseTrack(midiEventList);
		case 1:
			if (numberOfTracks > 0) {
				QVector<MidiEventList> trackList(numberOfTracks);
				for (uint i = 0; i < numberOfTracks; i++) {
					qDebug() << "MidiParser: Parsing & merging MIDI track" << i + 1;
					if (!parseTrack(trackList[i])) return false;
				}
				mergeMidiEventLists(trackList);
				return true;
			}
			qDebug() << "MidiParser: MIDI file format error: MIDI files format 1 must have at least 1 MIDI track";
			return false;
		case 2:
			for (uint i = 0; i < numberOfTracks; i++) {
				qDebug() << "MidiParser: Parsing & appending MIDI track" << i + 1;
				MidiEventList list;
				if (!parseTrack(list)) return false;
				midiEventList += list;
			}
			return true;
		default:
			qDebug() << "MidiParser: MIDI file format error: unknown MIDI file format" << format;
			return false;
	}
}