Fix invalid error message during MIDI recording (or files with stuck notes).
Handle stuck notes more gracefully in the view (probably should show up as a diamond though?). git-svn-id: svn://localhost/ardour2/branches/3.0@3359 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
f53baec2e4
commit
cb94baf6f4
@ -81,7 +81,7 @@ public:
|
||||
virtual double x2() = 0;
|
||||
virtual double y2() = 0;
|
||||
|
||||
const boost::shared_ptr<ARDOUR::Note> note() { return _note; }
|
||||
const boost::shared_ptr<ARDOUR::Note> note() const { return _note; }
|
||||
|
||||
protected:
|
||||
enum State { None, Pressed, Dragging };
|
||||
|
@ -764,10 +764,20 @@ MidiRegionView::add_note(const boost::shared_ptr<Note> note)
|
||||
ev_rect->property_y2() = y1 + floor(midi_stream_view()->note_height());
|
||||
|
||||
if (note->duration() == 0) {
|
||||
cerr << "MidiModel: WARNING: Discovered note with duration 0 and pitch "
|
||||
<< (int)note->note() << " at time " << note->time() << endl;
|
||||
|
||||
if (_active_notes) {
|
||||
assert(note->note() < 128);
|
||||
// If this note is already active there's a stuck note,
|
||||
// finish the old note rectangle
|
||||
if (_active_notes[note->note()]) {
|
||||
CanvasNote* const old_rect = _active_notes[note->note()];
|
||||
boost::shared_ptr<ARDOUR::Note> old_note = old_rect->note();
|
||||
cerr << "MidiModel: WARNING: Note has duration 0: chan " << old_note->channel()
|
||||
<< "note " << (int)old_note->note() << " @ " << old_note->time() << endl;
|
||||
/* FIXME: How large to make it? Make it a diamond? */
|
||||
old_rect->property_x2() = old_rect->property_x1() + 2.0;
|
||||
old_rect->property_outline_what() = (guint32) 0xF;
|
||||
}
|
||||
_active_notes[note->note()] = ev_rect;
|
||||
}
|
||||
/* outline all but right edge */
|
||||
|
@ -584,7 +584,6 @@ void MidiModel::append_note_off_unlocked(uint8_t chan, double time,
|
||||
for (WriteNotes::iterator n = _write_notes[chan].begin(); n
|
||||
!= _write_notes[chan].end(); ++n) {
|
||||
Note& note = *_notes[*n].get();
|
||||
//cerr << (unsigned)(uint8_t)note.note() << " ? " << (unsigned)note_num << endl;
|
||||
if (note.note() == note_num) {
|
||||
assert(time >= note.time());
|
||||
note.set_duration(time - note.time());
|
||||
|
Loading…
Reference in New Issue
Block a user