2006-07-23 08:03:19 -04:00
|
|
|
/*
|
2019-08-02 17:26:43 -04:00
|
|
|
* Copyright (C) 2006-2014 David Robillard <d@drobilla.net>
|
|
|
|
* Copyright (C) 2007 Doug McLain <doug@nostar.net>
|
|
|
|
* Copyright (C) 2008-2017 Paul Davis <paul@linuxaudiosystems.com>
|
|
|
|
* Copyright (C) 2009-2012 Carl Hetherington <carl@carlh.net>
|
|
|
|
* Copyright (C) 2014-2019 Robin Gareus <robin@gareus.org>
|
|
|
|
* Copyright (C) 2015 Tim Mayberry <mojofunk@gmail.com>
|
|
|
|
* Copyright (C) 2016 Nick Mainsbridge <mainsbridge@gmail.com>
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
*/
|
2006-07-23 08:03:19 -04:00
|
|
|
|
|
|
|
#include <cmath>
|
2007-05-31 17:37:20 -04:00
|
|
|
#include <utility>
|
2006-07-23 08:03:19 -04:00
|
|
|
|
|
|
|
#include <gtkmm.h>
|
|
|
|
|
|
|
|
#include <gtkmm2ext/gtk_ui.h>
|
|
|
|
|
2013-04-04 00:32:52 -04:00
|
|
|
#include "canvas/line_set.h"
|
|
|
|
#include "canvas/rectangle.h"
|
|
|
|
|
2009-02-25 13:26:51 -05:00
|
|
|
#include "ardour/midi_region.h"
|
|
|
|
#include "ardour/midi_source.h"
|
|
|
|
#include "ardour/midi_track.h"
|
2012-06-13 12:47:06 -04:00
|
|
|
#include "ardour/operations.h"
|
2009-02-25 13:26:51 -05:00
|
|
|
#include "ardour/region_factory.h"
|
2009-10-30 11:30:22 -04:00
|
|
|
#include "ardour/session.h"
|
2012-05-24 02:09:29 -04:00
|
|
|
#include "ardour/smf_source.h"
|
2015-08-15 00:16:28 -04:00
|
|
|
#include "ardour/evoral_types_convert.h"
|
2006-07-23 08:03:19 -04:00
|
|
|
|
2009-02-15 14:44:27 -05:00
|
|
|
#include "gui_thread.h"
|
2006-08-14 04:44:14 -04:00
|
|
|
#include "midi_region_view.h"
|
2009-02-15 14:44:27 -05:00
|
|
|
#include "midi_streamview.h"
|
2006-07-23 08:03:19 -04:00
|
|
|
#include "midi_time_axis.h"
|
2009-02-15 14:44:27 -05:00
|
|
|
#include "midi_util.h"
|
2006-07-23 08:03:19 -04:00
|
|
|
#include "public_editor.h"
|
2009-02-15 14:44:27 -05:00
|
|
|
#include "region_selection.h"
|
|
|
|
#include "region_view.h"
|
2006-07-23 08:03:19 -04:00
|
|
|
#include "rgb_macros.h"
|
2009-02-15 14:44:27 -05:00
|
|
|
#include "selection.h"
|
2015-01-02 09:44:54 -05:00
|
|
|
#include "ui_config.h"
|
2009-02-15 14:44:27 -05:00
|
|
|
#include "utils.h"
|
2006-07-23 08:03:19 -04:00
|
|
|
|
2016-07-14 14:44:52 -04:00
|
|
|
#include "pbd/i18n.h"
|
2013-01-19 02:00:43 -05:00
|
|
|
|
2007-05-31 17:37:20 -04:00
|
|
|
using namespace std;
|
2006-07-23 08:03:19 -04:00
|
|
|
using namespace ARDOUR;
|
2014-06-25 15:27:37 -04:00
|
|
|
using namespace ARDOUR_UI_UTILS;
|
2006-07-23 08:03:19 -04:00
|
|
|
using namespace PBD;
|
|
|
|
using namespace Editing;
|
|
|
|
|
2009-07-09 13:58:13 -04:00
|
|
|
MidiStreamView::MidiStreamView (MidiTimeAxisView& tv)
|
2006-07-23 08:03:19 -04:00
|
|
|
: StreamView (tv)
|
2008-01-13 12:45:17 -05:00
|
|
|
, note_range_adjustment(0.0f, 0.0f, 0.0f)
|
2008-09-22 22:40:29 -04:00
|
|
|
, _range_dirty(false)
|
2008-01-13 12:45:17 -05:00
|
|
|
, _range_sum_cache(-1.0)
|
2022-04-16 13:10:43 -04:00
|
|
|
, _lowest_note(UIConfiguration::instance().get_default_lower_midi_note())
|
|
|
|
, _highest_note(UIConfiguration::instance().get_default_upper_midi_note())
|
2008-09-22 22:40:29 -04:00
|
|
|
, _data_note_min(60)
|
|
|
|
, _data_note_max(71)
|
2011-05-27 18:39:52 -04:00
|
|
|
, _note_lines (0)
|
2011-04-16 09:31:27 -04:00
|
|
|
, _updates_suspended (false)
|
2006-07-23 08:03:19 -04:00
|
|
|
{
|
2022-12-08 19:36:15 -05:00
|
|
|
/* use a dedicated group for MIDI regions (on top of the grid and lines) */
|
|
|
|
_region_group = new ArdourCanvas::Container (_canvas_group);
|
|
|
|
_region_group->raise_to_top ();
|
|
|
|
_region_group->set_render_with_alpha (UIConfiguration::instance().modifier ("region alpha").a());
|
2008-02-10 13:16:25 -05:00
|
|
|
|
2009-10-14 12:10:01 -04:00
|
|
|
/* put the note lines in the timeaxisview's group, so it
|
2013-04-04 00:32:52 -04:00
|
|
|
can be put below ghost regions from MIDI underlays
|
|
|
|
*/
|
2014-06-09 15:39:57 -04:00
|
|
|
_note_lines = new ArdourCanvas::LineSet (_canvas_group, ArdourCanvas::LineSet::Horizontal);
|
2015-10-05 10:17:49 -04:00
|
|
|
|
2013-04-04 18:45:27 -04:00
|
|
|
_note_lines->Event.connect(
|
2011-05-27 18:39:52 -04:00
|
|
|
sigc::bind(sigc::mem_fun(_trackview.editor(),
|
|
|
|
&PublicEditor::canvas_stream_view_event),
|
|
|
|
_note_lines, &_trackview));
|
2009-02-15 14:44:27 -05:00
|
|
|
|
2008-02-10 13:16:25 -05:00
|
|
|
_note_lines->lower_to_bottom();
|
2008-01-13 12:45:17 -05:00
|
|
|
|
2010-06-28 17:03:26 -04:00
|
|
|
color_handler ();
|
|
|
|
|
2015-01-02 09:44:54 -05:00
|
|
|
UIConfiguration::instance().ColorsChanged.connect(sigc::mem_fun(*this, &MidiStreamView::color_handler));
|
2023-02-05 13:36:24 -05:00
|
|
|
UIConfiguration::instance().ParameterChanged.connect(sigc::mem_fun(*this, &MidiStreamView::parameter_changed));
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2008-09-22 22:40:29 -04:00
|
|
|
note_range_adjustment.set_page_size(_highest_note - _lowest_note);
|
|
|
|
note_range_adjustment.set_value(_lowest_note);
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2009-02-15 14:44:27 -05:00
|
|
|
note_range_adjustment.signal_value_changed().connect(
|
2011-05-27 18:39:52 -04:00
|
|
|
sigc::mem_fun(*this, &MidiStreamView::note_range_adjustment_changed));
|
2006-07-23 08:03:19 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
MidiStreamView::~MidiStreamView ()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2023-02-05 13:36:24 -05:00
|
|
|
void
|
|
|
|
MidiStreamView::parameter_changed (string const & param)
|
|
|
|
{
|
|
|
|
if (param == X_("max-note-height")) {
|
2023-02-05 14:24:12 -05:00
|
|
|
apply_note_range (_lowest_note, _highest_note, true);
|
2023-02-05 13:36:24 -05:00
|
|
|
} else {
|
|
|
|
StreamView::parameter_changed (param);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-05-31 17:37:20 -04:00
|
|
|
RegionView*
|
2023-02-16 18:33:28 -05:00
|
|
|
MidiStreamView::create_region_view (std::shared_ptr<Region> r, bool /*wfd*/, bool recording)
|
2006-07-23 08:03:19 -04:00
|
|
|
{
|
2023-02-16 18:33:28 -05:00
|
|
|
std::shared_ptr<MidiRegion> region = std::dynamic_pointer_cast<MidiRegion> (r);
|
2006-07-23 08:03:19 -04:00
|
|
|
|
|
|
|
if (region == 0) {
|
2009-06-08 15:28:51 -04:00
|
|
|
return 0;
|
2006-07-23 08:03:19 -04:00
|
|
|
}
|
|
|
|
|
2014-12-17 02:34:30 -05:00
|
|
|
RegionView* region_view = NULL;
|
|
|
|
if (recording) {
|
|
|
|
region_view = new MidiRegionView (
|
2022-12-08 19:36:15 -05:00
|
|
|
_region_group, _trackview, region,
|
2014-12-17 02:34:30 -05:00
|
|
|
_samples_per_pixel, region_color, recording,
|
|
|
|
TimeAxisViewItem::Visibility(TimeAxisViewItem::ShowFrame));
|
|
|
|
} else {
|
2022-12-08 19:36:15 -05:00
|
|
|
region_view = new MidiRegionView (_region_group, _trackview, region,
|
2014-12-17 02:34:30 -05:00
|
|
|
_samples_per_pixel, region_color);
|
|
|
|
}
|
2011-05-27 18:39:52 -04:00
|
|
|
|
2014-06-09 23:28:32 -04:00
|
|
|
region_view->init (false);
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2009-06-08 15:28:51 -04:00
|
|
|
return region_view;
|
|
|
|
}
|
2006-07-23 08:03:19 -04:00
|
|
|
|
2009-06-08 15:28:51 -04:00
|
|
|
RegionView*
|
2023-02-16 18:33:28 -05:00
|
|
|
MidiStreamView::add_region_view_internal (std::shared_ptr<Region> r, bool wait_for_data, bool recording)
|
2009-06-08 15:28:51 -04:00
|
|
|
{
|
2023-02-16 18:33:28 -05:00
|
|
|
std::shared_ptr<MidiRegion> region = std::dynamic_pointer_cast<MidiRegion> (r);
|
2009-06-08 15:28:51 -04:00
|
|
|
|
2014-01-09 11:54:01 -05:00
|
|
|
if (!region) {
|
2009-06-08 15:28:51 -04:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (list<RegionView*>::iterator i = region_views.begin(); i != region_views.end(); ++i) {
|
2006-08-29 17:21:48 -04:00
|
|
|
if ((*i)->region() == r) {
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2006-07-23 08:03:19 -04:00
|
|
|
/* great. we already have a MidiRegionView for this Region. use it again. */
|
|
|
|
|
|
|
|
(*i)->set_valid (true);
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2022-03-30 15:09:22 -04:00
|
|
|
display_region (dynamic_cast<MidiRegionView*>(*i), wait_for_data);
|
2007-07-05 03:02:24 -04:00
|
|
|
|
2009-06-08 15:28:51 -04:00
|
|
|
return 0;
|
2006-07-23 08:03:19 -04:00
|
|
|
}
|
|
|
|
}
|
2009-06-08 15:28:51 -04:00
|
|
|
|
2014-01-09 11:54:01 -05:00
|
|
|
MidiRegionView* region_view = dynamic_cast<MidiRegionView*> (create_region_view (r, wait_for_data, recording));
|
2009-06-08 15:28:51 -04:00
|
|
|
if (region_view == 0) {
|
|
|
|
return 0;
|
|
|
|
}
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2006-07-23 08:03:19 -04:00
|
|
|
region_views.push_front (region_view);
|
2007-07-05 03:02:24 -04:00
|
|
|
|
2022-03-30 18:44:04 -04:00
|
|
|
{
|
2022-04-04 12:04:53 -04:00
|
|
|
RegionView::DisplaySuspender ds (*region_view, false);
|
2012-06-13 12:47:06 -04:00
|
|
|
|
2022-03-30 18:44:04 -04:00
|
|
|
display_region (region_view, wait_for_data);
|
|
|
|
|
|
|
|
/* fit note range if we are importing */
|
|
|
|
if (_trackview.session()->operation_in_progress (Operations::insert_file)) {
|
|
|
|
/* this will call display_region() */
|
|
|
|
set_note_range (ContentsRange);
|
|
|
|
}
|
|
|
|
}
|
2022-03-30 15:06:49 -04:00
|
|
|
|
2007-06-01 19:27:29 -04:00
|
|
|
/* catch regionview going away */
|
2023-02-16 18:33:28 -05:00
|
|
|
std::weak_ptr<Region> wr (region); // make this explicit
|
2013-01-15 10:12:30 -05:00
|
|
|
region->DropReferences.connect (*this, invalidator (*this), boost::bind (&MidiStreamView::remove_region_view, this, wr), gui_context());
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2006-07-23 08:03:19 -04:00
|
|
|
RegionViewAdded (region_view);
|
2007-05-31 17:37:20 -04:00
|
|
|
|
|
|
|
return region_view;
|
2006-07-23 08:03:19 -04:00
|
|
|
}
|
|
|
|
|
2007-07-05 03:02:24 -04:00
|
|
|
void
|
2022-04-04 12:04:53 -04:00
|
|
|
MidiStreamView::display_region (MidiRegionView* region_view, bool)
|
2007-07-05 03:02:24 -04:00
|
|
|
{
|
2011-03-07 20:49:13 -05:00
|
|
|
if (!region_view) {
|
2007-07-05 03:02:24 -04:00
|
|
|
return;
|
2011-05-27 18:39:52 -04:00
|
|
|
}
|
2009-02-15 14:44:27 -05:00
|
|
|
|
2022-04-04 12:04:53 -04:00
|
|
|
RegionView::DisplaySuspender ds (*region_view, false);
|
2022-03-30 18:44:04 -04:00
|
|
|
|
2014-12-06 16:46:00 -05:00
|
|
|
region_view->set_height (child_height());
|
2007-07-05 03:02:24 -04:00
|
|
|
|
2023-02-16 18:33:28 -05:00
|
|
|
std::shared_ptr<MidiSource> source (region_view->midi_region()->midi_source(0));
|
2022-03-30 12:33:10 -04:00
|
|
|
|
2014-12-06 16:46:00 -05:00
|
|
|
if (!source) {
|
|
|
|
error << _("attempt to display MIDI region with no source") << endmsg;
|
|
|
|
return;
|
|
|
|
}
|
2007-08-02 17:08:18 -04:00
|
|
|
|
2014-12-06 16:46:00 -05:00
|
|
|
if (!source->model()) {
|
|
|
|
error << _("attempt to display MIDI region with no model") << endmsg;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2022-03-30 12:33:10 -04:00
|
|
|
_range_dirty = update_data_note_range (source->model()->lowest_note(), source->model()->highest_note());
|
2008-09-22 22:40:29 -04:00
|
|
|
|
2007-07-30 22:16:46 -04:00
|
|
|
// Display region contents
|
2022-03-30 15:06:49 -04:00
|
|
|
region_view->display_model (source->model());
|
2007-07-05 03:02:24 -04:00
|
|
|
}
|
|
|
|
|
2014-01-09 11:54:01 -05:00
|
|
|
|
2007-08-04 00:18:34 -04:00
|
|
|
void
|
2023-02-16 18:33:28 -05:00
|
|
|
MidiStreamView::display_track (std::shared_ptr<Track> tr)
|
2007-08-04 00:18:34 -04:00
|
|
|
{
|
2010-04-21 16:42:22 -04:00
|
|
|
StreamView::display_track (tr);
|
2010-05-29 08:16:13 -04:00
|
|
|
|
2008-01-13 12:45:17 -05:00
|
|
|
draw_note_lines();
|
2011-05-27 18:39:52 -04:00
|
|
|
|
2019-07-14 12:39:50 -04:00
|
|
|
NoteRangeChanged(); /* EMIT SIGNAL*/
|
2007-08-04 00:18:34 -04:00
|
|
|
}
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2009-02-15 14:44:27 -05:00
|
|
|
void
|
2023-02-16 18:33:28 -05:00
|
|
|
MidiStreamView::update_contents_metrics(std::shared_ptr<Region> r)
|
2009-02-15 14:44:27 -05:00
|
|
|
{
|
2023-02-16 18:33:28 -05:00
|
|
|
std::shared_ptr<MidiRegion> mr = std::dynamic_pointer_cast<MidiRegion>(r);
|
2022-03-30 14:56:04 -04:00
|
|
|
|
2009-02-15 14:44:27 -05:00
|
|
|
if (mr) {
|
2022-03-30 14:56:04 -04:00
|
|
|
Source::ReaderLock lm (mr->midi_source(0)->mutex());
|
|
|
|
_range_dirty = update_data_note_range (mr->model()->lowest_note(), mr->model()->highest_note());
|
2009-02-15 14:44:27 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-09-22 22:40:29 -04:00
|
|
|
bool
|
|
|
|
MidiStreamView::update_data_note_range(uint8_t min, uint8_t max)
|
|
|
|
{
|
|
|
|
bool dirty = false;
|
|
|
|
if (min < _data_note_min) {
|
|
|
|
_data_note_min = min;
|
|
|
|
dirty = true;
|
|
|
|
}
|
|
|
|
if (max > _data_note_max) {
|
|
|
|
_data_note_max = max;
|
|
|
|
dirty = true;
|
|
|
|
}
|
|
|
|
return dirty;
|
|
|
|
}
|
2007-08-04 00:18:34 -04:00
|
|
|
|
2017-01-29 09:02:07 -05:00
|
|
|
void
|
|
|
|
MidiStreamView::set_layer_display (LayerDisplay d)
|
|
|
|
{
|
2017-02-06 13:42:29 -05:00
|
|
|
|
|
|
|
//revert this change for now. Although stacked view is weirdly implemented wrt the "scroomer", it is still necessary to manage layered midi regions.
|
|
|
|
// if (d != Overlaid) {
|
|
|
|
// return;
|
|
|
|
// }
|
2017-01-29 09:02:07 -05:00
|
|
|
|
|
|
|
StreamView::set_layer_display (d);
|
2022-12-08 23:29:33 -05:00
|
|
|
for (auto& rv : region_views) {
|
|
|
|
rv->set_frame_color ();
|
|
|
|
}
|
2017-01-29 09:02:07 -05:00
|
|
|
}
|
|
|
|
|
2006-07-23 08:03:19 -04:00
|
|
|
void
|
2010-04-21 16:42:22 -04:00
|
|
|
MidiStreamView::redisplay_track ()
|
2006-07-23 08:03:19 -04:00
|
|
|
{
|
2009-07-09 13:58:13 -04:00
|
|
|
if (!_trackview.is_midi_track()) {
|
2009-02-15 14:44:27 -05:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2009-02-15 15:31:05 -05:00
|
|
|
list<RegionView*>::iterator i;
|
2006-07-23 08:03:19 -04:00
|
|
|
|
2009-02-15 14:44:27 -05:00
|
|
|
// Load models if necessary, and find note range of all our contents
|
2008-09-22 22:40:29 -04:00
|
|
|
_range_dirty = false;
|
|
|
|
_data_note_min = 127;
|
|
|
|
_data_note_max = 0;
|
2010-04-21 16:42:22 -04:00
|
|
|
_trackview.track()->playlist()->foreach_region(
|
2011-05-27 18:39:52 -04:00
|
|
|
sigc::mem_fun (*this, &StreamView::update_contents_metrics));
|
2008-09-22 22:40:29 -04:00
|
|
|
|
|
|
|
// No notes, use default range
|
|
|
|
if (!_range_dirty) {
|
|
|
|
_data_note_min = 60;
|
|
|
|
_data_note_max = 71;
|
2006-07-23 08:03:19 -04:00
|
|
|
}
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2022-03-30 18:44:04 -04:00
|
|
|
vector<RegionView::DisplaySuspender> vds;
|
|
|
|
|
2009-02-15 14:44:27 -05:00
|
|
|
// Flag region views as invalid and disable drawing
|
|
|
|
for (i = region_views.begin(); i != region_views.end(); ++i) {
|
2022-03-30 18:44:04 -04:00
|
|
|
(*i)->set_valid (false);
|
2022-04-04 12:04:53 -04:00
|
|
|
vds.push_back (RegionView::DisplaySuspender (**i, false));
|
2006-07-23 08:03:19 -04:00
|
|
|
}
|
2007-08-06 02:09:41 -04:00
|
|
|
|
2009-02-15 15:31:05 -05:00
|
|
|
// Add and display region views, and flag them as valid
|
2022-03-30 12:33:10 -04:00
|
|
|
_trackview.track()->playlist()->foreach_region (sigc::hide_return (sigc::mem_fun (*this, &StreamView::add_region_view)));
|
2009-02-15 14:44:27 -05:00
|
|
|
|
2009-02-15 15:31:05 -05:00
|
|
|
// Stack regions by layer, and remove invalid regions
|
|
|
|
layer_regions();
|
2008-09-14 14:08:58 -04:00
|
|
|
|
2009-02-15 15:31:05 -05:00
|
|
|
// Update note range (not regions which are correct) and draw note lines
|
2022-03-30 18:44:04 -04:00
|
|
|
apply_note_range (_lowest_note, _highest_note, false);
|
2006-07-23 08:03:19 -04:00
|
|
|
}
|
2007-08-04 00:18:34 -04:00
|
|
|
|
|
|
|
void
|
2008-09-19 15:32:10 -04:00
|
|
|
MidiStreamView::update_contents_height ()
|
2007-08-04 00:18:34 -04:00
|
|
|
{
|
2008-09-19 15:32:10 -04:00
|
|
|
StreamView::update_contents_height();
|
2014-06-09 15:39:57 -04:00
|
|
|
|
|
|
|
_note_lines->set_extent (ArdourCanvas::COORD_MAX);
|
2010-06-03 11:57:31 -04:00
|
|
|
|
2011-05-27 18:39:52 -04:00
|
|
|
apply_note_range (lowest_note(), highest_note(), true);
|
2007-08-04 00:18:34 -04:00
|
|
|
}
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2007-08-04 00:18:34 -04:00
|
|
|
void
|
2008-01-13 12:45:17 -05:00
|
|
|
MidiStreamView::draw_note_lines()
|
2007-08-04 00:18:34 -04:00
|
|
|
{
|
2011-05-27 18:39:52 -04:00
|
|
|
if (!_note_lines || _updates_suspended) {
|
|
|
|
return;
|
|
|
|
}
|
2010-06-24 15:46:28 -04:00
|
|
|
|
2008-01-13 12:45:17 -05:00
|
|
|
double y;
|
2023-09-11 16:04:59 -04:00
|
|
|
double prev_y = 0.;
|
2023-09-25 22:03:04 -04:00
|
|
|
Gtkmm2ext::Color black = UIConfiguration::instance().color_mod ("piano roll black", "piano roll black");
|
|
|
|
Gtkmm2ext::Color white = UIConfiguration::instance().color_mod ("piano roll white", "piano roll white");
|
|
|
|
Gtkmm2ext::Color outline = UIConfiguration::instance().color ("piano roll black outline");
|
|
|
|
Gtkmm2ext::Color color;
|
2008-01-13 12:45:17 -05:00
|
|
|
|
2023-04-09 16:34:22 -04:00
|
|
|
ArdourCanvas::LineSet::ResetRAII lr (*_note_lines);
|
2011-05-27 18:39:52 -04:00
|
|
|
|
2011-09-14 12:07:57 -04:00
|
|
|
if (child_height() < 140 || note_height() < 3) {
|
|
|
|
/* track is too small for note lines, or there are too many */
|
2010-05-29 08:16:13 -04:00
|
|
|
return;
|
|
|
|
}
|
2008-01-13 12:45:17 -05:00
|
|
|
|
2013-10-23 10:38:09 -04:00
|
|
|
/* do this is order of highest ... lowest since that matches the
|
|
|
|
* coordinate system in which y=0 is at the top
|
|
|
|
*/
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2014-09-08 12:43:52 -04:00
|
|
|
for (int i = highest_note() + 1; i >= lowest_note(); --i) {
|
2013-10-23 10:38:09 -04:00
|
|
|
|
2023-09-11 16:04:59 -04:00
|
|
|
y = floor (note_to_y (i));
|
2013-10-23 10:38:09 -04:00
|
|
|
|
2023-09-25 22:03:04 -04:00
|
|
|
/* add a thicker line/bar which covers the entire vertical height of this note. */
|
2008-01-13 12:45:17 -05:00
|
|
|
|
2008-09-22 22:40:29 -04:00
|
|
|
switch (i % 12) {
|
2008-01-13 12:45:17 -05:00
|
|
|
case 1:
|
|
|
|
case 3:
|
|
|
|
case 6:
|
|
|
|
case 8:
|
|
|
|
case 10:
|
2023-09-25 22:03:04 -04:00
|
|
|
color = black;
|
2008-01-13 12:45:17 -05:00
|
|
|
break;
|
2023-09-25 22:03:04 -04:00
|
|
|
case 4:
|
|
|
|
case 11:
|
|
|
|
/* this is the line actually corresponding to the division between B & C and E & F */
|
|
|
|
_note_lines->add_coord (y, 1.0, outline);
|
|
|
|
/* fallthrough */
|
2008-01-13 12:45:17 -05:00
|
|
|
default:
|
2023-09-25 22:03:04 -04:00
|
|
|
color = white;
|
2008-01-13 12:45:17 -05:00
|
|
|
break;
|
2007-08-04 00:18:34 -04:00
|
|
|
}
|
2008-01-13 12:45:17 -05:00
|
|
|
|
2013-10-23 10:38:09 -04:00
|
|
|
double h = y - prev_y;
|
2023-09-25 22:03:04 -04:00
|
|
|
double middle = y + (h/2.0);
|
2023-09-11 16:04:59 -04:00
|
|
|
|
2023-09-25 22:03:04 -04:00
|
|
|
if (!fmod (h, 2.) && !fmod (middle, 1.)) {
|
|
|
|
middle += 0.5;
|
2023-09-11 16:04:59 -04:00
|
|
|
}
|
|
|
|
|
2023-09-25 22:03:04 -04:00
|
|
|
if (middle >= 0 && h > 1.0) {
|
|
|
|
_note_lines->add_coord (middle, h, color);
|
2008-01-13 12:45:17 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
prev_y = y;
|
2007-08-04 00:18:34 -04:00
|
|
|
}
|
|
|
|
}
|
2007-08-06 02:09:41 -04:00
|
|
|
|
|
|
|
void
|
|
|
|
MidiStreamView::set_note_range(VisibleNoteRange r)
|
|
|
|
{
|
|
|
|
if (r == FullRange) {
|
|
|
|
_lowest_note = 0;
|
|
|
|
_highest_note = 127;
|
|
|
|
} else {
|
2008-09-22 22:40:29 -04:00
|
|
|
_lowest_note = _data_note_min;
|
|
|
|
_highest_note = _data_note_max;
|
2007-08-06 02:09:41 -04:00
|
|
|
}
|
2008-09-22 22:40:29 -04:00
|
|
|
|
2009-02-15 14:44:27 -05:00
|
|
|
apply_note_range(_lowest_note, _highest_note, true);
|
2007-08-06 02:09:41 -04:00
|
|
|
}
|
2007-08-04 00:18:34 -04:00
|
|
|
|
2008-01-13 12:45:17 -05:00
|
|
|
void
|
2009-02-15 14:44:27 -05:00
|
|
|
MidiStreamView::apply_note_range(uint8_t lowest, uint8_t highest, bool to_region_views)
|
2008-09-22 22:40:29 -04:00
|
|
|
{
|
|
|
|
_highest_note = highest;
|
|
|
|
_lowest_note = lowest;
|
2011-04-16 09:31:27 -04:00
|
|
|
|
2022-01-29 16:15:15 -05:00
|
|
|
float uiscale = UIConfiguration::instance().get_ui_scale();
|
|
|
|
uiscale = expf (uiscale) / expf (1.f);
|
|
|
|
|
2023-02-05 13:36:24 -05:00
|
|
|
const int mnh = UIConfiguration::instance().get_max_note_height();
|
|
|
|
int const max_note_height = std::max<int> (mnh, mnh * uiscale);
|
2011-05-27 18:39:52 -04:00
|
|
|
int const range = _highest_note - _lowest_note;
|
2023-02-05 14:24:12 -05:00
|
|
|
|
|
|
|
int const available_note_range = floor (child_height() / max_note_height);
|
|
|
|
int additional_notes = available_note_range - range;
|
|
|
|
|
|
|
|
/* distribute additional notes to higher and lower ranges, clamp at 0 and 127 */
|
|
|
|
for (int i = 0; i < additional_notes; i++){
|
|
|
|
|
|
|
|
if (i % 2 && _highest_note < 127){
|
|
|
|
_highest_note++;
|
|
|
|
}
|
|
|
|
else if (i % 2) {
|
|
|
|
_lowest_note--;
|
|
|
|
}
|
|
|
|
else if (_lowest_note > 0){
|
|
|
|
_lowest_note--;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
_highest_note++;
|
2010-06-03 12:02:49 -04:00
|
|
|
}
|
|
|
|
}
|
2011-05-27 18:39:52 -04:00
|
|
|
|
2022-04-17 14:04:05 -04:00
|
|
|
note_range_adjustment.set_page_size (_highest_note - _lowest_note);
|
|
|
|
note_range_adjustment.set_value (_lowest_note);
|
2011-05-27 18:39:52 -04:00
|
|
|
|
2008-09-22 22:40:29 -04:00
|
|
|
draw_note_lines();
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2009-02-15 14:44:27 -05:00
|
|
|
if (to_region_views) {
|
2011-04-16 09:31:27 -04:00
|
|
|
apply_note_range_to_regions ();
|
|
|
|
}
|
2011-05-27 18:39:52 -04:00
|
|
|
|
2019-07-14 12:39:50 -04:00
|
|
|
NoteRangeChanged(); /* EMIT SIGNAL*/
|
2011-04-16 09:31:27 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
MidiStreamView::apply_note_range_to_regions ()
|
|
|
|
{
|
|
|
|
if (!_updates_suspended) {
|
2009-02-15 14:44:27 -05:00
|
|
|
for (list<RegionView*>::iterator i = region_views.begin(); i != region_views.end(); ++i) {
|
2010-06-03 12:02:49 -04:00
|
|
|
((MidiRegionView*)(*i))->apply_note_range(_lowest_note, _highest_note);
|
2009-02-15 14:44:27 -05:00
|
|
|
}
|
2008-01-13 12:45:17 -05:00
|
|
|
}
|
|
|
|
}
|
2008-09-22 22:40:29 -04:00
|
|
|
|
2009-10-14 12:10:01 -04:00
|
|
|
void
|
2008-09-22 22:40:29 -04:00
|
|
|
MidiStreamView::update_note_range(uint8_t note_num)
|
2007-07-14 21:56:11 -04:00
|
|
|
{
|
2008-09-22 22:40:29 -04:00
|
|
|
_data_note_min = min(_data_note_min, note_num);
|
|
|
|
_data_note_max = max(_data_note_max, note_num);
|
2007-07-14 21:56:11 -04:00
|
|
|
}
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2006-07-23 08:03:19 -04:00
|
|
|
void
|
|
|
|
MidiStreamView::setup_rec_box ()
|
|
|
|
{
|
|
|
|
// cerr << _trackview.name() << " streamview SRB\n";
|
|
|
|
|
2020-05-10 07:13:18 -04:00
|
|
|
if (!_trackview.session()->transport_stopped_or_stopping() &&
|
|
|
|
(_trackview.session()->transport_rolling() || _trackview.session()->get_record_enabled())) {
|
2006-07-23 08:03:19 -04:00
|
|
|
|
2009-10-14 12:10:01 -04:00
|
|
|
if (!rec_active &&
|
2009-12-17 13:24:23 -05:00
|
|
|
_trackview.session()->record_status() == Session::Recording &&
|
2016-04-08 16:49:47 -04:00
|
|
|
_trackview.track()->rec_enable_control()->get_value()) {
|
2006-07-23 08:03:19 -04:00
|
|
|
|
2015-01-02 09:44:54 -05:00
|
|
|
if (UIConfiguration::instance().get_show_waveforms_while_recording() && rec_regions.size() == rec_rects.size()) {
|
2006-07-23 08:03:19 -04:00
|
|
|
|
2010-04-18 21:40:42 -04:00
|
|
|
/* add a new region, but don't bother if they set show-waveforms-while-recording mid-record */
|
2006-07-23 08:03:19 -04:00
|
|
|
|
|
|
|
MidiRegion::SourceList sources;
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2009-12-17 13:24:23 -05:00
|
|
|
rec_data_ready_connections.drop_connections ();
|
2006-07-23 08:03:19 -04:00
|
|
|
|
2010-04-21 16:42:22 -04:00
|
|
|
sources.push_back (_trackview.midi_track()->write_source());
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2006-07-23 08:03:19 -04:00
|
|
|
// handle multi
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2020-10-15 01:09:22 -04:00
|
|
|
timepos_t start;
|
2006-07-23 08:03:19 -04:00
|
|
|
if (rec_regions.size() > 0) {
|
2020-11-30 12:59:17 -05:00
|
|
|
start = rec_regions.back().first->start()
|
2020-10-15 01:09:22 -04:00
|
|
|
+ timepos_t (_trackview.track()->get_captured_samples (rec_regions.size() - 1));
|
2006-07-23 08:03:19 -04:00
|
|
|
}
|
2010-10-08 10:54:16 -04:00
|
|
|
|
|
|
|
if (!rec_regions.empty()) {
|
|
|
|
MidiRegionView* mrv = dynamic_cast<MidiRegionView*> (rec_regions.back().second);
|
|
|
|
mrv->end_write ();
|
|
|
|
}
|
2011-05-27 18:39:52 -04:00
|
|
|
|
|
|
|
PropertyList plist;
|
|
|
|
|
2010-02-18 08:59:49 -05:00
|
|
|
plist.add (ARDOUR::Properties::start, start);
|
2020-10-15 01:09:22 -04:00
|
|
|
plist.add (ARDOUR::Properties::length, timepos_t (Temporal::Beats::ticks (1)));
|
|
|
|
/* Just above we're setting this nascent region's length to 1 tick. I think this is so
|
|
|
|
that the RegionView gets created with a non-zero width, as apparently creating a
|
|
|
|
RegionView with a zero width causes it never to be displayed (there is a warning in
|
|
|
|
TimeAxisViewItem::init about this). We don't want to use 1 sample since that results
|
|
|
|
in zero length musical time duration.
|
2011-03-03 22:55:14 -05:00
|
|
|
*/
|
2010-02-18 08:59:49 -05:00
|
|
|
plist.add (ARDOUR::Properties::name, string());
|
|
|
|
plist.add (ARDOUR::Properties::layer, 0);
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2023-02-16 18:33:28 -05:00
|
|
|
std::shared_ptr<MidiRegion> region (std::dynamic_pointer_cast<MidiRegion>
|
2011-05-27 18:39:52 -04:00
|
|
|
(RegionFactory::create (sources, plist, false)));
|
2013-01-19 02:00:43 -05:00
|
|
|
if (region) {
|
2020-10-15 01:09:22 -04:00
|
|
|
|
|
|
|
/* MIDI regions should likely not be positioned using audio time, but this is
|
|
|
|
* just a rec-region, so we don't really care
|
|
|
|
*/
|
2021-03-03 12:04:33 -05:00
|
|
|
|
|
|
|
region->set_start (timepos_t (_trackview.track()->current_capture_start() - _trackview.track()->get_capture_start_sample (0)));
|
2021-07-16 16:12:00 -04:00
|
|
|
region->set_position (timepos_t (_trackview.track()->current_capture_start ()));
|
2014-12-17 18:40:38 -05:00
|
|
|
|
2014-12-17 02:34:30 -05:00
|
|
|
RegionView* rv = add_region_view_internal (region, false, true);
|
2013-01-19 02:00:43 -05:00
|
|
|
MidiRegionView* mrv = dynamic_cast<MidiRegionView*> (rv);
|
|
|
|
mrv->begin_write ();
|
|
|
|
|
|
|
|
/* rec region will be destroyed in setup_rec_box */
|
|
|
|
rec_regions.push_back (make_pair (region, rv));
|
|
|
|
|
|
|
|
/* we add the region later */
|
|
|
|
setup_new_rec_layer_time (region);
|
|
|
|
} else {
|
|
|
|
error << _("failed to create MIDI region") << endmsg;
|
|
|
|
}
|
2006-07-23 08:03:19 -04:00
|
|
|
}
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2006-07-23 08:03:19 -04:00
|
|
|
/* start a new rec box */
|
|
|
|
|
2019-04-08 15:37:02 -04:00
|
|
|
create_rec_box (_trackview.midi_track()->current_capture_start(), 0);
|
2006-07-23 08:03:19 -04:00
|
|
|
|
|
|
|
} else if (rec_active &&
|
2011-05-27 18:39:52 -04:00
|
|
|
(_trackview.session()->record_status() != Session::Recording ||
|
2016-04-08 16:49:47 -04:00
|
|
|
!_trackview.track()->rec_enable_control()->get_value())) {
|
2006-07-23 08:03:19 -04:00
|
|
|
screen_update_connection.disconnect();
|
|
|
|
rec_active = false;
|
|
|
|
rec_updating = false;
|
|
|
|
}
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2006-07-23 08:03:19 -04:00
|
|
|
} else {
|
|
|
|
|
2006-08-23 00:30:57 -04:00
|
|
|
// cerr << "\tNOT rolling, rec_rects = " << rec_rects.size() << " rec_regions = " << rec_regions.size() << endl;
|
2023-06-04 14:21:41 -04:00
|
|
|
cleanup_rec_box ();
|
2006-07-23 08:03:19 -04:00
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2007-06-15 18:08:27 -04:00
|
|
|
MidiStreamView::color_handler ()
|
2006-07-23 08:03:19 -04:00
|
|
|
{
|
2022-12-08 19:36:15 -05:00
|
|
|
_region_group->set_render_with_alpha (UIConfiguration::instance().modifier ("region alpha").a());
|
2011-05-27 18:39:52 -04:00
|
|
|
draw_note_lines ();
|
2010-06-24 15:46:28 -04:00
|
|
|
|
2009-07-09 13:58:13 -04:00
|
|
|
if (_trackview.is_midi_track()) {
|
2015-01-02 09:44:54 -05:00
|
|
|
canvas_rect->set_fill_color (UIConfiguration::instance().color_mod ("midi track base", "midi track base"));
|
2010-06-05 20:56:05 -04:00
|
|
|
} else {
|
2015-01-02 09:44:54 -05:00
|
|
|
canvas_rect->set_fill_color (UIConfiguration::instance().color ("midi bus base"));
|
2006-07-23 08:03:19 -04:00
|
|
|
}
|
2023-12-09 16:07:58 -05:00
|
|
|
|
|
|
|
for (auto & rv : region_views) {
|
|
|
|
rv->color_handler ();
|
|
|
|
}
|
2006-07-23 08:03:19 -04:00
|
|
|
}
|
2007-06-15 18:08:27 -04:00
|
|
|
|
2008-01-13 12:45:17 -05:00
|
|
|
void
|
2008-09-22 22:40:29 -04:00
|
|
|
MidiStreamView::note_range_adjustment_changed()
|
|
|
|
{
|
2008-01-13 12:45:17 -05:00
|
|
|
double sum = note_range_adjustment.get_value() + note_range_adjustment.get_page_size();
|
|
|
|
int lowest = (int) floor(note_range_adjustment.get_value());
|
|
|
|
int highest;
|
|
|
|
|
2008-09-22 22:40:29 -04:00
|
|
|
if (sum == _range_sum_cache) {
|
2008-01-13 16:34:04 -05:00
|
|
|
//cerr << "cached" << endl;
|
2008-01-13 12:45:17 -05:00
|
|
|
highest = (int) floor(sum);
|
2008-09-22 22:40:29 -04:00
|
|
|
} else {
|
2008-01-13 16:34:04 -05:00
|
|
|
//cerr << "recalc" << endl;
|
2008-01-13 12:45:17 -05:00
|
|
|
highest = lowest + (int) floor(note_range_adjustment.get_page_size());
|
|
|
|
_range_sum_cache = sum;
|
|
|
|
}
|
|
|
|
|
2008-09-22 22:40:29 -04:00
|
|
|
if (lowest == _lowest_note && highest == _highest_note) {
|
2008-01-13 12:45:17 -05:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2008-09-22 22:40:29 -04:00
|
|
|
//cerr << "note range adjustment changed: " << lowest << " " << highest << endl;
|
2008-01-13 12:45:17 -05:00
|
|
|
//cerr << " val=" << v_zoom_adjustment.get_value() << " page=" << v_zoom_adjustment.get_page_size() << " sum=" << v_zoom_adjustment.get_value() + v_zoom_adjustment.get_page_size() << endl;
|
|
|
|
|
2008-09-22 22:40:29 -04:00
|
|
|
_lowest_note = lowest;
|
|
|
|
_highest_note = highest;
|
2009-02-15 14:44:27 -05:00
|
|
|
apply_note_range(lowest, highest, true);
|
2008-01-13 12:45:17 -05:00
|
|
|
}
|
2008-09-22 22:40:29 -04:00
|
|
|
|
2010-10-08 10:54:16 -04:00
|
|
|
void
|
|
|
|
MidiStreamView::update_rec_box ()
|
|
|
|
{
|
|
|
|
StreamView::update_rec_box ();
|
|
|
|
|
|
|
|
if (rec_regions.empty()) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Update the region being recorded to reflect where we currently are */
|
2023-02-16 18:33:28 -05:00
|
|
|
std::shared_ptr<ARDOUR::Region> region = rec_regions.back().first;
|
2020-10-19 14:37:54 -04:00
|
|
|
region->set_length (timecnt_t (_trackview.track()->current_capture_end () - _trackview.track()->current_capture_start()));
|
2010-10-08 10:54:16 -04:00
|
|
|
|
|
|
|
MidiRegionView* mrv = dynamic_cast<MidiRegionView*> (rec_regions.back().second);
|
|
|
|
mrv->extend_active_notes ();
|
|
|
|
}
|
2010-11-14 10:01:53 -05:00
|
|
|
|
2011-03-07 12:17:11 -05:00
|
|
|
uint8_t
|
|
|
|
MidiStreamView::y_to_note (double y) const
|
|
|
|
{
|
2015-11-30 18:15:53 -05:00
|
|
|
int const n = ((contents_height() - y) / contents_height() * (double)contents_note_range())
|
2011-03-07 12:17:11 -05:00
|
|
|
+ lowest_note();
|
|
|
|
|
|
|
|
if (n < 0) {
|
|
|
|
return 0;
|
|
|
|
} else if (n > 127) {
|
|
|
|
return 127;
|
|
|
|
}
|
2011-05-27 18:39:52 -04:00
|
|
|
|
2015-11-30 18:15:53 -05:00
|
|
|
/* min due to rounding and/or off-by-one errors */
|
|
|
|
return min ((uint8_t) n, highest_note());
|
2011-03-07 12:17:11 -05:00
|
|
|
}
|
2011-04-16 09:31:27 -04:00
|
|
|
|
|
|
|
/** Suspend updates to the regions' note ranges and our
|
|
|
|
* note lines until resume_updates() is called.
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
MidiStreamView::suspend_updates ()
|
|
|
|
{
|
|
|
|
_updates_suspended = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
/** Resume updates to region note ranges and note lines,
|
|
|
|
* and update them now.
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
MidiStreamView::resume_updates ()
|
|
|
|
{
|
|
|
|
_updates_suspended = false;
|
2015-10-05 10:17:49 -04:00
|
|
|
|
2011-04-16 09:31:27 -04:00
|
|
|
draw_note_lines ();
|
|
|
|
apply_note_range_to_regions ();
|
2013-10-24 17:55:25 -04:00
|
|
|
|
|
|
|
_canvas_group->redraw ();
|
2011-04-16 09:31:27 -04:00
|
|
|
}
|
2014-12-16 14:37:40 -05:00
|
|
|
|
|
|
|
struct RegionPositionSorter {
|
|
|
|
bool operator() (RegionView* a, RegionView* b) {
|
2020-11-30 12:59:17 -05:00
|
|
|
return a->region()->position() < b->region()->position();
|
2014-12-16 14:37:40 -05:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
bool
|
2020-10-19 14:37:54 -04:00
|
|
|
MidiStreamView::paste (timepos_t const & pos, const Selection& selection, PasteContext& ctx)
|
2014-12-16 14:37:40 -05:00
|
|
|
{
|
|
|
|
/* Paste into the first region which starts on or before pos. Only called when
|
|
|
|
using an internal editing tool. */
|
|
|
|
|
|
|
|
if (region_views.empty()) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
region_views.sort (RegionView::PositionOrder());
|
|
|
|
|
|
|
|
list<RegionView*>::const_iterator prev = region_views.begin ();
|
|
|
|
|
|
|
|
for (list<RegionView*>::const_iterator i = region_views.begin(); i != region_views.end(); ++i) {
|
2020-11-30 12:59:17 -05:00
|
|
|
if ((*i)->region()->position() > pos) {
|
2014-12-16 14:37:40 -05:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
prev = i;
|
|
|
|
}
|
|
|
|
|
2023-02-16 18:33:28 -05:00
|
|
|
std::shared_ptr<Region> r = (*prev)->region ();
|
2014-12-16 14:37:40 -05:00
|
|
|
|
|
|
|
/* If *prev doesn't cover pos, it's no good */
|
2020-11-30 12:59:17 -05:00
|
|
|
if (r->position() > pos || ((r->position() + r->length()) < pos)) {
|
2014-12-16 14:37:40 -05:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
MidiRegionView* mrv = dynamic_cast<MidiRegionView*> (*prev);
|
2020-10-19 14:37:54 -04:00
|
|
|
return mrv ? mrv->paste(pos, selection, ctx) : false;
|
2014-12-16 14:37:40 -05:00
|
|
|
}
|
2020-04-16 14:16:45 -04:00
|
|
|
|
|
|
|
void
|
|
|
|
MidiStreamView::get_regions_with_selected_data (RegionSelection& rs)
|
|
|
|
{
|
|
|
|
for (list<RegionView*>::const_iterator i = region_views.begin(); i != region_views.end(); ++i) {
|
|
|
|
MidiRegionView* mrv = dynamic_cast<MidiRegionView*> (*i);
|
|
|
|
|
|
|
|
if (!mrv) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!mrv->selection().empty()) {
|
|
|
|
rs.add (*i);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|