/*
- Copyright (C) 2006 Paul Davis
-
- 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., 675 Mass Ave, Cambridge, MA 02139, USA.
-*/
+ * Copyright (C) 2006-2014 David Robillard <d@drobilla.net>
+ * Copyright (C) 2007-2012 Carl Hetherington <carl@carlh.net>
+ * Copyright (C) 2007-2019 Paul Davis <paul@linuxaudiosystems.com>
+ * Copyright (C) 2013-2019 Robin Gareus <robin@gareus.org>
+ * Copyright (C) 2014-2018 Ben Loftis <ben@harrisonconsoles.com>
+ * Copyright (C) 2016 Julien "_FrnchFrgg_" RIVAUD <frnchfrgg@free.fr>
+ *
+ * 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 "pbd/error.h"
#include "ardour/amp.h"
set_align_choice_from_io ();
- use_new_playlist (data_type());
+ if (!name().empty()) {
+ /* an empty name means that we are being constructed via
+ serialized state (XML). Don't create a playlist, because one
+ will be created or discovered during ::set_state().
+ */
+ use_new_playlist (data_type());
+ }
boost::shared_ptr<Route> rp (boost::dynamic_pointer_cast<Route> (shared_from_this()));
boost::shared_ptr<Track> rt = boost::dynamic_pointer_cast<Track> (rp);
if (version >= 3000 && version < 6000) {
if (XMLNode* ds_node = find_named_node (node, "Diskstream")) {
std::string name;
- if (ds_node->get_property ("name", name)) {
+ if (ds_node->get_property ("playlist", name)) {
ds_node->set_property ("active", true);
set_align_choice (ac, true);
}
- if (boost::shared_ptr<AudioPlaylist> pl = boost::dynamic_pointer_cast<AudioPlaylist> (_session.playlists->by_name (name))) {
+ if (boost::shared_ptr<AudioPlaylist> pl = boost::dynamic_pointer_cast<AudioPlaylist> (_session.playlists()->by_name (name))) {
use_playlist (DataType::AUDIO, pl);
}
- if (boost::shared_ptr<MidiPlaylist> pl = boost::dynamic_pointer_cast<MidiPlaylist> (_session.playlists->by_name (name))) {
+ if (boost::shared_ptr<MidiPlaylist> pl = boost::dynamic_pointer_cast<MidiPlaylist> (_session.playlists()->by_name (name))) {
use_playlist (DataType::MIDI, pl);
}
}
return _freeze_record.state;
}
+bool
+Track::declick_in_progress () const
+{
+ return _disk_reader->declick_in_progress ();
+}
+
bool
Track::can_record()
{
boost::shared_ptr<Track> me = boost::dynamic_pointer_cast<Track> (shared_from_this ());
- if (_playlists[data_type()]->all_regions_empty () && _session.playlists->playlists_for_track (me).size() == 1) {
+ if (_playlists[data_type()]->all_regions_empty () && _session.playlists()->playlists_for_track (me).size() == 1) {
/* Only rename the diskstream (and therefore the playlist) if
a) the playlist has never had a region added to it and
b) there is only one playlist for this track.
}
void
-Track::set_pending_overwrite (bool o)
+Track::set_pending_overwrite ()
{
- _disk_reader->set_pending_overwrite (o);
+ _disk_reader->set_pending_overwrite ();
}
int
return _disk_writer->seek (p, complete_refill);
}
-int
+bool
Track::can_internal_playback_seek (samplecnt_t p)
{
return _disk_reader->can_internal_playback_seek (p);
}
-int
+void
Track::internal_playback_seek (samplecnt_t p)
{
return _disk_reader->internal_playback_seek (p);
Route::non_realtime_locate (p);
}
-void
-Track::non_realtime_speed_change ()
-{
- _disk_reader->non_realtime_speed_change ();
-}
-
-int
+bool
Track::overwrite_existing_buffers ()
{
return _disk_reader->overwrite_existing_buffers ();
return _disk_writer->transport_looped (p);
}
-void
-Track::realtime_handle_transport_stopped ()
-{
- Glib::Threads::RWLock::ReaderLock lm (_processor_lock, Glib::Threads::TRY_LOCK);
-
- if (!lm.locked ()) {
- return;
- }
-
- for (ProcessorList::iterator i = _processors.begin(); i != _processors.end(); ++i) {
- (*i)->realtime_handle_transport_stopped ();
- }
-}
-
void
Track::transport_stopped_wallclock (struct tm & n, time_t t, bool g)
{
{
boost::shared_ptr<Playlist> playlist;
- if ((playlist = _session.playlists->by_id (id)) == 0) {
+ if ((playlist = _session.playlists()->by_id (id)) == 0) {
return -1;
}
return use_playlist (dt, playlist);
}
+void
+update_region_visibility(boost::shared_ptr<Region> r)
+{
+ Region::RegionPropertyChanged(r, Properties::hidden);
+}
+
+
int
Track::use_playlist (DataType dt, boost::shared_ptr<Playlist> p)
{
}
}
+ boost::shared_ptr<Playlist> old = _playlists[dt];
+
if (ret == 0) {
_playlists[dt] = p;
}
+
+ //allow all regions of prior and new playlists to update their visibility?
+ if (old) old->foreach_region(update_region_visibility);
+ if (p) p->foreach_region(update_region_visibility);
_session.set_dirty ();
PlaylistChanged (); /* EMIT SIGNAL */
connections.clear ();
}
+
+ /* Special case bounding the Metronome.
+ * Click-out is aligned to output and hence
+ * equivalent to a physical round-trip alike
+ * ExistingMaterial.
+ */
+ if (!have_physical && _session.click_io ()) {
+ if (_session.click_io ()->connected_to (_input)) {
+ have_physical = true;
+ }
+ }
}
+
#ifdef MIXBUS
// compensate for latency when bouncing from master or mixbus.
// we need to use "ExistingMaterial" to pick up the master bus' latency