remove Diskstream from Track and derivatives; get ardour to actually startup

This commit is contained in:
Paul Davis 2017-04-03 23:36:12 +02:00
parent d16ae875be
commit 35c7274cc9
14 changed files with 140 additions and 224 deletions

View file

@ -96,9 +96,6 @@ class LIBARDOUR_API Auditioner : public Track
int export_stuff (BufferSet&, framepos_t, framecnt_t, boost::shared_ptr<Processor>, bool, bool, bool) int export_stuff (BufferSet&, framepos_t, framecnt_t, boost::shared_ptr<Processor>, bool, bool, bool)
{ return -1; } { return -1; }
boost::shared_ptr<Diskstream> diskstream_factory (XMLNode const &)
{ return boost::shared_ptr<Diskstream> (); }
private: private:
boost::shared_ptr<AudioRegion> the_region; boost::shared_ptr<AudioRegion> the_region;
boost::shared_ptr<MidiRegion> midi_region; boost::shared_ptr<MidiRegion> midi_region;
@ -115,8 +112,6 @@ class LIBARDOUR_API Auditioner : public Track
bool _synth_changed; bool _synth_changed;
bool _queue_panic; bool _queue_panic;
boost::shared_ptr<Diskstream> _diskstream_audio;
boost::shared_ptr<Diskstream> _diskstream_midi;
boost::shared_ptr<Processor> asynth; boost::shared_ptr<Processor> asynth;
void drop_ports (); void drop_ports ();

View file

@ -113,6 +113,8 @@ class LIBARDOUR_API DiskIOProcessor : public Processor
PBD::Signal1<void,DataType> PlaylistChanged; PBD::Signal1<void,DataType> PlaylistChanged;
virtual void adjust_buffering() = 0;
protected: protected:
friend class Auditioner; friend class Auditioner;
virtual int seek (framepos_t which_sample, bool complete_refill = false) = 0; virtual int seek (framepos_t which_sample, bool complete_refill = false) = 0;

View file

@ -131,6 +131,8 @@ class LIBARDOUR_API DiskWriter : public DiskIOProcessor
void transport_looped (framepos_t transport_frame); void transport_looped (framepos_t transport_frame);
void transport_stopped_wallclock (struct tm&, time_t, bool abort); void transport_stopped_wallclock (struct tm&, time_t, bool abort);
void adjust_buffering ();
protected: protected:
friend class Track; friend class Track;
int do_flush (RunContext context, bool force = false); int do_flush (RunContext context, bool force = false);

View file

@ -48,9 +48,6 @@ public:
void realtime_locate (); void realtime_locate ();
void non_realtime_locate (framepos_t); void non_realtime_locate (framepos_t);
boost::shared_ptr<Diskstream> create_diskstream ();
void set_diskstream (boost::shared_ptr<Diskstream>);
bool can_be_record_enabled (); bool can_be_record_enabled ();
bool can_be_record_safe (); bool can_be_record_safe ();
@ -150,20 +147,14 @@ private:
MidiChannelFilter _playback_filter; MidiChannelFilter _playback_filter;
MidiChannelFilter _capture_filter; MidiChannelFilter _capture_filter;
virtual boost::shared_ptr<Diskstream> diskstream_factory (XMLNode const &);
void write_out_of_band_data (BufferSet& bufs, framepos_t start_frame, framepos_t end_frame, framecnt_t nframes); void write_out_of_band_data (BufferSet& bufs, framepos_t start_frame, framepos_t end_frame, framecnt_t nframes);
void set_state_part_two (); void set_state_part_two ();
void set_state_part_three (); void set_state_part_three ();
int no_roll (pframes_t nframes, framepos_t start_frame, framepos_t end_frame, bool state_changing); int no_roll (pframes_t nframes, framepos_t start_frame, framepos_t end_frame, bool state_changing);
void push_midi_input_to_step_edit_ringbuffer (framecnt_t nframes); void push_midi_input_to_step_edit_ringbuffer (framecnt_t nframes);
void diskstream_data_recorded (boost::weak_ptr<MidiSource>);
PBD::ScopedConnection _diskstream_data_recorded_connection;
void track_input_active (IOChange, void*); void track_input_active (IOChange, void*);
void map_input_active (bool); void map_input_active (bool);

View file

@ -115,7 +115,6 @@ class Butler;
class Click; class Click;
class ControllableDescriptor; class ControllableDescriptor;
class CoreSelection; class CoreSelection;
class Diskstream;
class ExportHandler; class ExportHandler;
class ExportStatus; class ExportStatus;
class Graph; class Graph;
@ -283,8 +282,6 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop
void refresh_disk_space (); void refresh_disk_space ();
int load_diskstreams_2X (XMLNode const &, int);
int load_routes (const XMLNode&, int); int load_routes (const XMLNode&, int);
boost::shared_ptr<RouteList> get_routes() const { boost::shared_ptr<RouteList> get_routes() const {
return routes.reader (); return routes.reader ();
@ -2036,9 +2033,6 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop
void rt_set_controls (boost::shared_ptr<ControlList>, double val, PBD::Controllable::GroupControlDisposition group_override); void rt_set_controls (boost::shared_ptr<ControlList>, double val, PBD::Controllable::GroupControlDisposition group_override);
void rt_clear_all_solo_state (boost::shared_ptr<RouteList>, bool yn, PBD::Controllable::GroupControlDisposition group_override); void rt_clear_all_solo_state (boost::shared_ptr<RouteList>, bool yn, PBD::Controllable::GroupControlDisposition group_override);
/** temporary list of Diskstreams used only during load of 2.X sessions */
std::list<boost::shared_ptr<Diskstream> > _diskstreams_2X;
void set_session_range_location (framepos_t, framepos_t); void set_session_range_location (framepos_t, framepos_t);
void setup_midi_machine_control (); void setup_midi_machine_control ();

View file

@ -26,7 +26,6 @@
#include "ardour/interthread_info.h" #include "ardour/interthread_info.h"
#include "ardour/recordable.h" #include "ardour/recordable.h"
#include "ardour/route.h" #include "ardour/route.h"
#include "ardour/public_diskstream.h"
namespace ARDOUR { namespace ARDOUR {
@ -35,10 +34,10 @@ class Playlist;
class RouteGroup; class RouteGroup;
class Source; class Source;
class Region; class Region;
class Diskstream;
class DiskReader; class DiskReader;
class DiskWriter; class DiskWriter;
class IO; class IO;
class Location;
class MonitorControl; class MonitorControl;
class RecordEnableControl; class RecordEnableControl;
class RecordSafeControl; class RecordSafeControl;
@ -50,7 +49,7 @@ class RecordSafeControl;
* to be played from disk, and modifies that object during recording and * to be played from disk, and modifies that object during recording and
* editing. * editing.
*/ */
class LIBARDOUR_API Track : public Route, public Recordable, public PublicDiskstream class LIBARDOUR_API Track : public Route, public Recordable
{ {
public: public:
Track (Session&, std::string name, PresentationInfo::Flag f = PresentationInfo::Flag (0), TrackMode m = Normal, DataType default_type = DataType::AUDIO); Track (Session&, std::string name, PresentationInfo::Flag f = PresentationInfo::Flag (0), TrackMode m = Normal, DataType default_type = DataType::AUDIO);
@ -136,11 +135,8 @@ class LIBARDOUR_API Track : public Route, public Recordable, public PublicDiskst
bool can_be_record_enabled (); bool can_be_record_enabled ();
bool can_be_record_safe (); bool can_be_record_safe ();
bool using_diskstream_id (PBD::ID) const;
void set_block_size (pframes_t); void set_block_size (pframes_t);
/* PublicDiskstream interface */
boost::shared_ptr<Playlist> playlist (); boost::shared_ptr<Playlist> playlist ();
void request_input_monitoring (bool); void request_input_monitoring (bool);
void ensure_input_monitoring (bool); void ensure_input_monitoring (bool);
@ -163,7 +159,7 @@ class LIBARDOUR_API Track : public Route, public Recordable, public PublicDiskst
void non_realtime_set_speed (); void non_realtime_set_speed ();
int overwrite_existing_buffers (); int overwrite_existing_buffers ();
framecnt_t get_captured_frames (uint32_t n = 0) const; framecnt_t get_captured_frames (uint32_t n = 0) const;
int set_loop (Location *); int set_loop (ARDOUR::Location *);
void transport_looped (framepos_t); void transport_looped (framepos_t);
bool realtime_set_speed (double, bool); bool realtime_set_speed (double, bool);
void transport_stopped_wallclock (struct tm &, time_t, bool); void transport_stopped_wallclock (struct tm &, time_t, bool);
@ -181,7 +177,7 @@ class LIBARDOUR_API Track : public Route, public Recordable, public PublicDiskst
void set_align_choice (AlignChoice, bool force=false); void set_align_choice (AlignChoice, bool force=false);
void playlist_modified (); void playlist_modified ();
int use_playlist (DataType, boost::shared_ptr<Playlist>); int use_playlist (DataType, boost::shared_ptr<Playlist>);
int find_and_use_playlist (DataType, std::string const & name); int find_and_use_playlist (DataType, PBD::ID const &);
int use_copy_playlist (); int use_copy_playlist ();
int use_new_playlist (); int use_new_playlist ();
void adjust_playback_buffering (); void adjust_playback_buffering ();
@ -195,8 +191,6 @@ class LIBARDOUR_API Track : public Route, public Recordable, public PublicDiskst
protected: protected:
XMLNode& state (bool full); XMLNode& state (bool full);
boost::shared_ptr<Diskstream> _diskstream;
boost::shared_ptr<DiskReader> _disk_reader; boost::shared_ptr<DiskReader> _disk_reader;
boost::shared_ptr<DiskWriter> _disk_writer; boost::shared_ptr<DiskWriter> _disk_writer;
boost::shared_ptr<Playlist> _playlists[DataType::num_types]; boost::shared_ptr<Playlist> _playlists[DataType::num_types];

View file

@ -254,7 +254,7 @@ AudioTrack::roll (pframes_t nframes, framepos_t start_frame, framepos_t end_fram
fill_buffers_with_input (bufs, _input, nframes); fill_buffers_with_input (bufs, _input, nframes);
if (_meter_point == MeterInput && ((_monitoring_control->monitoring_choice() & MonitorInput) || _diskstream->record_enabled())) { if (_meter_point == MeterInput && ((_monitoring_control->monitoring_choice() & MonitorInput) || _disk_writer->record_enabled())) {
_meter->run (bufs, start_frame, end_frame, 1.0 /*speed()*/, nframes, true); _meter->run (bufs, start_frame, end_frame, 1.0 /*speed()*/, nframes, true);
} }

View file

@ -510,9 +510,13 @@ Auditioner::input_streams () const
depends solely on the region we are auditioning. depends solely on the region we are auditioning.
*/ */
if (_disk_reader) {
return _disk_reader->input_streams (); return _disk_reader->input_streams ();
} }
return ChanCount (DataType::AUDIO, 1);
}
MonitorState MonitorState
Auditioner::monitoring_state () const Auditioner::monitoring_state () const
{ {

View file

@ -17,11 +17,13 @@
*/ */
#include "pbd/debug.h"
#include "pbd/error.h" #include "pbd/error.h"
#include "pbd/i18n.h" #include "pbd/i18n.h"
#include "ardour/audioplaylist.h" #include "ardour/audioplaylist.h"
#include "ardour/butler.h" #include "ardour/butler.h"
#include "ardour/debug.h"
#include "ardour/disk_io.h" #include "ardour/disk_io.h"
#include "ardour/disk_reader.h" #include "ardour/disk_reader.h"
#include "ardour/disk_writer.h" #include "ardour/disk_writer.h"
@ -62,7 +64,7 @@ DiskIOProcessor::DiskIOProcessor (Session& s, string const & str, Flag f)
, speed_buffer_size (0) , speed_buffer_size (0)
, _need_butler (false) , _need_butler (false)
, channels (new ChannelList) , channels (new ChannelList)
, _midi_buf (0) , _midi_buf (new MidiRingBuffer<framepos_t> (s.butler()->midi_diskstream_buffer_size()))
, _frames_written_to_ringbuffer (0) , _frames_written_to_ringbuffer (0)
, _frames_read_from_ringbuffer (0) , _frames_read_from_ringbuffer (0)
{ {
@ -148,7 +150,7 @@ DiskIOProcessor::can_support_io_configuration (const ChanCount& in, ChanCount& o
bool bool
DiskIOProcessor::configure_io (ChanCount in, ChanCount out) DiskIOProcessor::configure_io (ChanCount in, ChanCount out)
{ {
Glib::Threads::Mutex::Lock lm (state_lock); DEBUG_TRACE (DEBUG::DiskIO, string_compose ("Configuring %1 for in:%2 out:%3\n", name(), in, out));
RCUWriter<ChannelList> writer (channels); RCUWriter<ChannelList> writer (channels);
boost::shared_ptr<ChannelList> c = writer.get_copy(); boost::shared_ptr<ChannelList> c = writer.get_copy();
@ -213,9 +215,7 @@ DiskIOProcessor::non_realtime_locate (framepos_t location)
void void
DiskIOProcessor::non_realtime_set_speed () DiskIOProcessor::non_realtime_set_speed ()
{ {
if (_buffer_reallocation_required) if (_buffer_reallocation_required) {
{
Glib::Threads::Mutex::Lock lm (state_lock);
_buffer_reallocation_required = false; _buffer_reallocation_required = false;
} }
@ -368,8 +368,7 @@ DiskIOProcessor::use_playlist (DataType dt, boost::shared_ptr<Playlist> playlist
return 0; return 0;
} }
{ DEBUG_TRACE (DEBUG::DiskIO, string_compose ("%1: set to use playlist %2 (%3)\n", name(), playlist->name(), dt.to_string()));
Glib::Threads::Mutex::Lock lm (state_lock);
if (playlist == _playlists[dt]) { if (playlist == _playlists[dt]) {
return 0; return 0;
@ -388,7 +387,8 @@ DiskIOProcessor::use_playlist (DataType dt, boost::shared_ptr<Playlist> playlist
playlist->LayeringChanged.connect_same_thread (playlist_connections, boost::bind (&DiskIOProcessor::playlist_modified, this)); playlist->LayeringChanged.connect_same_thread (playlist_connections, boost::bind (&DiskIOProcessor::playlist_modified, this));
playlist->DropReferences.connect_same_thread (playlist_connections, boost::bind (&DiskIOProcessor::playlist_deleted, this, boost::weak_ptr<Playlist>(playlist))); playlist->DropReferences.connect_same_thread (playlist_connections, boost::bind (&DiskIOProcessor::playlist_deleted, this, boost::weak_ptr<Playlist>(playlist)));
playlist->RangesMoved.connect_same_thread (playlist_connections, boost::bind (&DiskIOProcessor::playlist_ranges_moved, this, _1, _2)); playlist->RangesMoved.connect_same_thread (playlist_connections, boost::bind (&DiskIOProcessor::playlist_ranges_moved, this, _1, _2));
}
DEBUG_TRACE (DEBUG::DiskIO, string_compose ("%1 now use playlist %1 (%2)\n", name(), playlist->name(), playlist->id()));
PlaylistChanged (dt); /* EMIT SIGNAL */ PlaylistChanged (dt); /* EMIT SIGNAL */
_session.set_dirty (); _session.set_dirty ();
@ -452,4 +452,3 @@ DiskIOProcessor::get_location_times(const Location* location,
*length = *end - *start; *length = *end - *start;
} }
} }

View file

@ -59,7 +59,6 @@ DiskReader::DiskReader (Session& s, string const & str, DiskIOProcessor::Flag f)
DiskReader::~DiskReader () DiskReader::~DiskReader ()
{ {
DEBUG_TRACE (DEBUG::Destruction, string_compose ("DiskReader %1 deleted\n", _name)); DEBUG_TRACE (DEBUG::Destruction, string_compose ("DiskReader %1 deleted\n", _name));
Glib::Threads::Mutex::Lock lm (state_lock);
for (uint32_t n = 0; n < DataType::num_types; ++n) { for (uint32_t n = 0; n < DataType::num_types; ++n) {
if (_playlists[n]) { if (_playlists[n]) {
@ -241,13 +240,6 @@ DiskReader::run (BufferSet& bufs, framepos_t start_frame, framepos_t end_frame,
boost::shared_ptr<ChannelList> c = channels.reader(); boost::shared_ptr<ChannelList> c = channels.reader();
ChannelList::iterator chan; ChannelList::iterator chan;
framecnt_t playback_distance = 0; framecnt_t playback_distance = 0;
Glib::Threads::Mutex::Lock sm (state_lock, Glib::Threads::TRY_LOCK);
if (!sm.locked()) {
return;
}
const bool need_disk_signal = result_required || _monitoring_choice == MonitorDisk || _monitoring_choice == MonitorCue; const bool need_disk_signal = result_required || _monitoring_choice == MonitorDisk || _monitoring_choice == MonitorCue;
if (fabsf (_actual_speed) != 1.0f) { if (fabsf (_actual_speed) != 1.0f) {
@ -586,8 +578,6 @@ DiskReader::seek (framepos_t frame, bool complete_refill)
ChannelList::iterator chan; ChannelList::iterator chan;
boost::shared_ptr<ChannelList> c = channels.reader(); boost::shared_ptr<ChannelList> c = channels.reader();
Glib::Threads::Mutex::Lock lm (state_lock);
for (n = 0, chan = c->begin(); chan != c->end(); ++chan, ++n) { for (n = 0, chan = c->begin(); chan != c->end(); ++chan, ++n) {
(*chan)->buf->reset (); (*chan)->buf->reset ();
} }
@ -1409,8 +1399,10 @@ DiskReader::refill_midi ()
return 0; return 0;
} }
uint32_t frames_read = g_atomic_int_get (&_frames_read_from_ringbuffer); if (_playlists[DataType::MIDI]) {
uint32_t frames_written = g_atomic_int_get (&_frames_written_to_ringbuffer);
const uint32_t frames_read = g_atomic_int_get (&_frames_read_from_ringbuffer);
const uint32_t frames_written = g_atomic_int_get (&_frames_written_to_ringbuffer);
if ((frames_read < frames_written) && (frames_written - frames_read) >= midi_readahead) { if ((frames_read < frames_written) && (frames_written - frames_read) >= midi_readahead) {
return 0; return 0;
@ -1424,6 +1416,7 @@ DiskReader::refill_midi ()
if (midi_read (file_frame, to_read, reversed)) { if (midi_read (file_frame, to_read, reversed)) {
ret = -1; ret = -1;
} }
}
return ret; return ret;
} }

View file

@ -25,6 +25,7 @@
#include "ardour/audio_buffer.h" #include "ardour/audio_buffer.h"
#include "ardour/audioplaylist.h" #include "ardour/audioplaylist.h"
#include "ardour/audioregion.h" #include "ardour/audioregion.h"
#include "ardour/butler.h"
#include "ardour/debug.h" #include "ardour/debug.h"
#include "ardour/disk_writer.h" #include "ardour/disk_writer.h"
#include "ardour/midi_playlist.h" #include "ardour/midi_playlist.h"
@ -497,12 +498,6 @@ DiskWriter::run (BufferSet& bufs, framepos_t start_frame, framepos_t end_frame,
nominally_recording = (can_record && re); nominally_recording = (can_record && re);
Glib::Threads::Mutex::Lock sm (state_lock, Glib::Threads::TRY_LOCK);
if (!sm.locked()) {
return;
}
// Safeguard against situations where process() goes haywire when autopunching // Safeguard against situations where process() goes haywire when autopunching
// and last_recordable_frame < first_recordable_frame // and last_recordable_frame < first_recordable_frame
@ -883,8 +878,6 @@ DiskWriter::seek (framepos_t frame, bool complete_refill)
ChannelList::iterator chan; ChannelList::iterator chan;
boost::shared_ptr<ChannelList> c = channels.reader(); boost::shared_ptr<ChannelList> c = channels.reader();
Glib::Threads::Mutex::Lock lm (state_lock);
for (n = 0, chan = c->begin(); chan != c->end(); ++chan, ++n) { for (n = 0, chan = c->begin(); chan != c->end(); ++chan, ++n) {
(*chan)->buf->reset (); (*chan)->buf->reset ();
} }
@ -1697,3 +1690,13 @@ DiskWriter::use_destructive_playlist ()
/* the source list will never be reset for a destructive track */ /* the source list will never be reset for a destructive track */
} }
void
DiskWriter::adjust_buffering ()
{
boost::shared_ptr<ChannelList> c = channels.reader();
for (ChannelList::iterator chan = c->begin(); chan != c->end(); ++chan) {
(*chan)->resize (_session.butler()->audio_diskstream_capture_buffer_size());
}
}

View file

@ -42,7 +42,6 @@
#include "ardour/disk_writer.h" #include "ardour/disk_writer.h"
#include "ardour/event_type_map.h" #include "ardour/event_type_map.h"
#include "ardour/meter.h" #include "ardour/meter.h"
#include "ardour/midi_diskstream.h"
#include "ardour/midi_playlist.h" #include "ardour/midi_playlist.h"
#include "ardour/midi_port.h" #include "ardour/midi_port.h"
#include "ardour/midi_region.h" #include "ardour/midi_region.h"
@ -102,17 +101,6 @@ MidiTrack::init ()
return 0; return 0;
} }
boost::shared_ptr<Diskstream>
MidiTrack::create_diskstream ()
{
MidiDiskstream::Flag dflags = MidiDiskstream::Flag (MidiDiskstream::Recordable);
assert(_mode != Destructive);
return boost::shared_ptr<Diskstream> (new MidiDiskstream (_session, name(), dflags));
}
bool bool
MidiTrack::can_be_record_safe () MidiTrack::can_be_record_safe ()
{ {
@ -348,7 +336,7 @@ MidiTrack::roll (pframes_t nframes, framepos_t start_frame, framepos_t end_frame
if (!_active) { if (!_active) {
silence (nframes); silence (nframes);
if (_meter_point == MeterInput && ((_monitoring_control->monitoring_choice() & MonitorInput) || _diskstream->record_enabled())) { if (_meter_point == MeterInput && ((_monitoring_control->monitoring_choice() & MonitorInput) || _disk_writer->record_enabled())) {
_meter->reset(); _meter->reset();
} }
return 0; return 0;
@ -364,7 +352,7 @@ MidiTrack::roll (pframes_t nframes, framepos_t start_frame, framepos_t end_frame
/* filter captured data before meter sees it */ /* filter captured data before meter sees it */
_capture_filter.filter (bufs); _capture_filter.filter (bufs);
if (_meter_point == MeterInput && ((_monitoring_control->monitoring_choice() & MonitorInput) || _diskstream->record_enabled())) { if (_meter_point == MeterInput && ((_monitoring_control->monitoring_choice() & MonitorInput) || _disk_writer->record_enabled())) {
_meter->run (bufs, start_frame, end_frame, 1.0 /*speed()*/, nframes, true); _meter->run (bufs, start_frame, end_frame, 1.0 /*speed()*/, nframes, true);
} }
@ -769,12 +757,6 @@ MidiTrack::midi_playlist ()
return boost::dynamic_pointer_cast<MidiPlaylist> (_playlists[DataType::MIDI]); return boost::dynamic_pointer_cast<MidiPlaylist> (_playlists[DataType::MIDI]);
} }
void
MidiTrack::diskstream_data_recorded (boost::weak_ptr<MidiSource> src)
{
DataRecorded (src); /* EMIT SIGNAL */
}
bool bool
MidiTrack::input_active () const MidiTrack::input_active () const
{ {
@ -816,12 +798,6 @@ MidiTrack::track_input_active (IOChange change, void* /* src */)
} }
} }
boost::shared_ptr<Diskstream>
MidiTrack::diskstream_factory (XMLNode const & node)
{
return boost::shared_ptr<Diskstream> (new MidiDiskstream (_session, node));
}
boost::shared_ptr<MidiBuffer> boost::shared_ptr<MidiBuffer>
MidiTrack::get_gui_feed_buffer () const MidiTrack::get_gui_feed_buffer () const
{ {

View file

@ -1610,15 +1610,6 @@ Session::set_state (const XMLNode& node, int version)
} }
} }
if (version < 3000) {
if ((child = find_named_node (node, X_("DiskStreams"))) == 0) {
error << _("Session: XML state has no diskstreams section") << endmsg;
goto out;
} else if (load_diskstreams_2X (*child, version)) {
goto out;
}
}
if ((child = find_named_node (node, VCAManager::xml_node_name)) != 0) { if ((child = find_named_node (node, VCAManager::xml_node_name)) != 0) {
_vca_manager->set_state (*child, version); _vca_manager->set_state (*child, version);
} }
@ -1634,9 +1625,6 @@ Session::set_state (const XMLNode& node, int version)
Slavable::Assign (_vca_manager); /* EMIT SIGNAL */ Slavable::Assign (_vca_manager); /* EMIT SIGNAL */
/* our diskstreams list is no longer needed as they are now all owned by their Route */
_diskstreams_2X.clear ();
if (version >= 3000) { if (version >= 3000) {
if ((child = find_named_node (node, "RouteGroups")) == 0) { if ((child = find_named_node (node, "RouteGroups")) == 0) {
@ -1757,14 +1745,18 @@ Session::XMLRouteFactory (const XMLNode& node, int version)
return ret; return ret;
} }
XMLNode* ds_child = find_named_node (node, X_("Diskstream")); XMLNode* pl_child = find_named_node (node, X_("audio-playlist"));
if (!pl_child) {
pl_child = find_named_node (node, X_("midi-playlist"));
}
DataType type = DataType::AUDIO; DataType type = DataType::AUDIO;
node.get_property("default-type", type); node.get_property("default-type", type);
assert (type != DataType::NIL); assert (type != DataType::NIL);
if (ds_child) { if (pl_child) {
boost::shared_ptr<Track> track; boost::shared_ptr<Track> track;
@ -1819,15 +1811,10 @@ Session::XMLRouteFactory_2X (const XMLNode& node, int version)
if (ds_prop) { if (ds_prop) {
list<boost::shared_ptr<Diskstream> >::iterator i = _diskstreams_2X.begin (); // XXX DISK .... how to load 2.x diskstreams ?
while (i != _diskstreams_2X.end() && (*i)->id() != ds_prop->value()) {
++i;
}
if (i == _diskstreams_2X.end()) {
error << _("Could not find diskstream for route") << endmsg; error << _("Could not find diskstream for route") << endmsg;
return boost::shared_ptr<Route> (); return boost::shared_ptr<Route> ();
}
boost::shared_ptr<Track> track; boost::shared_ptr<Track> track;
@ -4180,35 +4167,6 @@ Session::set_history_depth (uint32_t d)
_history.set_depth (d); _history.set_depth (d);
} }
int
Session::load_diskstreams_2X (XMLNode const & node, int)
{
XMLNodeList clist;
XMLNodeConstIterator citer;
clist = node.children();
for (citer = clist.begin(); citer != clist.end(); ++citer) {
try {
/* diskstreams added automatically by DiskstreamCreated handler */
if ((*citer)->name() == "AudioDiskstream" || (*citer)->name() == "DiskStream") {
boost::shared_ptr<AudioDiskstream> dsp (new AudioDiskstream (*this, **citer));
_diskstreams_2X.push_back (dsp);
} else {
error << _("Session: unknown diskstream type in XML") << endmsg;
}
}
catch (failed_constructor& err) {
error << _("Session: could not load diskstream via XML state") << endmsg;
return -1;
}
}
return 0;
}
/** Connect things to the MMC object */ /** Connect things to the MMC object */
void void
Session::setup_midi_machine_control () Session::setup_midi_machine_control ()

View file

@ -54,25 +54,6 @@ Track::Track (Session& sess, string name, PresentationInfo::Flag flag, TrackMode
{ {
_freeze_record.state = NoFreeze; _freeze_record.state = NoFreeze;
_declickable = true; _declickable = true;
DiskIOProcessor::Flag dflags = DiskIOProcessor::Recordable;
if (_mode == Destructive && !Profile->get_trx()) {
dflags = DiskIOProcessor::Flag (dflags | DiskIOProcessor::Destructive);
} else if (_mode == NonLayered){
dflags = DiskIOProcessor::Flag(dflags | DiskIOProcessor::NonLayered);
}
_disk_reader.reset (new DiskReader (sess, name, dflags));
_disk_reader->set_block_size (_session.get_block_size ());
_disk_reader->set_route (shared_from_this());
_disk_reader->do_refill_with_alloc ();
_disk_writer.reset (new DiskWriter (sess, name, dflags));
_disk_writer->set_block_size (_session.get_block_size ());
_disk_writer->set_route (shared_from_this());
} }
Track::~Track () Track::~Track ()
@ -87,6 +68,29 @@ Track::init ()
return -1; return -1;
} }
DiskIOProcessor::Flag dflags = DiskIOProcessor::Recordable;
if (_mode == Destructive && !Profile->get_trx()) {
dflags = DiskIOProcessor::Flag (dflags | DiskIOProcessor::Destructive);
} else if (_mode == NonLayered){
dflags = DiskIOProcessor::Flag(dflags | DiskIOProcessor::NonLayered);
}
_disk_reader.reset (new DiskReader (_session, name(), dflags));
_disk_reader->set_block_size (_session.get_block_size ());
_disk_reader->set_route (shared_from_this());
_disk_reader->do_refill_with_alloc ();
_disk_writer.reset (new DiskWriter (_session, name(), dflags));
_disk_writer->set_block_size (_session.get_block_size ());
_disk_writer->set_route (shared_from_this());
use_new_playlist ();
add_processor (_disk_writer, PreFader);
add_processor (_disk_reader, PreFader);
boost::shared_ptr<Route> rp (boost::dynamic_pointer_cast<Route> (shared_from_this())); boost::shared_ptr<Route> rp (boost::dynamic_pointer_cast<Route> (shared_from_this()));
boost::shared_ptr<Track> rt = boost::dynamic_pointer_cast<Track> (rp); boost::shared_ptr<Track> rt = boost::dynamic_pointer_cast<Track> (rp);
@ -119,12 +123,19 @@ Track::state (bool full)
{ {
XMLNode& root (Route::state (full)); XMLNode& root (Route::state (full));
if (_playlists[DataType::AUDIO]) {
root.add_property (X_("audio-playlist"), _playlists[DataType::AUDIO]->id().to_s());
}
if (_playlists[DataType::MIDI]) {
root.add_property (X_("midi-playlist"), _playlists[DataType::MIDI]->id().to_s());
}
root.add_child_nocopy (_monitoring_control->get_state ()); root.add_child_nocopy (_monitoring_control->get_state ());
root.add_child_nocopy (_record_safe_control->get_state ()); root.add_child_nocopy (_record_safe_control->get_state ());
root.add_child_nocopy (_record_enable_control->get_state ()); root.add_child_nocopy (_record_enable_control->get_state ());
root.set_property (X_("saved-meter-point"), _saved_meter_point); root.set_property (X_("saved-meter-point"), _saved_meter_point);
root.add_child_nocopy (_diskstream->get_state ());
return root; return root;
} }
@ -137,6 +148,7 @@ Track::set_state (const XMLNode& node, int version)
} }
XMLNode* child; XMLNode* child;
XMLProperty const * prop;
if (version >= 3000 && version < 4000) { if (version >= 3000 && version < 4000) {
if ((child = find_named_node (node, X_("Diskstream"))) != 0) { if ((child = find_named_node (node, X_("Diskstream"))) != 0) {
@ -144,9 +156,13 @@ Track::set_state (const XMLNode& node, int version)
} }
} }
/* set rec-enable control *AFTER* setting up diskstream, because it may if ((prop = node.property (X_("audio-playlist")))) {
want to operate on the diskstream as it sets its own state find_and_use_playlist (DataType::AUDIO, PBD::ID (prop->value()));
*/ }
if ((prop = node.property (X_("midi-playlist")))) {
find_and_use_playlist (DataType::MIDI, PBD::ID (prop->value()));
}
XMLNodeList nlist = node.children(); XMLNodeList nlist = node.children();
for (XMLNodeConstIterator niter = nlist.begin(); niter != nlist.end(); ++niter) { for (XMLNodeConstIterator niter = nlist.begin(); niter != nlist.end(); ++niter) {
@ -168,15 +184,6 @@ Track::set_state (const XMLNode& node, int version)
} }
} }
/* convert old 3001 state */
MonitorChoice monitoring;
if (node.get_property (X_("monitoring"), monitoring)) {
XMLNode mon_node ("backwardscompat");
mon_node.set_property (X_("monitoring"), monitoring);
mon_node.set_property (X_("value"), (int) monitoring);
_monitoring_control->set_state (mon_node, version);
}
if (!node.get_property (X_("saved-meter-point"), _saved_meter_point)) { if (!node.get_property (X_("saved-meter-point"), _saved_meter_point)) {
_saved_meter_point = _meter_point; _saved_meter_point = _meter_point;
} }
@ -227,16 +234,16 @@ Track::prep_record_enabled (bool yn)
} }
/* keep track of the meter point as it was before we rec-enabled */ /* keep track of the meter point as it was before we rec-enabled */
if (!_diskstream->record_enabled()) { if (!_disk_writer->record_enabled()) {
_saved_meter_point = _meter_point; _saved_meter_point = _meter_point;
} }
bool will_follow; bool will_follow;
if (yn) { if (yn) {
will_follow = _diskstream->prep_record_enable (); will_follow = _disk_writer->prep_record_enable ();
} else { } else {
will_follow = _diskstream->prep_record_disable (); will_follow = _disk_writer->prep_record_disable ();
} }
if (will_follow) { if (will_follow) {
@ -255,25 +262,25 @@ Track::prep_record_enabled (bool yn)
void void
Track::record_enable_changed (bool, Controllable::GroupControlDisposition) Track::record_enable_changed (bool, Controllable::GroupControlDisposition)
{ {
_diskstream->set_record_enabled (_record_enable_control->get_value()); _disk_writer->set_record_enabled (_record_enable_control->get_value());
} }
void void
Track::record_safe_changed (bool, Controllable::GroupControlDisposition) Track::record_safe_changed (bool, Controllable::GroupControlDisposition)
{ {
_diskstream->set_record_safe (_record_safe_control->get_value()); _disk_writer->set_record_safe (_record_safe_control->get_value());
} }
bool bool
Track::can_be_record_safe () Track::can_be_record_safe ()
{ {
return !_record_enable_control->get_value() && _diskstream && _session.writable() && (_freeze_record.state != Frozen); return !_record_enable_control->get_value() && _disk_writer && _session.writable() && (_freeze_record.state != Frozen);
} }
bool bool
Track::can_be_record_enabled () Track::can_be_record_enabled ()
{ {
return !_record_safe_control->get_value() && _diskstream && !_diskstream->record_safe() && _session.writable() && (_freeze_record.state != Frozen); return !_record_safe_control->get_value() && _disk_writer && !_disk_writer->record_safe() && _session.writable() && (_freeze_record.state != Frozen);
} }
void void
@ -333,10 +340,10 @@ Track::set_name (const string& str)
} }
_diskstream_name = diskstream_name; _diskstream_name = diskstream_name;
_diskstream->set_write_source_name (diskstream_name); _disk_writer->set_write_source_name (diskstream_name);
boost::shared_ptr<Track> me = boost::dynamic_pointer_cast<Track> (shared_from_this ()); boost::shared_ptr<Track> me = boost::dynamic_pointer_cast<Track> (shared_from_this ());
if (_diskstream->playlist()->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 /* Only rename the diskstream (and therefore the playlist) if
a) the playlist has never had a region added to it and a) the playlist has never had a region added to it and
b) there is only one playlist for this track. b) there is only one playlist for this track.
@ -348,7 +355,8 @@ Track::set_name (const string& str)
If (b) is not followed, we rename the current playlist and not If (b) is not followed, we rename the current playlist and not
the other ones, which is a bit confusing (see mantis #4977). the other ones, which is a bit confusing (see mantis #4977).
*/ */
_diskstream->set_name (str); _disk_reader->set_name (str);
_disk_writer->set_name (str);
} }
/* save state so that the statefile fully reflects any filename changes */ /* save state so that the statefile fully reflects any filename changes */
@ -364,7 +372,7 @@ void
Track::set_latency_compensation (framecnt_t longest_session_latency) Track::set_latency_compensation (framecnt_t longest_session_latency)
{ {
Route::set_latency_compensation (longest_session_latency); Route::set_latency_compensation (longest_session_latency);
_diskstream->set_roll_delay (_roll_delay); _disk_reader->set_roll_delay (_roll_delay);
} }
int int
@ -389,7 +397,7 @@ Track::no_roll (pframes_t nframes, framepos_t start_frame, framepos_t end_frame,
if (!_active) { if (!_active) {
silence (nframes); silence (nframes);
if (_meter_point == MeterInput && ((_monitoring_control->monitoring_choice() & MonitorInput) || _diskstream->record_enabled())) { if (_meter_point == MeterInput && ((_monitoring_control->monitoring_choice() & MonitorInput) || _disk_writer->record_enabled())) {
_meter->reset(); _meter->reset();
} }
return 0; return 0;
@ -397,8 +405,9 @@ Track::no_roll (pframes_t nframes, framepos_t start_frame, framepos_t end_frame,
if (session_state_changing) { if (session_state_changing) {
if (_session.transport_speed() != 0.0f) { if (_session.transport_speed() != 0.0f) {
/* we're rolling but some state is changing (e.g. our diskstream contents) /* we're rolling but some state is changing (e.g. our
so we cannot use them. Be silent till this is over. Don't declick. disk reader contents) so we cannot use them. Be
silent till this is over. Don't declick.
XXX note the absurdity of ::no_roll() being called when we ARE rolling! XXX note the absurdity of ::no_roll() being called when we ARE rolling!
*/ */
@ -537,7 +546,8 @@ Track::silent_roll (pframes_t nframes, framepos_t /*start_frame*/, framepos_t /*
boost::shared_ptr<Playlist> boost::shared_ptr<Playlist>
Track::playlist () Track::playlist ()
{ {
return _diskstream->playlist (); cerr << name() << " lookup " << data_type().to_string() << " pl's\n";
return _playlists[data_type()];
} }
void void
@ -729,7 +739,7 @@ Track::set_slaved (bool s)
ChanCount ChanCount
Track::n_channels () Track::n_channels ()
{ {
return _diskstream->n_channels (); return _disk_reader->output_streams(); // XXX DISK
} }
framepos_t framepos_t
@ -769,16 +779,16 @@ Track::playlist_modified ()
} }
int int
Track::find_and_use_playlist (DataType dt, const string& name) Track::find_and_use_playlist (DataType dt, PBD::ID const & id)
{ {
boost::shared_ptr<Playlist> playlist; boost::shared_ptr<Playlist> playlist;
if ((playlist = _session.playlists->by_name (name)) == 0) { if ((playlist = _session.playlists->by_id (id)) == 0) {
playlist = PlaylistFactory::create (dt, _session, name); return -1;
} }
if (!playlist) { if (!playlist) {
error << string_compose(_("DiskIOProcessor: \"%1\" isn't an playlist"), name) << endmsg; error << string_compose(_("DiskIOProcessor: \"%1\" isn't an playlist"), id.to_s()) << endmsg;
return -1; return -1;
} }
@ -847,41 +857,36 @@ Track::use_new_playlist ()
void void
Track::set_align_style (AlignStyle s, bool force) Track::set_align_style (AlignStyle s, bool force)
{ {
_diskstream->set_align_style (s, force); // XXX DISK
} }
void void
Track::set_align_choice (AlignChoice s, bool force) Track::set_align_choice (AlignChoice s, bool force)
{ {
_diskstream->set_align_choice (s, force); // XXX DISK
}
bool
Track::using_diskstream_id (PBD::ID id) const
{
return (id == _diskstream->id ());
} }
void void
Track::set_block_size (pframes_t n) Track::set_block_size (pframes_t n)
{ {
Route::set_block_size (n); Route::set_block_size (n);
_diskstream->set_block_size (n); _disk_reader->set_block_size (n);
_disk_writer->set_block_size (n);
} }
void void
Track::adjust_playback_buffering () Track::adjust_playback_buffering ()
{ {
if (_diskstream) { if (_disk_reader) {
_diskstream->adjust_playback_buffering (); _disk_reader->adjust_buffering ();
} }
} }
void void
Track::adjust_capture_buffering () Track::adjust_capture_buffering ()
{ {
if (_diskstream) { if (_disk_writer) {
_diskstream->adjust_capture_buffering (); _disk_writer->adjust_buffering ();
} }
} }