Skip to content

Commit

Permalink
Added error message if negative delta ticks are encountered.
Browse files Browse the repository at this point in the history
  • Loading branch information
craigsapp committed Oct 24, 2016
1 parent e4f70d7 commit b40bee0
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src-library/MidiFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1172,7 +1172,13 @@ void MidiFile::deltaTicks(void) {
}
for (j=1; j<(int)events[i]->size(); j++) {
temp = (*events[i])[j].tick;
(*events[i])[j].tick = temp - timedata[i];
int deltatick = temp - timedata[i];
if (deltatick < 0) {
cerr << "Error: negative delta tick value: " << deltatick << endl
<< "Timestamps must be sorted first"
<< " (use MidiFile::sortTracks() before writing)." << endl;
}
(*events[i])[j].tick = deltatick;
timedata[i] = temp;
}
}
Expand Down

0 comments on commit b40bee0

Please sign in to comment.