/* * Copyright (C) 2006-2016 David Robillard * Copyright (C) 2007-2017 Paul Davis * Copyright (C) 2009-2012 Carl Hetherington * Copyright (C) 2015-2017 Robin Gareus * * 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. */ #include #include #include #include #include #include "evoral/EventList.h" #include "evoral/Control.h" #include "ardour/beats_samples_converter.h" #include "ardour/debug.h" #include "ardour/midi_model.h" #include "ardour/midi_playlist.h" #include "ardour/midi_region.h" #include "ardour/midi_source.h" #include "ardour/midi_state_tracker.h" #include "ardour/region_factory.h" #include "ardour/rt_midibuffer.h" #include "ardour/session.h" #include "ardour/tempo.h" #include "ardour/types.h" #include "pbd/i18n.h" using namespace ARDOUR; using namespace PBD; using namespace std; MidiPlaylist::MidiPlaylist (Session& session, const XMLNode& node, bool hidden) : Playlist (session, node, DataType::MIDI, hidden) , _note_mode(Sustained) , _read_end(0) { #ifndef NDEBUG XMLProperty const * prop = node.property("type"); assert(prop && DataType(prop->value()) == DataType::MIDI); #endif in_set_state++; if (set_state (node, Stateful::loading_state_version)) { throw failed_constructor (); } in_set_state--; relayer (); } MidiPlaylist::MidiPlaylist (Session& session, string name, bool hidden) : Playlist (session, name, DataType::MIDI, hidden) , _note_mode(Sustained) , _read_end(0) { } MidiPlaylist::MidiPlaylist (boost::shared_ptr other, string name, bool hidden) : Playlist (other, name, hidden) , _note_mode(other->_note_mode) , _read_end(0) { } MidiPlaylist::MidiPlaylist (boost::shared_ptr other, samplepos_t start, samplecnt_t dur, string name, bool hidden) : Playlist (other, start, dur, name, hidden) , _note_mode(other->_note_mode) , _read_end(0) { } MidiPlaylist::~MidiPlaylist () { } template struct EventsSortByTimeAndType { bool operator() (const Evoral::Event