|
From: Lasse Kärkkäi. <tr...@us...> - 2009-07-27 04:28:42
|
Module: performous
Branch: master
Commit: f6265e3ebac937abadf26bb3c46b8dff1a2f930d
Author: Lasse Karkkainen <tro...@tr...>
Date: Mon Jul 27 07:27:31 2009 +0300
Proper handling of drum tracks (zero length notes).
---
game/songparser-ini.cc | 6 +++++-
1 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/game/songparser-ini.cc b/game/songparser-ini.cc
index 5173cd3..f22d965 100644
--- a/game/songparser-ini.cc
+++ b/game/songparser-ini.cc
@@ -52,6 +52,7 @@ void SongParser::iniParse() {
else name.erase(0, 5);
// Process non-vocal tracks
if (name != "VOCALS") {
+ bool drums = (name == "DRUMS");
s.tracks.push_back(Track(name));
NoteMap& nm = s.tracks.back().nm;
for (MidiFileParser::NoteMap::const_iterator it2 = it->notes.begin(); it2 != it->notes.end(); ++it2) {
@@ -60,7 +61,10 @@ void SongParser::iniParse() {
for (MidiFileParser::Notes::const_iterator it3 = notes.begin(); it3 != notes.end(); ++it3) {
double beg = midi.get_seconds(it3->begin);
double end = midi.get_seconds(it3->end);
- if (beg < end) dur.push_back(Duration(beg, end));
+ if (end == 0) continue; // Note with no ending
+ if (beg > end) throw std::runtime_error("Reversed notes");
+ if (drums) end = beg;
+ dur.push_back(Duration(beg, end));
}
}
continue;
|