* Bugfix: resizing beginnings of MIDI regions did not work correctly (it shifted the region content right)
* Bugfix: resizing ends of MIDI tracks did not hide noted beyond region boundaries (in the moment only all notes with note_on >= region end are hidden, their note offs still may exceed region boundaries, but so much for now.....) git-svn-id: svn://localhost/ardour2/branches/3.0@3219 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
549a8cb88b
commit
4ee42dc455
@ -499,21 +499,11 @@ void
|
||||
MidiRegionView::region_resized (Change what_changed)
|
||||
{
|
||||
RegionView::region_resized(what_changed);
|
||||
|
||||
|
||||
if (what_changed & ARDOUR::PositionChanged) {
|
||||
|
||||
if (_enable_display)
|
||||
redisplay_model();
|
||||
|
||||
} else if (what_changed & Change (StartChanged)) {
|
||||
|
||||
//cerr << "MIDI RV START CHANGED" << endl;
|
||||
|
||||
} else if (what_changed & Change (LengthChanged)) {
|
||||
|
||||
//cerr << "MIDI RV LENGTH CHANGED" << endl;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
@ -671,25 +661,36 @@ void
|
||||
MidiRegionView::add_note(const boost::shared_ptr<Note> note)
|
||||
{
|
||||
assert(note->time() >= 0);
|
||||
//assert(note->time() < _region->length());
|
||||
assert(midi_view()->note_mode() == Sustained || midi_view()->note_mode() == Percussive);
|
||||
|
||||
|
||||
// dont display notes beyond the region bounds
|
||||
if(
|
||||
note->time() - _region->start() >= _region->length() ||
|
||||
note->time() < _region->start()
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
ArdourCanvas::Group* const group = (ArdourCanvas::Group*)get_canvas_group();
|
||||
|
||||
CanvasMidiEvent *event = 0;
|
||||
|
||||
const double x = trackview.editor.frame_to_pixel((nframes_t)note->time() - _region->start());
|
||||
|
||||
if (midi_view()->note_mode() == Sustained) {
|
||||
|
||||
//cerr << "MRV::add_note sustained " << note->note() << " @ " << note->time()
|
||||
// << " .. " << note->end_time() << endl;
|
||||
|
||||
|
||||
const double y1 = midi_stream_view()->note_to_y(note->note());
|
||||
|
||||
const double note_endpixel =
|
||||
trackview.editor.frame_to_pixel((nframes_t)note->end_time() - _region->start());
|
||||
|
||||
CanvasNote* ev_rect = new CanvasNote(*this, *group, note);
|
||||
ev_rect->property_x1() = trackview.editor.frame_to_pixel((nframes_t)note->time());
|
||||
ev_rect->property_x1() = x;
|
||||
ev_rect->property_y1() = y1;
|
||||
if (note->duration() > 0)
|
||||
ev_rect->property_x2() = trackview.editor.frame_to_pixel((nframes_t)(note->end_time()));
|
||||
ev_rect->property_x2() = note_endpixel;
|
||||
else
|
||||
ev_rect->property_x2() = trackview.editor.frame_to_pixel(_region->length());
|
||||
ev_rect->property_y2() = y1 + floor(midi_stream_view()->note_height());
|
||||
@ -724,7 +725,6 @@ MidiRegionView::add_note(const boost::shared_ptr<Note> note)
|
||||
// << " .. " << note->end_time() << endl;
|
||||
|
||||
const double diamond_size = midi_stream_view()->note_height() / 2.0;
|
||||
const double x = trackview.editor.frame_to_pixel((nframes_t)note->time());
|
||||
const double y = midi_stream_view()->note_to_y(note->note()) + ((diamond_size-2) / 4.0);
|
||||
|
||||
CanvasHit* ev_diamond = new CanvasHit(*this, *group, diamond_size);
|
||||
@ -740,12 +740,12 @@ MidiRegionView::add_note(const boost::shared_ptr<Note> note)
|
||||
|
||||
if(event) {
|
||||
Note *note = event->note().get();
|
||||
|
||||
|
||||
if(_marked_for_selection.find(note) != _marked_for_selection.end()) {
|
||||
note_selected(event, true);
|
||||
note_selected(event, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
MidiRegionView::delete_selection()
|
||||
|
@ -131,7 +131,7 @@ MidiRegion::master_read_at (MidiRingBuffer& out, nframes_t position, nframes_t d
|
||||
nframes_t
|
||||
MidiRegion::_read_at (const SourceList& srcs, MidiRingBuffer& dst, nframes_t position, nframes_t dur, uint32_t chan_n, NoteMode mode) const
|
||||
{
|
||||
// cerr << _name << "._read_at(" << position << ") - " << _position << endl;
|
||||
//cerr << _name << "._read_at(" << position << ") - " << _position << " duration: " << dur << endl;
|
||||
|
||||
nframes_t internal_offset = 0;
|
||||
nframes_t src_offset = 0;
|
||||
@ -171,7 +171,16 @@ MidiRegion::_read_at (const SourceList& srcs, MidiRingBuffer& dst, nframes_t pos
|
||||
boost::shared_ptr<MidiSource> src = midi_source(chan_n);
|
||||
src->set_note_mode(mode);
|
||||
|
||||
if (src->midi_read (dst, _start + internal_offset, to_read, _position) != to_read) {
|
||||
if (src->midi_read (
|
||||
// the destination buffer
|
||||
dst,
|
||||
// where to start reading in the region
|
||||
_start + internal_offset,
|
||||
// how many bytes
|
||||
to_read,
|
||||
// the offset in the output buffer
|
||||
_position - _start
|
||||
) != to_read) {
|
||||
return 0; /* "read nothing" */
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user