Move Diskstream ownership to Track, so that Session no longer holds lists of Diskstre...
authorCarl Hetherington <carl@carlh.net>
Wed, 21 Apr 2010 20:42:22 +0000 (20:42 +0000)
committerCarl Hetherington <carl@carlh.net>
Wed, 21 Apr 2010 20:42:22 +0000 (20:42 +0000)
git-svn-id: svn://localhost/ardour2/branches/3.0@6945 d708f5d6-7413-0410-9779-e7cbd77b26cf

65 files changed:
gtk2_ardour/ardour_ui.cc
gtk2_ardour/audio_region_view.cc
gtk2_ardour/audio_streamview.cc
gtk2_ardour/audio_streamview.h
gtk2_ardour/audio_time_axis.cc
gtk2_ardour/audio_time_axis.h
gtk2_ardour/automation_streamview.cc
gtk2_ardour/automation_streamview.h
gtk2_ardour/editor.cc
gtk2_ardour/editor.h
gtk2_ardour/editor_audio_import.cc
gtk2_ardour/editor_canvas.cc
gtk2_ardour/editor_canvas_events.cc
gtk2_ardour/editor_drag.cc
gtk2_ardour/editor_export_audio.cc
gtk2_ardour/editor_mouse.cc
gtk2_ardour/editor_ops.cc
gtk2_ardour/editor_routes.cc
gtk2_ardour/editor_selection.cc
gtk2_ardour/editor_timefx.cc
gtk2_ardour/midi_region_view.cc
gtk2_ardour/midi_streamview.cc
gtk2_ardour/midi_streamview.h
gtk2_ardour/midi_time_axis.cc
gtk2_ardour/mixer_strip.cc
gtk2_ardour/mixer_ui.cc
gtk2_ardour/mixer_ui.h
gtk2_ardour/playlist_selector.cc
gtk2_ardour/playlist_selector.h
gtk2_ardour/processor_box.cc
gtk2_ardour/route_time_axis.cc
gtk2_ardour/route_time_axis.h
gtk2_ardour/route_ui.cc
gtk2_ardour/route_ui.h
gtk2_ardour/streamview.cc
gtk2_ardour/streamview.h
gtk2_ardour/tape_region_view.cc
gtk2_ardour/time_fx_dialog.cc
libs/ardour/ardour/audio_diskstream.h
libs/ardour/ardour/audio_track.h
libs/ardour/ardour/diskstream.h
libs/ardour/ardour/midi_diskstream.h
libs/ardour/ardour/midi_track.h
libs/ardour/ardour/playlist.h
libs/ardour/ardour/public_diskstream.h [new file with mode: 0755]
libs/ardour/ardour/route.h
libs/ardour/ardour/session.h
libs/ardour/ardour/session_event.h
libs/ardour/ardour/track.h
libs/ardour/audio_diskstream.cc
libs/ardour/audio_track.cc
libs/ardour/audio_track_importer.cc
libs/ardour/butler.cc
libs/ardour/diskstream.cc
libs/ardour/enums.cc
libs/ardour/midi_diskstream.cc
libs/ardour/midi_track.cc
libs/ardour/playlist.cc
libs/ardour/session.cc
libs/ardour/session_butler.cc
libs/ardour/session_export.cc
libs/ardour/session_process.cc
libs/ardour/session_state.cc
libs/ardour/session_transport.cc
libs/ardour/track.cc

index 0944686f4efc10290014846aa953e86276eeac38..2613faa11e30cb1a22bada93e526ebc17d3133f8 100644 (file)
@@ -934,7 +934,7 @@ void
 ARDOUR_UI::count_recenabled_streams (Route& route)
 {
        Track* track = dynamic_cast<Track*>(&route);
-       if (track && track->diskstream()->record_enabled()) {
+       if (track && track->record_enabled()) {
                rec_enabled_streams += track->n_inputs().n_total();
        }
 }
@@ -1701,7 +1701,7 @@ ARDOUR_UI::toggle_record_enable (uint32_t dstream)
                Track* t;
 
                if ((t = dynamic_cast<Track*>(r.get())) != 0) {
-                       t->diskstream()->set_record_enabled (!t->diskstream()->record_enabled());
+                       t->set_record_enabled (!t->record_enabled());
                }
        }
        if (_session == 0) {
@@ -2102,7 +2102,7 @@ ARDOUR_UI::transport_rec_enable_blink (bool onoff)
        }
 
        Session::RecordState const r = _session->record_status ();
-       bool const h = _session->have_rec_enabled_diskstream ();
+       bool const h = _session->have_rec_enabled_track ();
 
        if (r == Session::Enabled || (r == Session::Recording && !h)) {
                if (onoff) {
@@ -3399,7 +3399,7 @@ ARDOUR_UI::record_state_changed ()
        }
 
        Session::RecordState const r = _session->record_status ();
-       bool const h = _session->have_rec_enabled_diskstream ();
+       bool const h = _session->have_rec_enabled_track ();
 
        if (r == Session::Recording && h)  {
                big_clock.set_widget_name ("BigClockRecording");
index 13e21b9a63dbe155dd597dc84ff62aac6b5aa710..394751b88ce23ba4018fdc244c4eb94d1bcf352f 100644 (file)
@@ -27,7 +27,6 @@
 #include "ardour/playlist.h"
 #include "ardour/audioregion.h"
 #include "ardour/audiosource.h"
-#include "ardour/audio_diskstream.h"
 #include "ardour/profile.h"
 #include "ardour/session.h"
 
@@ -847,11 +846,11 @@ AudioRegionView::create_waves ()
        // cerr << "AudioRegionView::create_waves() called on " << this << endl;//DEBUG
        RouteTimeAxisView& atv (*(dynamic_cast<RouteTimeAxisView*>(&trackview))); // ick
 
-       if (!atv.get_diskstream()) {
+       if (!atv.track()) {
                return;
        }
 
-       ChanCount nchans = atv.get_diskstream()->n_channels();
+       ChanCount nchans = atv.track()->n_channels();
 
        // cerr << "creating waves for " << _region->name() << " with wfd = " << wait_for_data
        //              << " and channels = " << nchans.n_audio() << endl;
@@ -894,7 +893,7 @@ AudioRegionView::create_one_wave (uint32_t which, bool /*direct*/)
 {
        //cerr << "AudioRegionView::create_one_wave() called which: " << which << " this: " << this << endl;//DEBUG
        RouteTimeAxisView& atv (*(dynamic_cast<RouteTimeAxisView*>(&trackview))); // ick
-       uint32_t nchans = atv.get_diskstream()->n_channels().n_audio();
+       uint32_t nchans = atv.track()->n_channels().n_audio();
        uint32_t n;
        uint32_t nwaves = std::min (nchans, audio_region()->n_channels());
        gdouble ht;
@@ -1163,7 +1162,7 @@ AudioRegionView::add_ghost (TimeAxisView& tv)
        AudioGhostRegion* ghost = new AudioGhostRegion (tv, trackview, unit_position);
        uint32_t nchans;
 
-       nchans = rtv->get_diskstream()->n_channels().n_audio();
+       nchans = rtv->track()->n_channels().n_audio();
 
        for (uint32_t n = 0; n < nchans; ++n) {
 
index 80498f5a7e0f2b7b514d64067088d12349295bef..7c76cd787655d57832952a79a1dc86dbb5058dc5 100644 (file)
@@ -29,7 +29,6 @@
 #include "ardour/audioplaylist.h"
 #include "ardour/audioregion.h"
 #include "ardour/audiofilesource.h"
-#include "ardour/audio_diskstream.h"
 #include "ardour/audio_track.h"
 #include "ardour/source.h"
 #include "ardour/region_factory.h"
@@ -230,9 +229,9 @@ AudioStreamView::remove_region_view (boost::weak_ptr<Region> weak_r)
 }
 
 void
-AudioStreamView::undisplay_diskstream ()
+AudioStreamView::undisplay_track ()
 {
-       StreamView::undisplay_diskstream();
+       StreamView::undisplay_track ();
 
        for (CrossfadeViewList::iterator i = crossfade_views.begin(); i != crossfade_views.end(); ++i) {
                delete i->second;
@@ -242,15 +241,15 @@ AudioStreamView::undisplay_diskstream ()
 }
 
 void
-AudioStreamView::playlist_layered (boost::weak_ptr<Diskstream> wds)
+AudioStreamView::playlist_layered (boost::weak_ptr<Track> wtr)
 {
-       boost::shared_ptr<Diskstream> ds (wds.lock());
+       boost::shared_ptr<Track> tr (wtr.lock());
 
-       if (!ds) {
+       if (!tr) {
                return;
        }
 
-       StreamView::playlist_layered (wds);
+       StreamView::playlist_layered (wtr);
 
        /* make sure xfades are on top and all the regionviews are stacked correctly. */
 
@@ -260,19 +259,19 @@ AudioStreamView::playlist_layered (boost::weak_ptr<Diskstream> wds)
 }
 
 void
-AudioStreamView::playlist_switched (boost::weak_ptr<Diskstream> wds)
+AudioStreamView::playlist_switched (boost::weak_ptr<Track> wtr)
 {
-       boost::shared_ptr<Diskstream> ds (wds.lock());
+       boost::shared_ptr<Track> tr (wtr.lock());
 
-       if (!ds) {
+       if (!tr) {
                return;
        }
 
        playlist_connections.drop_connections ();
 
-       StreamView::playlist_switched (ds);
+       StreamView::playlist_switched (tr);
 
-       boost::shared_ptr<AudioPlaylist> apl = boost::dynamic_pointer_cast<AudioPlaylist>(ds->playlist());
+       boost::shared_ptr<AudioPlaylist> apl = boost::dynamic_pointer_cast<AudioPlaylist> (tr->playlist());
 
        if (apl) {
                apl->NewCrossfade.connect (playlist_connections, invalidator (*this), ui_bind (&AudioStreamView::add_crossfade, this, _1), gui_context());
@@ -350,7 +349,7 @@ AudioStreamView::remove_crossfade (boost::shared_ptr<Region> r)
 }
 
 void
-AudioStreamView::redisplay_diskstream ()
+AudioStreamView::redisplay_track ()
 {
        list<RegionView *>::iterator i;
        CrossfadeViewList::iterator xi, tmpx;
@@ -372,12 +371,12 @@ AudioStreamView::redisplay_diskstream ()
        // Add and display region and crossfade views, and flag them as valid
 
        if (_trackview.is_audio_track()) {
-               _trackview.get_diskstream()->playlist()->foreach_region(
+               _trackview.track()->playlist()->foreach_region(
                        sigc::hide_return (sigc::mem_fun (*this, &StreamView::add_region_view))
                        );
 
                boost::shared_ptr<AudioPlaylist> apl = boost::dynamic_pointer_cast<AudioPlaylist>(
-                               _trackview.get_diskstream()->playlist()
+                               _trackview.track()->playlist()
                        );
 
                if (apl) {
@@ -445,7 +444,7 @@ AudioStreamView::setup_rec_box ()
 
                if (!rec_active &&
                    _trackview.session()->record_status() == Session::Recording &&
-                   _trackview.get_diskstream()->record_enabled()) {
+                   _trackview.track()->record_enabled()) {
                        if (_trackview.audio_track()->mode() == Normal && Config->get_show_waveforms_while_recording() && rec_regions.size() == rec_rects.size()) {
 
                                /* add a new region, but don't bother if they set show-waveforms-while-recording mid-record */
@@ -453,10 +452,10 @@ AudioStreamView::setup_rec_box ()
                                SourceList sources;
 
                                rec_data_ready_connections.drop_connections ();
-                               boost::shared_ptr<AudioDiskstream> ads = _trackview.audio_track()->audio_diskstream();
+                               boost::shared_ptr<AudioTrack> tr = _trackview.audio_track();
 
-                               for (uint32_t n=0; n < ads->n_channels().n_audio(); ++n) {
-                                       boost::shared_ptr<AudioFileSource> src = ads->write_source (n);
+                               for (uint32_t n = 0; n < tr->n_channels().n_audio(); ++n) {
+                                       boost::shared_ptr<AudioFileSource> src = tr->write_source (n);
                                        if (src) {
                                                sources.push_back (src);
                                                src->PeakRangeReady.connect (rec_data_ready_connections,
@@ -471,7 +470,7 @@ AudioStreamView::setup_rec_box ()
                                nframes_t start = 0;
                                if (rec_regions.size() > 0) {
                                        start = rec_regions.back().first->start()
-                                                       + _trackview.get_diskstream()->get_captured_frames(rec_regions.size()-1);
+                                                       + _trackview.track()->get_captured_frames(rec_regions.size()-1);
                                }
 
                                PropertyList plist; 
@@ -495,8 +494,7 @@ AudioStreamView::setup_rec_box ()
                        boost::shared_ptr<AudioTrack> at;
 
                        at = _trackview.audio_track(); /* we know what it is already */
-                       boost::shared_ptr<AudioDiskstream> ds = at->audio_diskstream();
-                       nframes_t frame_pos = ds->current_capture_start ();
+                       nframes_t frame_pos = at->current_capture_start ();
                        gdouble xstart = _trackview.editor().frame_to_pixel (frame_pos);
                        gdouble xend;
                        uint32_t fill_color;
@@ -543,7 +541,7 @@ AudioStreamView::setup_rec_box ()
 
                } else if (rec_active &&
                           (_trackview.session()->record_status() != Session::Recording ||
-                           !_trackview.get_diskstream()->record_enabled())) {
+                           !_trackview.track()->record_enabled())) {
                        screen_update_connection.disconnect();
                        rec_active = false;
                        rec_updating = false;
@@ -617,7 +615,7 @@ AudioStreamView::rec_peak_range_ready (nframes_t start, nframes_t cnt, boost::we
 
        rec_data_ready_map[src] = true;
 
-       if (rec_data_ready_map.size() == _trackview.get_diskstream()->n_channels().n_audio()) {
+       if (rec_data_ready_map.size() == _trackview.track()->n_channels().n_audio()) {
                this->update_rec_regions ();
                rec_data_ready_map.clear();
        }
@@ -658,7 +656,7 @@ AudioStreamView::update_rec_regions ()
                                        if (nlen != region->length()) {
 
                                                region->suspend_property_changes ();
-                                               region->set_position (_trackview.get_diskstream()->get_capture_start_frame(n), this);
+                                               region->set_position (_trackview.track()->get_capture_start_frame(n), this);
                                                region->set_length (nlen, this);
                                                region->resume_property_changes ();
 
@@ -676,14 +674,14 @@ AudioStreamView::update_rec_regions ()
 
                        } else {
 
-                               nframes_t nlen = _trackview.get_diskstream()->get_captured_frames(n);
+                               nframes_t nlen = _trackview.track()->get_captured_frames(n);
 
                                if (nlen != region->length()) {
 
                                        if (region->source_length(0) >= region->start() + nlen) {
 
                                                region->suspend_property_changes ();
-                                               region->set_position (_trackview.get_diskstream()->get_capture_start_frame(n), this);
+                                               region->set_position (_trackview.track()->get_capture_start_frame(n), this);
                                                region->set_length (nlen, this);
                                                region->resume_property_changes ();
 
index 1443bd5b8ffd0410cffb545f8b29736975422c9d..93c74c5bb2bc086ec6aede0d98ab7c709bb7439f 100644 (file)
@@ -36,7 +36,6 @@ namespace Gdk {
 
 namespace ARDOUR {
        class Route;
-       class Diskstream;
        class Crossfade;
        class PeakData;
        class AudioRegion;
@@ -85,10 +84,10 @@ class AudioStreamView : public StreamView
        void remove_region_view (boost::weak_ptr<ARDOUR::Region> );
        void remove_audio_region_view (boost::shared_ptr<ARDOUR::AudioRegion> );
 
-       void undisplay_diskstream ();
-       void redisplay_diskstream ();
-       void playlist_layered (boost::weak_ptr<ARDOUR::Diskstream>);
-       void playlist_switched (boost::weak_ptr<ARDOUR::Diskstream>);
+       void undisplay_track ();
+       void redisplay_track ();
+       void playlist_layered (boost::weak_ptr<ARDOUR::Track>);
+       void playlist_switched (boost::weak_ptr<ARDOUR::Track>);
 
        void add_crossfade (boost::weak_ptr<ARDOUR::Crossfade>);
        void remove_crossfade (boost::shared_ptr<ARDOUR::Region>);
index 192c9ffdcb85774a09ce754577514296876b5d73..4a53b6fabd085c18f0715a07b6e1878190f0cfbd 100644 (file)
@@ -38,7 +38,6 @@
 #include <gtkmm2ext/utils.h>
 
 #include "ardour/amp.h"
-#include "ardour/audio_diskstream.h"
 #include "ardour/audioplaylist.h"
 #include "ardour/event_type_map.h"
 #include "ardour/location.h"
index 80450e9f61aa38e44342f1f1260b538c5dee33d4..513627e095f6cef36f8c148086a60e267b8465c0 100644 (file)
@@ -42,7 +42,6 @@
 
 namespace ARDOUR {
        class Session;
-       class AudioDiskstream;
        class RouteGroup;
        class IOProcessor;
        class Processor;
index 90cc96414f8fe9cec3d28b09171b0266ba5e37cb..e861522fd784d229ef0daf548bd0209eb07c9b28 100644 (file)
@@ -152,7 +152,7 @@ AutomationStreamView::set_automation_state (AutoState state)
 }
 
 void
-AutomationStreamView::redisplay_diskstream ()
+AutomationStreamView::redisplay_track ()
 {
        list<RegionView *>::iterator i, tmp;
 
@@ -164,7 +164,7 @@ AutomationStreamView::redisplay_diskstream ()
 
        // Add and display region views, and flag them as valid
        if (_trackview.is_track()) {
-               _trackview.get_diskstream()->playlist()->foreach_region (
+               _trackview.track()->playlist()->foreach_region (
                        sigc::hide_return (sigc::mem_fun (*this, &StreamView::add_region_view))
                        );
        }
index de54ea58a966c4a6d68f8389034b544ae96fd5a5..37f13774a4d4a8841ea1421977fb33307b0cf20f 100644 (file)
@@ -47,7 +47,7 @@ class AutomationStreamView : public StreamView
 
        void set_automation_state (ARDOUR::AutoState state);
 
-       void redisplay_diskstream ();
+       void redisplay_track ();
 
        inline double contents_height() const {
                return (_trackview.current_height() - TimeAxisViewItem::NAME_HIGHLIGHT_SIZE - 2);
index bb8996ba93ebb25bdaf9f039d7c25d8e072f981f..630499a9c4645b0d6f5bb15583612e4e11179550 100644 (file)
@@ -1358,7 +1358,7 @@ Editor::popup_track_context_menu (int button, int32_t time, ItemType item_type,
                break;
 
        case StreamItem:
-               if (clicked_routeview->get_diskstream()) {
+               if (clicked_routeview->track()) {
                        build_menu_function = &Editor::build_track_context_menu;
                } else {
                        build_menu_function = &Editor::build_track_bus_context_menu;
@@ -1480,11 +1480,11 @@ Editor::build_track_region_context_menu (nframes64_t frame)
        RouteTimeAxisView* rtv = dynamic_cast<RouteTimeAxisView*> (clicked_axisview);
 
        if (rtv) {
-               boost::shared_ptr<Diskstream> ds;
+               boost::shared_ptr<Track> tr;
                boost::shared_ptr<Playlist> pl;
 
-               if ((ds = rtv->get_diskstream()) && ((pl = ds->playlist()))) {
-                       Playlist::RegionList* regions = pl->regions_at ((nframes64_t) floor ( (double)frame * ds->speed()));
+               if ((tr = rtv->track()) && ((pl = tr->playlist()))) {
+                       Playlist::RegionList* regions = pl->regions_at ((nframes64_t) floor ( (double)frame * tr->speed()));
 
                        if (selection->regions.size() > 1) {
                                // there's already a multiple selection: just add a
@@ -1517,11 +1517,11 @@ Editor::build_track_crossfade_context_menu (nframes64_t frame)
        AudioTimeAxisView* atv = dynamic_cast<AudioTimeAxisView*> (clicked_axisview);
 
        if (atv) {
-               boost::shared_ptr<Diskstream> ds;
+               boost::shared_ptr<Track> tr;
                boost::shared_ptr<Playlist> pl;
                boost::shared_ptr<AudioPlaylist> apl;
 
-               if ((ds = atv->get_diskstream()) && ((pl = ds->playlist()) != 0) && ((apl = boost::dynamic_pointer_cast<AudioPlaylist> (pl)) != 0)) {
+               if ((tr = atv->track()) && ((pl = tr->playlist()) != 0) && ((apl = boost::dynamic_pointer_cast<AudioPlaylist> (pl)) != 0)) {
 
                        Playlist::RegionList* regions = pl->regions_at (frame);
                        AudioPlaylist::Crossfades xfades;
@@ -4537,13 +4537,13 @@ Editor::get_regions_at (RegionSelection& rs, nframes64_t where, const TrackViewL
        for (TrackViewList::const_iterator t = tracks->begin(); t != tracks->end(); ++t) {
                RouteTimeAxisView* rtv = dynamic_cast<RouteTimeAxisView*>(*t);
                if (rtv) {
-                       boost::shared_ptr<Diskstream> ds;
+                       boost::shared_ptr<Track> tr;
                        boost::shared_ptr<Playlist> pl;
 
-                       if ((ds = rtv->get_diskstream()) && ((pl = ds->playlist()))) {
+                       if ((tr = rtv->track()) && ((pl = tr->playlist()))) {
 
                                Playlist::RegionList* regions = pl->regions_at (
-                                               (nframes64_t) floor ( (double)where * ds->speed()));
+                                               (nframes64_t) floor ( (double)where * tr->speed()));
 
                                for (Playlist::RegionList::iterator i = regions->begin(); i != regions->end(); ++i) {
                                        RegionView* rv = rtv->view()->find_view (*i);
@@ -4572,13 +4572,13 @@ Editor::get_regions_after (RegionSelection& rs, nframes64_t where, const TrackVi
        for (TrackViewList::const_iterator t = tracks->begin(); t != tracks->end(); ++t) {
                RouteTimeAxisView* rtv = dynamic_cast<RouteTimeAxisView*>(*t);
                if (rtv) {
-                       boost::shared_ptr<Diskstream> ds;
+                       boost::shared_ptr<Track> tr;
                        boost::shared_ptr<Playlist> pl;
 
-                       if ((ds = rtv->get_diskstream()) && ((pl = ds->playlist()))) {
+                       if ((tr = rtv->track()) && ((pl = tr->playlist()))) {
 
                                Playlist::RegionList* regions = pl->regions_touched (
-                                               (nframes64_t) floor ( (double)where * ds->speed()), max_frames);
+                                               (nframes64_t) floor ( (double)where * tr->speed()), max_frames);
 
                                for (Playlist::RegionList::iterator i = regions->begin(); i != regions->end(); ++i) {
 
@@ -4650,14 +4650,14 @@ Editor::get_regions_corresponding_to (boost::shared_ptr<Region> region, vector<R
                        boost::shared_ptr<Playlist> pl;
                        vector<boost::shared_ptr<Region> > results;
                        RegionView* marv;
-                       boost::shared_ptr<Diskstream> ds;
+                       boost::shared_ptr<Track> tr;
 
-                       if ((ds = tatv->get_diskstream()) == 0) {
+                       if ((tr = tatv->track()) == 0) {
                                /* bus */
                                continue;
                        }
 
-                       if ((pl = (ds->playlist())) != 0) {
+                       if ((pl = (tr->playlist())) != 0) {
                                pl->get_region_list_equivalent_regions (region, results);
                        }
 
index ca12393b3e7561ac46096e2aee6b28f4ef075009..ebd735e335ef439f346eb794c6730fe99cf487b9 100644 (file)
@@ -76,7 +76,6 @@ namespace Gtkmm2ext {
 }
 
 namespace ARDOUR {
-       class AudioDiskstream;
        class RouteGroup;
        class Playlist;
        class AudioPlaylist;
index e7572ce8c18a6c7972b4da2285d3a7e13446b38f..119ea3bc5127f337887da759a03aa0646b8c1c15 100644 (file)
@@ -852,7 +852,7 @@ Editor::finish_bringing_in_material (boost::shared_ptr<Region> region, uint32_t
                        }
                }
 
-               boost::shared_ptr<Playlist> playlist = existing_track->diskstream()->playlist();
+               boost::shared_ptr<Playlist> playlist = existing_track->playlist();
                boost::shared_ptr<Region> copy (RegionFactory::create (region, region->properties()));
                begin_reversible_command (_("insert file"));
                 playlist->clear_history ();
@@ -887,7 +887,7 @@ Editor::finish_bringing_in_material (boost::shared_ptr<Region> region, uint32_t
                }
 
                boost::shared_ptr<Region> copy (RegionFactory::create (region));
-               existing_track->diskstream()->playlist()->add_region (copy, pos);
+               existing_track->playlist()->add_region (copy, pos);
                break;
        }
 
@@ -901,7 +901,7 @@ Editor::finish_bringing_in_material (boost::shared_ptr<Region> region, uint32_t
                if (!at.empty()) {
                        boost::shared_ptr<Region> copy (RegionFactory::create (region));
                        at.front()->set_name (basename_nosuffix (copy->name()));
-                       at.front()->diskstream()->playlist()->add_region (copy, pos);
+                       at.front()->playlist()->add_region (copy, pos);
                }
                break;
        }
index 4ea6d27ea26977b9cb33c64b381f91048ba66edb..757445114f09117e79ad4837f1b84bb749809d09 100644 (file)
@@ -480,7 +480,7 @@ Editor::drop_paths_part_two (const vector<ustring>& paths, nframes64_t frame, do
 
                /* check that its an audio track, not a bus */
 
-               if (tv->get_diskstream()) {
+               if (tv->track()) {
                        /* select the track, then embed/import */
                        selection->set (tv);
 
index 93402c7854caf82d5a11d7a4de970337b2e38a07..a670543512f37480dfab2cc401a8bc75bbe97b55 100644 (file)
@@ -24,7 +24,6 @@
 
 #include "pbd/stacktrace.h"
 
-#include "ardour/audio_diskstream.h"
 #include "ardour/audioplaylist.h"
 #include "ardour/audioregion.h"
 #include "ardour/region_factory.h"
@@ -587,7 +586,7 @@ Editor::canvas_crossfade_view_event (GdkEvent* event, ArdourCanvas::Item* item,
                if (atv->is_audio_track()) {
 
                        boost::shared_ptr<AudioPlaylist> pl;
-                       if ((pl = boost::dynamic_pointer_cast<AudioPlaylist> (atv->get_diskstream()->playlist())) != 0) {
+                       if ((pl = boost::dynamic_pointer_cast<AudioPlaylist> (atv->track()->playlist())) != 0) {
 
                                Playlist::RegionList* rl = pl->regions_at (event_frame (event));
                                if (!rl->empty()) {
index 8d6838eb7658d5bdd4603b75e22ae0a6439e69a3..d9da60e0c8705f23242adea60209722ded17b62e 100644 (file)
 #include "pbd/memento_command.h"
 #include "pbd/basename.h"
 #include "pbd/stateful_diff_command.h"
-#include "ardour/diskstream.h"
 #include "ardour/session.h"
 #include "ardour/dB.h"
 #include "ardour/region_factory.h"
-#include "ardour/midi_diskstream.h"
 #include "editor.h"
 #include "i18n.h"
 #include "keyboard.h"
@@ -826,7 +824,7 @@ void
 RegionMoveDrag::finished (GdkEvent* /*event*/, bool movement_occurred)
 {
        vector<RegionView*> copies;
-       boost::shared_ptr<Diskstream> ds;
+       boost::shared_ptr<Track> tr;
        boost::shared_ptr<Playlist> from_playlist;
        boost::shared_ptr<Playlist> to_playlist;
        RegionSelection new_views;
@@ -1016,11 +1014,11 @@ RegionMoveDrag::finished (GdkEvent* /*event*/, bool movement_occurred)
                        */
 
                        source_tv = dynamic_cast<RouteTimeAxisView*> (&rv->get_time_axis_view());
-                       ds = source_tv->get_diskstream();
-                       from_playlist = ds->playlist();
+                       tr = source_tv->track();
+                       from_playlist = tr->playlist();
 
                        assert (source_tv);
-                       assert (ds);
+                       assert (tr);
                        assert (from_playlist);
 
                        /* moved to a different audio track, without copying */
@@ -1370,7 +1368,7 @@ RegionMoveDrag::RegionMoveDrag (Editor* e, ArdourCanvas::Item* i, RegionView* p,
        double speed = 1;
        RouteTimeAxisView* rtv = dynamic_cast<RouteTimeAxisView*> (tv);
        if (rtv && rtv->is_track()) {
-               speed = rtv->get_diskstream()->speed ();
+               speed = rtv->track()->speed ();
        }
 
        _last_frame_position = static_cast<nframes64_t> (_primary->region()->position() / speed);
@@ -1697,7 +1695,7 @@ TrimDrag::start_grab (GdkEvent* event, Gdk::Cursor *)
        RouteTimeAxisView* tv = dynamic_cast<RouteTimeAxisView*>(tvp);
 
        if (tv && tv->is_track()) {
-               speed = tv->get_diskstream()->speed();
+               speed = tv->track()->speed();
        }
 
        nframes64_t region_start = (nframes64_t) (_primary->region()->position() / speed);
@@ -1754,7 +1752,7 @@ TrimDrag::motion (GdkEvent* event, bool first_move)
        pair<set<boost::shared_ptr<Playlist> >::iterator,bool> insert_result;
 
        if (tv && tv->is_track()) {
-               speed = tv->get_diskstream()->speed();
+               speed = tv->track()->speed();
        }
 
        nframes64_t const pf = adjusted_current_frame (event);
index 7d0fcc1bf9d2d04b4a3c6a76b8045710ca0fed8f..1af4fc47647c08abd39883c157dfc3c0b3621483 100644 (file)
@@ -297,9 +297,9 @@ Editor::write_audio_selection (TimeSelection& ts)
 
                if (atv->is_audio_track()) {
 
-                       boost::shared_ptr<AudioPlaylist> playlist = boost::dynamic_pointer_cast<AudioPlaylist>(atv->get_diskstream()->playlist());
+                       boost::shared_ptr<AudioPlaylist> playlist = boost::dynamic_pointer_cast<AudioPlaylist>(atv->track()->playlist());
 
-                       if (playlist && write_audio_range (*playlist, atv->get_diskstream()->n_channels(), ts) == 0) {
+                       if (playlist && write_audio_range (*playlist, atv->track()->n_channels(), ts) == 0) {
                                ret = -1;
                                break;
                        }
index a67406f93c5d48ec4cf12ff956df25849811b486..479ffd99339bec8b52602e4af55e7b40e718cb30 100644 (file)
@@ -777,7 +777,7 @@ Editor::button_press_handler_1 (ArdourCanvas::Item* item, GdkEvent* event, ItemT
                                                if (rtv && _join_object_range_state == JOIN_OBJECT_RANGE_OBJECT) {
                                                        boost::shared_ptr<Track> t = boost::dynamic_pointer_cast<Track> (rtv->route ());
                                                        if (t) {
-                                                               boost::shared_ptr<Playlist> pl = t->diskstream()->playlist ();
+                                                               boost::shared_ptr<Playlist> pl = t->playlist ();
                                                                if (pl) {
                                                                        
                                                                        boost::shared_ptr<Region> r = pl->top_region_at (event_frame (event));
@@ -1927,7 +1927,7 @@ Editor::region_view_item_click (AudioRegionView& rv, GdkEventButton* event)
                RouteTimeAxisView* rtv = dynamic_cast<RouteTimeAxisView*>(tv);
                double speed = 1.0;
                if (rtv && rtv->is_track()) {
-                       speed = rtv->get_diskstream()->speed();
+                       speed = rtv->track()->speed();
                }
 
                nframes64_t where = get_preferred_edit_position();
@@ -2131,7 +2131,7 @@ Editor::single_contents_trim (RegionView& rv, nframes64_t frame_delta, bool left
        RouteTimeAxisView* tv = dynamic_cast<RouteTimeAxisView*>(tvp);
 
        if (tv && tv->is_track()) {
-               speed = tv->get_diskstream()->speed();
+               speed = tv->track()->speed();
        }
 
        if (left_direction) {
@@ -2171,7 +2171,7 @@ Editor::single_start_trim (RegionView& rv, nframes64_t frame_delta, bool left_di
        RouteTimeAxisView* tv = dynamic_cast<RouteTimeAxisView*>(tvp);
 
        if (tv && tv->is_track()) {
-               speed = tv->get_diskstream()->speed();
+               speed = tv->track()->speed();
        }
 
        if (left_direction) {
@@ -2226,7 +2226,7 @@ Editor::single_end_trim (RegionView& rv, nframes64_t frame_delta, bool left_dire
        RouteTimeAxisView* tv = dynamic_cast<RouteTimeAxisView*>(tvp);
 
        if (tv && tv->is_track()) {
-               speed = tv->get_diskstream()->speed();
+               speed = tv->track()->speed();
        }
 
        if (left_direction) {
@@ -2442,7 +2442,7 @@ Editor::mouse_brush_insert_region (RegionView* rv, nframes64_t pos)
        }
 
        boost::shared_ptr<Playlist> playlist = rtv->playlist();
-       double speed = rtv->get_diskstream()->speed();
+       double speed = rtv->track()->speed();
 
         playlist->clear_history ();
        boost::shared_ptr<Region> new_region (RegionFactory::create (rv->region()));
index a38998ba73a4ee7bf06a8260727a067be6627b41..7f3aa7f7a84347feef185d86eb0fb86b05e562c7 100644 (file)
@@ -637,8 +637,8 @@ Editor::build_region_boundary_cache ()
                        RouteTimeAxisView *rtav;
 
                        if (ontrack != 0 && (rtav = dynamic_cast<RouteTimeAxisView*>(ontrack)) != 0 ) {
-                               if (rtav->get_diskstream() != 0) {
-                                       speed = rtav->get_diskstream()->speed();
+                               if (rtav->track() != 0) {
+                                       speed = rtav->track()->speed();
                                }
                        }
 
@@ -692,8 +692,8 @@ Editor::find_next_region (nframes64_t frame, RegionPoint point, int32_t dir, Tra
 
                track_speed = 1.0f;
                if ( (rtav = dynamic_cast<RouteTimeAxisView*>(*i)) != 0 ) {
-                       if (rtav->get_diskstream()!=0)
-                               track_speed = rtav->get_diskstream()->speed();
+                       if (rtav->track()!=0)
+                               track_speed = rtav->track()->speed();
                }
 
                track_frame = session_frame_to_track_frame(frame, track_speed);
@@ -893,8 +893,8 @@ Editor::cursor_to_region_point (EditorCursor* cursor, RegionPoint point, int32_t
        RouteTimeAxisView *rtav;
 
        if ( ontrack != 0 && (rtav = dynamic_cast<RouteTimeAxisView*>(ontrack)) != 0 ) {
-               if (rtav->get_diskstream() != 0) {
-                       speed = rtav->get_diskstream()->speed();
+               if (rtav->track() != 0) {
+                       speed = rtav->track()->speed();
                }
        }
 
@@ -1090,8 +1090,8 @@ Editor::selected_marker_to_region_point (RegionPoint point, int32_t dir)
        RouteTimeAxisView *rtav;
 
        if (ontrack != 0 && (rtav = dynamic_cast<RouteTimeAxisView*>(ontrack)) != 0) {
-               if (rtav->get_diskstream() != 0) {
-                       speed = rtav->get_diskstream()->speed();
+               if (rtav->track() != 0) {
+                       speed = rtav->track()->speed();
                }
        }
 
@@ -2782,7 +2782,7 @@ Editor::separate_regions_between (const TimeSelection& ts)
 
                                /* no edits to destructive tracks */
 
-                               if (rtv->track()->diskstream()->destructive()) {
+                               if (rtv->track()->destructive()) {
                                        continue;
                                }
 
@@ -2792,7 +2792,7 @@ Editor::separate_regions_between (const TimeSelection& ts)
 
                                        /* XXX need to consider musical time selections here at some point */
 
-                                       double speed = rtv->get_diskstream()->speed();
+                                       double speed = rtv->track()->speed();
 
 
                                        for (list<AudioRange>::const_iterator t = ts.begin(); t != ts.end(); ++t) {
@@ -2939,7 +2939,7 @@ Editor::crop_region_to (nframes64_t start, nframes64_t end)
 
                        boost::shared_ptr<Track> t = rtv->track();
 
-                       if (t != 0 && ! t->diskstream()->destructive()) {
+                       if (t != 0 && ! t->destructive()) {
 
                                if ((playlist = rtv->playlist()) != 0) {
                                        playlists.push_back (playlist);
@@ -3411,8 +3411,8 @@ Editor::trim_region_to_location (const Location& loc, const char* str)
                nframes64_t start;
                nframes64_t end;
 
-               if (tav->get_diskstream() != 0) {
-                       speed = tav->get_diskstream()->speed();
+               if (tav->track() != 0) {
+                       speed = tav->track()->speed();
                }
 
                start = session_frame_to_track_frame (loc.start(), speed);
@@ -3452,8 +3452,8 @@ Editor::trim_region_to_edit_point ()
 
                float speed = 1.0;
 
-               if (tav->get_diskstream() != 0) {
-                       speed = tav->get_diskstream()->speed();
+               if (tav->track() != 0) {
+                       speed = tav->track()->speed();
                }
 
                 rv->region()->clear_history ();
@@ -3490,8 +3490,8 @@ Editor::trim_region_from_edit_point ()
 
                float speed = 1.0;
 
-               if (tav->get_diskstream() != 0) {
-                       speed = tav->get_diskstream()->speed();
+               if (tav->track() != 0) {
+                       speed = tav->track()->speed();
                }
 
                 rv->region()->clear_history ();
@@ -3541,8 +3541,8 @@ Editor::trim_to_region(bool forward)
 
                float speed = 1.0;
 
-               if (atav->get_diskstream() != 0) {
-                       speed = atav->get_diskstream()->speed();
+               if (atav->track() != 0) {
+                       speed = atav->track()->speed();
                }
 
 
@@ -5937,9 +5937,9 @@ Editor::tab_to_transient (bool forward)
                        RouteTimeAxisView* rtv = dynamic_cast<RouteTimeAxisView*> (*t);
 
                        if (rtv) {
-                               boost::shared_ptr<Diskstream> ds = rtv->get_diskstream();
-                               if (ds) {
-                                       boost::shared_ptr<Playlist> pl = rtv->get_diskstream()->playlist ();
+                               boost::shared_ptr<Track> tr = rtv->track();
+                               if (tr) {
+                                       boost::shared_ptr<Playlist> pl = tr->playlist ();
                                        if (pl) {
                                                nframes64_t result = pl->find_next_transient (pos, forward ? 1 : -1);
 
index b9ed2a935f4742374fff40e97c1814ff0b06100b..3d5cb3522c8f44f69e75b5579499909270612d13 100644 (file)
@@ -24,7 +24,6 @@
 #include <cmath>
 #include <cassert>
 
-#include "ardour/diskstream.h"
 #include "ardour/session.h"
 
 #include "editor.h"
@@ -458,7 +457,7 @@ EditorRoutes::routes_added (list<RouteTimeAxisView*> routes)
 
                if ((*x)->is_track()) {
                        boost::shared_ptr<Track> t = boost::dynamic_pointer_cast<Track> ((*x)->route());
-                       t->diskstream()->RecordEnableChanged.connect (*this, MISSING_INVALIDATOR, boost::bind (&EditorRoutes::update_rec_display, this), gui_context());
+                       t->RecordEnableChanged.connect (*this, MISSING_INVALIDATOR, boost::bind (&EditorRoutes::update_rec_display, this), gui_context());
                }
 
                (*x)->route()->mute_changed.connect (*this, MISSING_INVALIDATOR, boost::bind (&EditorRoutes::update_mute_display, this), gui_context());
index e8feb7c08509609e6d824dacb18df218ba6b0e03..fda5155e03d1fe6ed69505ab4f2bf8c253b8383a 100644 (file)
@@ -23,7 +23,6 @@
 #include "pbd/stacktrace.h"
 
 #include "ardour/session.h"
-#include "ardour/diskstream.h"
 #include "ardour/playlist.h"
 #include "ardour/route_group.h"
 #include "ardour/profile.h"
@@ -329,9 +328,9 @@ Editor::mapped_get_equivalent_regions (RouteTimeAxisView& tv, uint32_t, RegionVi
        boost::shared_ptr<Playlist> pl;
        vector<boost::shared_ptr<Region> > results;
        RegionView* marv;
-       boost::shared_ptr<Diskstream> ds;
+       boost::shared_ptr<Track> tr;
 
-       if ((ds = tv.get_diskstream()) == 0) {
+       if ((tr = tv.track()) == 0) {
                /* bus */
                return;
        }
@@ -341,7 +340,7 @@ Editor::mapped_get_equivalent_regions (RouteTimeAxisView& tv, uint32_t, RegionVi
                return;
        }
 
-       if ((pl = ds->playlist()) != 0) {
+       if ((pl = tr->playlist()) != 0) {
                pl->get_equivalent_regions (basis->region(), results);
        }
 
@@ -401,14 +400,14 @@ Editor::get_regionview_count_from_region_list (boost::shared_ptr<Region> region)
                        boost::shared_ptr<Playlist> pl;
                        vector<boost::shared_ptr<Region> > results;
                        RegionView* marv;
-                       boost::shared_ptr<Diskstream> ds;
+                       boost::shared_ptr<Track> tr;
 
-                       if ((ds = tatv->get_diskstream()) == 0) {
+                       if ((tr = tatv->track()) == 0) {
                                /* bus */
                                continue;
                        }
 
-                       if ((pl = (ds->playlist())) != 0) {
+                       if ((pl = (tr->playlist())) != 0) {
                                pl->get_region_list_equivalent_regions (region, results);
                        }
 
index fcd7e9baf4ebf5fb5055d0d6410ad3973bcb8977..6a1f0d021ae9cc8883e101124b33430627beddce 100644 (file)
@@ -41,7 +41,6 @@
 #include "ardour/audioplaylist.h"
 #include "ardour/audio_track.h"
 #include "ardour/audioregion.h"
-#include "ardour/audio_diskstream.h"
 #include "ardour/stretch.h"
 #include "ardour/midi_stretch.h"
 #include "ardour/pitch.h"
@@ -74,7 +73,7 @@ Editor::time_stretch (RegionSelection& regions, float fraction)
                        return -1;
 
                boost::shared_ptr<Playlist> playlist
-                       = rtv->track()->diskstream()->playlist();
+                       = rtv->track()->playlist();
 
            ARDOUR::TimeFXRequest request;
                request.time_fraction = fraction;
@@ -277,7 +276,7 @@ Editor::do_timefx (TimeFXDialog& dialog)
                        continue;
                }
 
-               if ((playlist = t->diskstream()->playlist()) == 0) {
+               if ((playlist = t->playlist()) == 0) {
                        i = tmp;
                        continue;
                }
index 91538cebea7ffa65c7ea0b1ce6ed0ad3a8f75769..26490f76e73ef0e79f26188f2db1bc03f9853ee4 100644 (file)
@@ -35,7 +35,6 @@
 #include "ardour/tempo.h"
 #include "ardour/midi_region.h"
 #include "ardour/midi_source.h"
-#include "ardour/midi_diskstream.h"
 #include "ardour/midi_model.h"
 #include "ardour/midi_patch_manager.h"
 #include "ardour/session.h"
@@ -678,7 +677,7 @@ MidiRegionView::apply_delta()
 
        _model->apply_command(*trackview.session(), _delta_command);
        _delta_command = 0;
-       midi_view()->midi_track()->diskstream()->playlist_modified();
+       midi_view()->midi_track()->playlist_modified();
 
        _marked_for_selection.clear();
        _marked_for_velocity.clear();
@@ -693,7 +692,7 @@ MidiRegionView::apply_diff ()
 
        _model->apply_command(*trackview.session(), _diff_command);
        _diff_command = 0;
-       midi_view()->midi_track()->diskstream()->playlist_modified();
+       midi_view()->midi_track()->playlist_modified();
 
        _marked_for_velocity.clear();
 }
@@ -712,7 +711,7 @@ MidiRegionView::apply_delta_as_subcommand()
 
        _model->apply_command_as_subcommand(*trackview.session(), _delta_command);
        _delta_command = 0;
-       midi_view()->midi_track()->diskstream()->playlist_modified();
+       midi_view()->midi_track()->playlist_modified();
 
        _marked_for_selection.clear();
        _marked_for_velocity.clear();
@@ -732,7 +731,7 @@ MidiRegionView::apply_diff_as_subcommand()
 
        _model->apply_command_as_subcommand(*trackview.session(), _diff_command);
        _diff_command = 0;
-       midi_view()->midi_track()->diskstream()->playlist_modified();
+       midi_view()->midi_track()->playlist_modified();
 
        _marked_for_selection.clear();
        _marked_for_velocity.clear();
index 430a92503dc2ecf24cd3608a2c9139dadb049b1a..7992051ade17f8c5158fbdd3c46a2771fa25916d 100644 (file)
@@ -209,9 +209,9 @@ MidiStreamView::display_region(MidiRegionView* region_view, bool load_model)
 }
 
 void
-MidiStreamView::display_diskstream (boost::shared_ptr<Diskstream> ds)
+MidiStreamView::display_track (boost::shared_ptr<Track> tr)
 {
-       StreamView::display_diskstream(ds);
+       StreamView::display_track (tr);
        draw_note_lines();
        NoteRangeChanged();
 }
@@ -244,7 +244,7 @@ MidiStreamView::update_data_note_range(uint8_t min, uint8_t max)
 }
 
 void
-MidiStreamView::redisplay_diskstream ()
+MidiStreamView::redisplay_track ()
 {
        if (!_trackview.is_midi_track()) {
                return;
@@ -256,7 +256,7 @@ MidiStreamView::redisplay_diskstream ()
        _range_dirty = false;
        _data_note_min = 127;
        _data_note_max = 0;
-       _trackview.get_diskstream()->playlist()->foreach_region(
+       _trackview.track()->playlist()->foreach_region(
                sigc::mem_fun (*this, &StreamView::update_contents_metrics)
                );
 
@@ -279,7 +279,7 @@ MidiStreamView::redisplay_diskstream ()
        }
 
        // Add and display region views, and flag them as valid
-       _trackview.get_diskstream()->playlist()->foreach_region(
+       _trackview.track()->playlist()->foreach_region(
                sigc::hide_return (sigc::mem_fun (*this, &StreamView::add_region_view))
                );
 
@@ -385,7 +385,7 @@ MidiStreamView::setup_rec_box ()
 
                if (!rec_active &&
                    _trackview.session()->record_status() == Session::Recording &&
-                   _trackview.get_diskstream()->record_enabled()) {
+                   _trackview.track()->record_enabled()) {
 
                        if (Config->get_show_waveforms_while_recording() && rec_regions.size() == rec_rects.size()) {
 
@@ -397,12 +397,12 @@ MidiStreamView::setup_rec_box ()
 
                                boost::shared_ptr<MidiDiskstream> mds = _trackview.midi_track()->midi_diskstream();
 
-                               sources.push_back(mds->write_source());
+                               sources.push_back (_trackview.midi_track()->write_source());
 
                                mds->write_source()->ViewDataRangeReady.connect 
                                        (rec_data_ready_connections, 
                                          invalidator (*this),
-                                        ui_bind (&MidiStreamView::rec_data_range_ready, this, _1, _2, boost::weak_ptr<Source>(mds->write_source())),
+                                        ui_bind (&MidiStreamView::rec_data_range_ready, this, _1, _2, boost::weak_ptr<Source>(_trackview.midi_track()->write_source())),
                                         gui_context());
 
                                // handle multi
@@ -410,7 +410,7 @@ MidiStreamView::setup_rec_box ()
                                nframes_t start = 0;
                                if (rec_regions.size() > 0) {
                                        start = rec_regions.back().first->start()
-                                                       + _trackview.get_diskstream()->get_captured_frames(rec_regions.size()-1);
+                                                       + _trackview.track()->get_captured_frames(rec_regions.size()-1);
                                }
                                
                                PropertyList plist; 
@@ -436,8 +436,7 @@ MidiStreamView::setup_rec_box ()
                        /* start a new rec box */
 
                        boost::shared_ptr<MidiTrack> mt = _trackview.midi_track(); /* we know what it is already */
-                       boost::shared_ptr<MidiDiskstream> ds = mt->midi_diskstream();
-                       nframes_t frame_pos = ds->current_capture_start ();
+                       nframes_t frame_pos = mt->current_capture_start ();
                        gdouble xstart = _trackview.editor().frame_to_pixel (frame_pos);
                        gdouble xend;
                        uint32_t fill_color;
@@ -471,7 +470,7 @@ MidiStreamView::setup_rec_box ()
 
                } else if (rec_active &&
                           (_trackview.session()->record_status() != Session::Recording ||
-                           !_trackview.get_diskstream()->record_enabled())) {
+                           !_trackview.track()->record_enabled())) {
                        screen_update_connection.disconnect();
                        rec_active = false;
                        rec_updating = false;
@@ -558,7 +557,7 @@ MidiStreamView::update_rec_regions (boost::shared_ptr<MidiModel> data, nframes_t
                                        if (nlen != region->length()) {
 
                                                region->suspend_property_changes ();
-                                               region->set_position (_trackview.get_diskstream()->get_capture_start_frame(n), this);
+                                               region->set_position (_trackview.track()->get_capture_start_frame(n), this);
                                                region->set_length (start + dur - region->position(), this);
                                                region->resume_property_changes ();
 
@@ -615,14 +614,14 @@ MidiStreamView::update_rec_regions (boost::shared_ptr<MidiModel> data, nframes_t
 
                        } else {
 
-                               nframes_t nlen = _trackview.get_diskstream()->get_captured_frames(n);
+                               nframes_t nlen = _trackview.track()->get_captured_frames(n);
 
                                if (nlen != region->length()) {
 
                                        if (region->source_length(0) >= region->position() + nlen) {
 
                                                region->suspend_property_changes ();
-                                               region->set_position (_trackview.get_diskstream()->get_capture_start_frame(n), this);
+                                               region->set_position (_trackview.track()->get_capture_start_frame(n), this);
                                                region->set_length (nlen, this);
                                                region->resume_property_changes ();
 
index ae2b907d1eaf158891a9ea30b106cf5d6e64482c..1ab832986a3cd90c24216528915fd4edde88a9a2 100644 (file)
@@ -35,7 +35,6 @@ namespace Gdk {
 
 namespace ARDOUR {
        class Route;
-       class Diskstream;
        class Crossfade;
        class PeakData;
        class MidiRegion;
@@ -76,7 +75,7 @@ class MidiStreamView : public StreamView
 
        void update_note_range(uint8_t note_num);
 
-       void redisplay_diskstream ();
+       void redisplay_track ();
 
        inline double contents_height() const
        { return (_trackview.current_height() - TimeAxisViewItem::NAME_HIGHLIGHT_SIZE - 2); }
@@ -119,7 +118,7 @@ class MidiStreamView : public StreamView
                        bool recording = false);
 
        void display_region(MidiRegionView* region_view, bool load_model);
-       void display_diskstream (boost::shared_ptr<ARDOUR::Diskstream> ds);
+       void display_track (boost::shared_ptr<ARDOUR::Track> tr);
 
        void update_contents_height ();
        void draw_note_lines();
index 318ec627691102d2856ca24b5d8ec9e6f38fa595..83567c42d9d11b0dd3514c8698477064c1e76976 100644 (file)
@@ -738,7 +738,7 @@ MidiTimeAxisView::set_note_mode(NoteMode mode)
                _note_mode = mode;
                midi_track()->set_note_mode(mode);
                xml_node->add_property ("note-mode", enum_2_string(_note_mode));
-               _view->redisplay_diskstream();
+               _view->redisplay_track();
        }
 }
 
@@ -754,7 +754,7 @@ MidiTimeAxisView::set_color_mode(ColorMode mode)
 
                _color_mode = mode;
                xml_node->add_property ("color-mode", enum_2_string(_color_mode));
-               _view->redisplay_diskstream();
+               _view->redisplay_track();
        }
 }
 
@@ -975,10 +975,7 @@ MidiTimeAxisView::add_region (nframes64_t pos)
        const Tempo& t = _session->tempo_map().tempo_at(start);
        double length = floor (m.frames_per_bar(t, _session->frame_rate()));
 
-       const boost::shared_ptr<MidiDiskstream> diskstream =
-               boost::dynamic_pointer_cast<MidiDiskstream>(view()->trackview().track()->diskstream());
-
-       boost::shared_ptr<Source> src = _session->create_midi_source_for_session (*diskstream.get());
+       boost::shared_ptr<Source> src = _session->create_midi_source_for_session (view()->trackview().track()->name());
 
        PropertyList plist; 
        
index 5e7064ee8da2511a56544ad49fba3a01301395bc..cb030287cab247e6c399cf9afece491ec698d51a 100644 (file)
 #include "ardour/route.h"
 #include "ardour/route_group.h"
 #include "ardour/audio_track.h"
-#include "ardour/audio_diskstream.h"
 #include "ardour/panner.h"
 #include "ardour/send.h"
 #include "ardour/processor.h"
 #include "ardour/profile.h"
 #include "ardour/ladspa_plugin.h"
 #include "ardour/user_bundle.h"
+#include "ardour/port.h"
 
 #include "ardour_ui.h"
 #include "ardour_dialog.h"
index c1dc4aff9f00e3fad1fc7ed68a50bdbbc6596461..2bb2548164cb107679ec1a9180241e1e71452e58 100644 (file)
@@ -33,7 +33,6 @@
 #include <gtkmm2ext/tearoff.h>
 #include <gtkmm2ext/window_title.h>
 
-#include "ardour/audio_diskstream.h"
 #include "ardour/audio_track.h"
 #include "ardour/plugin_manager.h"
 #include "ardour/route_group.h"
index ba72ba2cba7b31cab15ab81c5b94b2349bf26baf..935e85559e7d2240320295a969ac09ba6847881a 100644 (file)
@@ -44,7 +44,6 @@
 namespace ARDOUR {
        class Route;
        class RouteGroup;
-       class AudioDiskstream;
 };
 
 class MixerStrip;
index aa678e80a3f765cfa6b7a986f0864da3bee51638..c8a9255c62a256ad48446eebada848e7f7a5f049 100644 (file)
@@ -79,10 +79,10 @@ PlaylistSelector::~PlaylistSelector ()
 void
 PlaylistSelector::clear_map ()
 {
-       for (DSPL_Map::iterator x = dspl_map.begin(); x != dspl_map.end(); ++x) {
+       for (TrackPlaylistMap::iterator x = trpl_map.begin(); x != trpl_map.end(); ++x) {
                delete x->second;
        }
-       dspl_map.clear ();
+       trpl_map.clear ();
 }
 
 bool
@@ -99,7 +99,6 @@ void
 PlaylistSelector::show_for (RouteUI* ruix)
 {
        vector<const char*> item;
-       boost::shared_ptr<Diskstream> this_ds;
        string str;
 
        rui = ruix;
@@ -113,7 +112,7 @@ PlaylistSelector::show_for (RouteUI* ruix)
 
        _session->playlists->foreach (this, &PlaylistSelector::add_playlist_to_map);
 
-       this_ds = rui->get_diskstream();
+       boost::shared_ptr<Track> this_track = rui->track();
 
        TreeModel::Row others = *(model->append ());
 
@@ -121,29 +120,29 @@ PlaylistSelector::show_for (RouteUI* ruix)
        boost::shared_ptr<Playlist> proxy = others[columns.playlist];
        proxy.reset ();
 
-       for (DSPL_Map::iterator x = dspl_map.begin(); x != dspl_map.end(); ++x) {
+       for (TrackPlaylistMap::iterator x = trpl_map.begin(); x != trpl_map.end(); ++x) {
 
-               boost::shared_ptr<Diskstream> ds = _session->diskstream_by_id (x->first);
+               boost::shared_ptr<Track> tr = boost::dynamic_pointer_cast<Track> (_session->route_by_id (x->first));
 
-               if (ds == 0) {
+               if (tr == 0) {
                        continue;
                }
 
-               /* add a node for the diskstream */
+               /* add a node for the track */
 
                string nodename;
 
-               if (ds->name().empty()) {
+               if (tr->name().empty()) {
                        nodename = _("unassigned");
                } else {
-                       nodename = ds->name().c_str();
+                       nodename = tr->name().c_str();
                }
 
                TreeModel::Row row;
                TreeModel::Row* selected_row = 0;
                TreePath this_path;
 
-               if (ds == this_ds) {
+               if (tr == this_track) {
                        row = *(model->prepend());
                        row[columns.text] = nodename;
                        boost::shared_ptr<Playlist> proxy = row[columns.playlist];
@@ -157,7 +156,7 @@ PlaylistSelector::show_for (RouteUI* ruix)
 
                /* Now insert all the playlists for this diskstream/track in a subtree */
 
-               list<boost::shared_ptr<Playlist> > *pls = x->second;
+               list<boost::shared_ptr<Playlist> >pls = x->second;
 
                for (list<boost::shared_ptr<Playlist> >::iterator p = pls->begin(); p != pls->end(); ++p) {
 
@@ -167,7 +166,7 @@ PlaylistSelector::show_for (RouteUI* ruix)
                        child_row[columns.text] = (*p)->name();
                        child_row[columns.playlist] = *p;
 
-                       if (*p == this_ds->playlist()) {
+                       if (*p == this_track->playlist()) {
                                selected_row = &child_row;
                        }
                }
@@ -197,7 +196,7 @@ PlaylistSelector::show_for (RouteUI* ruix)
                child_row[columns.text] = (*p)->name();
                child_row[columns.playlist] = *p;
 
-               if (*p == this_ds->playlist()) {
+               if (*p == this_track->playlist()) {
                        selected_row = &child_row;
                }
 
@@ -223,13 +222,10 @@ PlaylistSelector::add_playlist_to_map (boost::shared_ptr<Playlist> pl)
                return;
        }
 
-       DSPL_Map::iterator x;
+       TrackPlaylistMap::iterator x;
 
-       if ((x = dspl_map.find (apl->get_orig_diskstream_id())) == dspl_map.end()) {
-
-               pair<PBD::ID,list<boost::shared_ptr<Playlist> >*> newp (apl->get_orig_diskstream_id(), new list<boost::shared_ptr<Playlist> >);
-
-               x = dspl_map.insert (dspl_map.end(), newp);
+       if ((x = trpl_map.find (apl->get_orig_diskstream_id())) == trpl_map.end()) {
+               x = trpl_map.insert (trpl_map.end(), make_pair (apl->get_orig_diskstream_id(), new list<boost::shared_ptr<Playlist> >));
        }
 
        x->second->push_back (pl);
@@ -269,7 +265,7 @@ PlaylistSelector::selection_changed ()
                        return;
                }
 
-               at->diskstream()->use_playlist (apl);
+               at->use_playlist (apl);
 
                hide ();
        }
index d0b36fae48c228ade07b334744805dcfab2ca39b..c792179776156e640e9d4ddadac49d823e3f92ec 100644 (file)
@@ -51,10 +51,10 @@ class PlaylistSelector : public ArdourDialog
        bool on_unmap_event (GdkEventAny*);
 
   private:
-       typedef std::map<PBD::ID,std::list<boost::shared_ptr<ARDOUR::Playlist> >*> DSPL_Map;
+       typedef std::map<PBD::ID,std::list<boost::shared_ptr<ARDOUR::Playlist> >*> TrackPlaylistMap;
 
        Gtk::ScrolledWindow scroller;
-       DSPL_Map dspl_map;
+       TrackPlaylistMap trpl_map;
        RouteUI* rui;
 
        sigc::connection select_connection;
index 42711b49362a6f0af6302670a65b881b40082298..4b34bd0f683d678d9e1bd285763ed49d9349e6ad 100644 (file)
@@ -42,7 +42,6 @@
 
 #include "ardour/amp.h"
 #include "ardour/ardour.h"
-#include "ardour/audio_diskstream.h"
 #include "ardour/audio_track.h"
 #include "ardour/audioengine.h"
 #include "ardour/internal_send.h"
index cee28fc5c1018d179d786f55a68cc6d092898fba..91748707f4a0245e21627b2087b757e797cd4152 100644 (file)
@@ -242,8 +242,7 @@ RouteTimeAxisView::RouteTimeAxisView (PublicEditor& ed, Session* sess, boost::sh
 
                track()->TrackModeChanged.connect (*this, invalidator (*this), boost::bind (&RouteTimeAxisView::track_mode_changed, this), gui_context());
                track()->FreezeChange.connect (*this, invalidator (*this), boost::bind (&RouteTimeAxisView::map_frozen, this), gui_context());
-               track()->DiskstreamChanged.connect (*this, invalidator (*this), boost::bind (&RouteTimeAxisView::diskstream_changed, this), gui_context());
-               get_diskstream()->SpeedChanged.connect (*this, invalidator (*this), boost::bind (&RouteTimeAxisView::speed_changed, this), gui_context());
+               track()->SpeedChanged.connect (*this, invalidator (*this), boost::bind (&RouteTimeAxisView::speed_changed, this), gui_context());
 
                /* pick up the correct freeze state */
                map_frozen ();
@@ -509,19 +508,21 @@ RouteTimeAxisView::build_display_menu ()
                alignment_items.push_back (RadioMenuElem (align_group, _("Align With Existing Material"),
                                        sigc::bind (sigc::mem_fun(*this, &RouteTimeAxisView::set_align_style), ExistingMaterial)));
                align_existing_item = dynamic_cast<RadioMenuItem*>(&alignment_items.back());
-               if (get_diskstream()->alignment_style() == ExistingMaterial)
+               if (track()->alignment_style() == ExistingMaterial) {
                        align_existing_item->set_active();
+               }
 
                alignment_items.push_back (RadioMenuElem (align_group, _("Align With Capture Time"),
                                        sigc::bind (sigc::mem_fun(*this, &RouteTimeAxisView::set_align_style), CaptureTime)));
                align_capture_item = dynamic_cast<RadioMenuItem*>(&alignment_items.back());
-               if (get_diskstream()->alignment_style() == CaptureTime)
+               if (track()->alignment_style() == CaptureTime) {
                        align_capture_item->set_active();
+               }
 
                if (!Profile->get_sae()) {
 
                        items.push_back (MenuElem (_("Alignment"), *alignment_menu));
-                       get_diskstream()->AlignmentStyleChanged.connect (route_connections, invalidator (*this), boost::bind (&RouteTimeAxisView::align_style_changed, this), gui_context());
+                       track()->AlignmentStyleChanged.connect (route_connections, invalidator (*this), boost::bind (&RouteTimeAxisView::align_style_changed, this), gui_context());
 
                        RadioMenuItem::Group mode_group;
                        items.push_back (RadioMenuElem (mode_group, _("Normal Mode"), sigc::bind (
@@ -556,7 +557,7 @@ RouteTimeAxisView::build_display_menu ()
                        _ignore_track_mode_change = false;
                }
 
-               get_diskstream()->AlignmentStyleChanged.connect (route_connections, invalidator (*this), boost::bind (&RouteTimeAxisView::align_style_changed, this), gui_context());
+               track()->AlignmentStyleChanged.connect (route_connections, invalidator (*this), boost::bind (&RouteTimeAxisView::align_style_changed, this), gui_context());
 
                color_mode_menu = build_color_mode_menu();
                if (color_mode_menu) {
@@ -900,8 +901,8 @@ RouteTimeAxisView::set_samples_per_unit (double spu)
 {
        double speed = 1.0;
 
-       if (get_diskstream() != 0) {
-               speed = get_diskstream()->speed();
+       if (track()) {
+               speed = track()->speed();
        }
 
        if (_view) {
@@ -914,7 +915,7 @@ RouteTimeAxisView::set_samples_per_unit (double spu)
 void
 RouteTimeAxisView::align_style_changed ()
 {
-       switch (get_diskstream()->alignment_style()) {
+       switch (track()->alignment_style()) {
        case ExistingMaterial:
                if (!align_existing_item->get_active()) {
                        align_existing_item->set_active();
@@ -947,7 +948,7 @@ RouteTimeAxisView::set_align_style (AlignStyle style)
        }
 
        if (item->get_active()) {
-               get_diskstream()->set_align_style (style);
+               track()->set_align_style (style);
        }
 }
 
@@ -957,13 +958,15 @@ RouteTimeAxisView::rename_current_playlist ()
        ArdourPrompter prompter (true);
        string name;
 
-       boost::shared_ptr<Diskstream> ds = get_diskstream();
-       if (!ds || ds->destructive())
+       boost::shared_ptr<Track> tr = track();
+       if (!tr || tr->destructive()) {
                return;
+       }
 
-       boost::shared_ptr<Playlist> pl = ds->playlist();
-       if (!pl)
+       boost::shared_ptr<Playlist> pl = tr->playlist();
+       if (!pl) {
                return;
+       }
 
        prompter.set_prompt (_("Name for playlist"));
        prompter.set_initial_text (pl->name());
@@ -1023,13 +1026,15 @@ RouteTimeAxisView::use_copy_playlist (bool prompt, vector<boost::shared_ptr<Play
 {
        string name;
 
-       boost::shared_ptr<Diskstream> ds = get_diskstream();
-       if (!ds || ds->destructive())
+       boost::shared_ptr<Track> tr = track ();
+       if (!tr || tr->destructive()) {
                return;
+       }
 
-       boost::shared_ptr<const Playlist> pl = ds->playlist();
-       if (!pl)
+       boost::shared_ptr<const Playlist> pl = tr->playlist();
+       if (!pl) {
                return;
+       }
 
        name = pl->name();
 
@@ -1065,8 +1070,8 @@ RouteTimeAxisView::use_copy_playlist (bool prompt, vector<boost::shared_ptr<Play
        }
 
        if (name.length()) {
-               ds->use_copy_playlist ();
-               ds->playlist()->set_name (name);
+               tr->use_copy_playlist ();
+               tr->playlist()->set_name (name);
        }
 }
 
@@ -1075,13 +1080,15 @@ RouteTimeAxisView::use_new_playlist (bool prompt, vector<boost::shared_ptr<Playl
 {
        string name;
 
-       boost::shared_ptr<Diskstream> ds = get_diskstream();
-       if (!ds || ds->destructive())
+       boost::shared_ptr<Track> tr = track ();
+       if (!tr || tr->destructive()) {
                return;
+       }
 
-       boost::shared_ptr<const Playlist> pl = ds->playlist();
-       if (!pl)
+       boost::shared_ptr<const Playlist> pl = tr->playlist();
+       if (!pl) {
                return;
+       }
 
        name = pl->name();
 
@@ -1114,21 +1121,23 @@ RouteTimeAxisView::use_new_playlist (bool prompt, vector<boost::shared_ptr<Playl
        }
 
        if (name.length()) {
-               ds->use_new_playlist ();
-               ds->playlist()->set_name (name);
+               tr->use_new_playlist ();
+               tr->playlist()->set_name (name);
        }
 }
 
 void
 RouteTimeAxisView::clear_playlist ()
 {
-       boost::shared_ptr<Diskstream> ds = get_diskstream();
-       if (!ds || ds->destructive())
+       boost::shared_ptr<Track> tr = track ();
+       if (!tr || tr->destructive()) {
                return;
+       }
 
-       boost::shared_ptr<Playlist> pl = ds->playlist();
-       if (!pl)
+       boost::shared_ptr<Playlist> pl = tr->playlist();
+       if (!pl) {
                return;
+       }
 
        _editor.clear_playlist (pl);
 }
@@ -1139,17 +1148,12 @@ RouteTimeAxisView::speed_changed ()
        Gtkmm2ext::UI::instance()->call_slot (invalidator (*this), boost::bind (&RouteTimeAxisView::reset_samples_per_unit, this));
 }
 
-void
-RouteTimeAxisView::diskstream_changed ()
-{
-       Gtkmm2ext::UI::instance()->call_slot (invalidator (*this), boost::bind (&RouteTimeAxisView::update_diskstream_display, this));
-}
-
 void
 RouteTimeAxisView::update_diskstream_display ()
 {
-       if (!get_diskstream()) // bus
+       if (!track()) {
                return;
+       }
 
        map_frozen ();
 }
@@ -1212,8 +1216,8 @@ RouteTimeAxisView::get_selectables (nframes_t start, nframes_t end, double top,
 {
        double speed = 1.0;
 
-       if (get_diskstream() != 0) {
-               speed = get_diskstream()->speed();
+       if (track() != 0) {
+               speed = track()->speed();
        }
 
        nframes_t start_adjusted = session_frame_to_track_frame(start, speed);
@@ -1291,10 +1295,10 @@ RouteTimeAxisView::name() const
 boost::shared_ptr<Playlist>
 RouteTimeAxisView::playlist () const
 {
-       boost::shared_ptr<Diskstream> ds;
+       boost::shared_ptr<Track> tr;
 
-       if ((ds = get_diskstream()) != 0) {
-               return ds->playlist();
+       if ((tr = track()) != 0) {
+               return tr->playlist();
        } else {
                return boost::shared_ptr<Playlist> ();
        }
@@ -1349,11 +1353,10 @@ RouteTimeAxisView::hide_click ()
 boost::shared_ptr<Region>
 RouteTimeAxisView::find_next_region (nframes_t pos, RegionPoint point, int32_t dir)
 {
-       boost::shared_ptr<Diskstream> stream;
-       boost::shared_ptr<Playlist> playlist;
+       boost::shared_ptr<Playlist> pl = playlist ();
 
-       if ((stream = get_diskstream()) != 0 && (playlist = stream->playlist()) != 0) {
-               return playlist->find_next_region (pos, point, dir);
+       if (pl) {
+               return pl->find_next_region (pos, point, dir);
        }
 
        return boost::shared_ptr<Region> ();
@@ -1362,11 +1365,10 @@ RouteTimeAxisView::find_next_region (nframes_t pos, RegionPoint point, int32_t d
 nframes64_t
 RouteTimeAxisView::find_next_region_boundary (nframes64_t pos, int32_t dir)
 {
-       boost::shared_ptr<Diskstream> stream;
-       boost::shared_ptr<Playlist> playlist;
+       boost::shared_ptr<Playlist> pl = playlist ();
 
-       if ((stream = get_diskstream()) != 0 && (playlist = stream->playlist()) != 0) {
-               return playlist->find_next_region_boundary (pos, dir);
+       if (pl) {
+               return pl->find_next_region_boundary (pos, dir);
        }
 
        return -1;
@@ -1376,19 +1378,19 @@ bool
 RouteTimeAxisView::cut_copy_clear (Selection& selection, CutCopyOp op)
 {
        boost::shared_ptr<Playlist> what_we_got;
-       boost::shared_ptr<Diskstream> ds = get_diskstream();
+       boost::shared_ptr<Track> tr = track ();
        boost::shared_ptr<Playlist> playlist;
        bool ret = false;
 
-       if (ds == 0) {
+       if (tr == 0) {
                /* route is a bus, not a track */
                return false;
        }
 
-       playlist = ds->playlist();
+       playlist = tr->playlist();
 
        TimeSelection time (selection.time);
-       float speed = ds->speed();
+       float const speed = tr->speed();
        if (speed != 1.0f) {
                for (TimeSelection::iterator i = time.begin(); i != time.end(); ++i) {
                        (*i).start = session_frame_to_track_frame((*i).start, speed);
@@ -1447,7 +1449,7 @@ RouteTimeAxisView::paste (nframes_t pos, float times, Selection& selection, size
                return false;
        }
 
-       boost::shared_ptr<Playlist> playlist = get_diskstream()->playlist();
+       boost::shared_ptr<Playlist> pl = playlist ();
        PlaylistSelection::iterator p;
 
        for (p = selection.playlists.begin(); p != selection.playlists.end() && nth; ++p, --nth) {}
@@ -1456,13 +1458,13 @@ RouteTimeAxisView::paste (nframes_t pos, float times, Selection& selection, size
                return false;
        }
 
-       if (get_diskstream()->speed() != 1.0f) {
-               pos = session_frame_to_track_frame(pos, get_diskstream()->speed() );
+       if (track()->speed() != 1.0f) {
+               pos = session_frame_to_track_frame (pos, track()->speed());
        }
 
-        playlist->clear_history ();
-       playlist->paste (*p, pos, times);
-       _session->add_command (new StatefulDiffCommand (playlist));
+        pl->clear_history ();
+       pl->paste (*p, pos, times);
+       _session->add_command (new StatefulDiffCommand (pl));
 
        return true;
 }
@@ -1504,30 +1506,30 @@ RouteTimeAxisView::build_playlist_menu (Gtk::Menu * menu)
        delete playlist_menu;
 
 
-        vector<boost::shared_ptr<Playlist> > playlists, playlists_ds;
-       boost::shared_ptr<Diskstream> ds = get_diskstream();
+        vector<boost::shared_ptr<Playlist> > playlists, playlists_tr;
+       boost::shared_ptr<Track> tr = track();
        RadioMenuItem::Group playlist_group;
 
        _session->playlists->get (playlists);
 
         /* find the playlists for this diskstream */
         for (vector<boost::shared_ptr<Playlist> >::iterator i = playlists.begin(); i != playlists.end(); ++i) {
-                if (((*i)->get_orig_diskstream_id() == ds->id()) || (ds->playlist()->id() == (*i)->id())) {
-                        playlists_ds.push_back(*i);
+                if (((*i)->get_orig_diskstream_id() == tr->diskstream_id()) || (tr->playlist()->id() == (*i)->id())) {
+                        playlists_tr.push_back(*i);
                 }
         }
 
         /* sort the playlists */
         PlaylistSorter cmp;
-        sort(playlists_ds.begin(), playlists_ds.end(), cmp);
+        sort (playlists_tr.begin(), playlists_tr.end(), cmp);
         
         /* add the playlists to the menu */
-        for (vector<boost::shared_ptr<Playlist> >::iterator i = playlists_ds.begin(); i != playlists_ds.end(); ++i) {
+        for (vector<boost::shared_ptr<Playlist> >::iterator i = playlists_tr.begin(); i != playlists_tr.end(); ++i) {
                 playlist_items.push_back (RadioMenuElem (playlist_group, (*i)->name()));
                 RadioMenuItem *item = static_cast<RadioMenuItem*>(&playlist_items.back());
                 item->signal_toggled().connect(sigc::bind (sigc::mem_fun (*this, &RouteTimeAxisView::use_playlist), item, boost::weak_ptr<Playlist> (*i)));
                 
-                if (ds->playlist()->id() == (*i)->id()) {
+                if (tr->playlist()->id() == (*i)->id()) {
                         item->set_active();
                         
                }
@@ -1574,13 +1576,12 @@ RouteTimeAxisView::use_playlist (RadioMenuItem *item, boost::weak_ptr<Playlist>
        boost::shared_ptr<AudioPlaylist> apl = boost::dynamic_pointer_cast<AudioPlaylist> (pl);
 
        if (apl) {
-               if (get_diskstream()->playlist() == apl) {
+               if (track()->playlist() == apl) {
                         // exit when use_playlist is called by the creation of the playlist menu
                         // or the playlist choice is unchanged
                        return;
                }
-               get_diskstream()->use_playlist (apl);
-
+               track()->use_playlist (apl);
 
                if (route_group() && route_group()->is_active()) {
                        std::string group_string = "."+route_group()->name()+".";
@@ -1611,10 +1612,10 @@ RouteTimeAxisView::use_playlist (RadioMenuItem *item, boost::weak_ptr<Playlist>
                                boost::shared_ptr<Playlist> ipl = session()->playlists->by_name(playlist_name);
                                if (!ipl) {
                                        // No playlist for this track for this take yet, make it
-                                       track->diskstream()->use_new_playlist();
-                                       track->diskstream()->playlist()->set_name(playlist_name);
+                                       track->use_new_playlist();
+                                       track->playlist()->set_name(playlist_name);
                                } else {
-                                       track->diskstream()->use_playlist(ipl);
+                                       track->use_playlist(ipl);
                                }
                        }
                }
index 7f35e544854223fd6d720943de5ae78da7a3d4b1..e24de4126f06f2ca09e98cfab24d5d82c074dc9e 100644 (file)
@@ -48,7 +48,6 @@
 namespace ARDOUR {
        class Session;
        class Region;
-       class Diskstream;
        class RouteGroup;
        class IOProcessor;
        class Processor;
@@ -183,7 +182,6 @@ protected:
        };
 
 
-       void diskstream_changed ();
        void update_diskstream_display ();
 
        gint edit_click  (GdkEventButton *);
index 526d99cd9424608ad76eac085f36c9eb739e5e05..ee66bf4c903c7069edc1310d297ece92b8271fe0 100644 (file)
@@ -50,9 +50,7 @@
 #include "ardour/session.h"
 #include "ardour/audioengine.h"
 #include "ardour/audio_track.h"
-#include "ardour/audio_diskstream.h"
 #include "ardour/midi_track.h"
-#include "ardour/midi_diskstream.h"
 #include "ardour/template_utils.h"
 #include "ardour/filename_extensions.h"
 #include "ardour/directory_names.h"
@@ -221,7 +219,7 @@ RouteUI::set_route (boost::shared_ptr<Route> rp)
        if (_session->writable() && is_track()) {
                boost::shared_ptr<Track> t = boost::dynamic_pointer_cast<Track>(_route);
 
-               t->diskstream()->RecordEnableChanged.connect (route_connections, invalidator (*this), boost::bind (&RouteUI::route_rec_enable_changed, this), gui_context());
+               t->RecordEnableChanged.connect (route_connections, invalidator (*this), boost::bind (&RouteUI::route_rec_enable_changed, this), gui_context());
 
                rec_enable_button->show();
                rec_enable_button->set_controllable (t->rec_enable_control());
@@ -1328,18 +1326,6 @@ RouteUI::midi_track() const
        return boost::dynamic_pointer_cast<MidiTrack>(_route);
 }
 
-boost::shared_ptr<Diskstream>
-RouteUI::get_diskstream () const
-{
-       boost::shared_ptr<Track> t;
-
-       if ((t = boost::dynamic_pointer_cast<Track>(_route)) != 0) {
-               return t->diskstream();
-       } else {
-               return boost::shared_ptr<Diskstream> ((Diskstream*) 0);
-       }
-}
-
 string
 RouteUI::name() const
 {
index a01db6dd8ecd55c20dc3dada4ebb634ce2716483..bbe18bfc4fb7865302a8e6dfdba8bf4c50a251fe 100644 (file)
@@ -69,8 +69,6 @@ class RouteUI : public virtual AxisView
        boost::shared_ptr<ARDOUR::AudioTrack> audio_track() const;
        boost::shared_ptr<ARDOUR::MidiTrack>  midi_track() const;
 
-       boost::shared_ptr<ARDOUR::Diskstream> get_diskstream() const;
-
        std::string name() const;
 
        // protected: XXX sigh this should be here
index 83dd9fc4b8277a88a6d82d1597805ff3cd8523cd..8fa9ed8d288298dbd7e6365967c80bd7a8aadec5 100644 (file)
@@ -25,7 +25,6 @@
 #include "ardour/playlist.h"
 #include "ardour/region.h"
 #include "ardour/source.h"
-#include "ardour/diskstream.h"
 #include "ardour/track.h"
 #include "ardour/session.h"
 
@@ -79,7 +78,7 @@ StreamView::StreamView (RouteTimeAxisView& tv, ArdourCanvas::Group* group)
 
        if (_trackview.is_track()) {
                _trackview.track()->DiskstreamChanged.connect (*this, invalidator (*this), boost::bind (&StreamView::diskstream_changed, this), gui_context());
-               _trackview.get_diskstream()->RecordEnableChanged.connect (*this, invalidator (*this), boost::bind (&StreamView::rec_enable_changed, this), gui_context());
+               _trackview.track()->RecordEnableChanged.connect (*this, invalidator (*this), boost::bind (&StreamView::rec_enable_changed, this), gui_context());
 
                _trackview.session()->TransportStateChange.connect (*this, invalidator (*this), boost::bind (&StreamView::transport_changed, this), gui_context());
                _trackview.session()->TransportLooped.connect (*this, invalidator (*this), boost::bind (&StreamView::transport_looped, this), gui_context());
@@ -91,7 +90,7 @@ StreamView::StreamView (RouteTimeAxisView& tv, ArdourCanvas::Group* group)
 
 StreamView::~StreamView ()
 {
-       undisplay_diskstream ();
+       undisplay_track ();
 
        delete canvas_rect;
 
@@ -104,7 +103,7 @@ void
 StreamView::attach ()
 {
        if (_trackview.is_track()) {
-               display_diskstream (_trackview.get_diskstream());
+               display_track (_trackview.track ());
        }
 }
 
@@ -204,7 +203,7 @@ StreamView::remove_region_view (boost::weak_ptr<Region> weak_r)
 }
 
 void
-StreamView::undisplay_diskstream ()
+StreamView::undisplay_track ()
 {
        for (RegionViewList::iterator i = region_views.begin(); i != region_views.end() ; ) {
                RegionViewList::iterator next = i;
@@ -217,11 +216,11 @@ StreamView::undisplay_diskstream ()
 }
 
 void
-StreamView::display_diskstream (boost::shared_ptr<Diskstream> ds)
+StreamView::display_track (boost::shared_ptr<Track> tr)
 {
        playlist_switched_connection.disconnect();
-       playlist_switched (ds);
-       ds->PlaylistChanged.connect (playlist_switched_connection, invalidator (*this), boost::bind (&StreamView::playlist_switched, this, boost::weak_ptr<Diskstream> (ds)), gui_context());
+       playlist_switched (tr);
+       tr->PlaylistChanged.connect (playlist_switched_connection, invalidator (*this), boost::bind (&StreamView::playlist_switched, this, boost::weak_ptr<Track> (tr)), gui_context());
 }
 
 void
@@ -282,17 +281,17 @@ StreamView::layer_regions()
 }
 
 void
-StreamView::playlist_layered (boost::weak_ptr<Diskstream> wds)
+StreamView::playlist_layered (boost::weak_ptr<Track> wtr)
 {
-       boost::shared_ptr<Diskstream> ds (wds.lock());
+       boost::shared_ptr<Track> tr (wtr.lock());
 
-       if (!ds) {
+       if (!tr) {
                return;
        }
 
        /* update layers count and the y positions and heights of our regions */
-       if (ds->playlist()) {
-               _layers = ds->playlist()->top_layer() + 1;
+       if (tr->playlist()) {
+               _layers = tr->playlist()->top_layer() + 1;
        }
 
        if (_layer_display == Stacked) {
@@ -305,35 +304,35 @@ StreamView::playlist_layered (boost::weak_ptr<Diskstream> wds)
 }
 
 void
-StreamView::playlist_switched (boost::weak_ptr<Diskstream> wds)
+StreamView::playlist_switched (boost::weak_ptr<Track> wtr)
 {
-       boost::shared_ptr<Diskstream> ds (wds.lock());
+       boost::shared_ptr<Track> tr (wtr.lock());
 
-       if (!ds) {
+       if (!tr) {
                return;
        }
 
        /* disconnect from old playlist */
 
        playlist_connections.drop_connections ();
-       undisplay_diskstream ();
+       undisplay_track ();
 
        /* update layers count and the y positions and heights of our regions */
-       _layers = ds->playlist()->top_layer() + 1;
+       _layers = tr->playlist()->top_layer() + 1;
        update_contents_height ();
        update_coverage_frames ();
 
-       ds->playlist()->set_explicit_relayering (_layer_display == Stacked);
+       tr->playlist()->set_explicit_relayering (_layer_display == Stacked);
 
        /* draw it */
 
-       redisplay_diskstream ();
+       redisplay_track ();
 
        /* catch changes */
 
-       ds->playlist()->LayeringChanged.connect (playlist_connections, invalidator (*this), boost::bind (&StreamView::playlist_layered, this, boost::weak_ptr<Diskstream>(ds)), gui_context());
-       ds->playlist()->RegionAdded.connect (playlist_connections, invalidator (*this), ui_bind (&StreamView::add_region_view, this, _1), gui_context());
-       ds->playlist()->RegionRemoved.connect (playlist_connections, invalidator (*this), ui_bind (&StreamView::remove_region_view, this, _1), gui_context());
+       tr->playlist()->LayeringChanged.connect (playlist_connections, invalidator (*this), boost::bind (&StreamView::playlist_layered, this, boost::weak_ptr<Track> (tr)), gui_context());
+       tr->playlist()->RegionAdded.connect (playlist_connections, invalidator (*this), ui_bind (&StreamView::add_region_view, this, _1), gui_context());
+       tr->playlist()->RegionRemoved.connect (playlist_connections, invalidator (*this), ui_bind (&StreamView::remove_region_view, this, _1), gui_context());
        // ds->playlist()->ContentsChanged.connect (playlist_connections, invalidator (*this), boost::bind (&StreamView::redisplay_diskstream, this), gui_context());
 }
 
@@ -343,15 +342,14 @@ StreamView::diskstream_changed ()
        boost::shared_ptr<Track> t;
         
        if ((t = _trackview.track()) != 0) {
-               Gtkmm2ext::UI::instance()->call_slot (invalidator (*this), boost::bind (&StreamView::display_diskstream, this, t->diskstream()));
+               Gtkmm2ext::UI::instance()->call_slot (invalidator (*this), boost::bind (&StreamView::display_track, this, t));
        } else {
-               Gtkmm2ext::UI::instance()->call_slot (invalidator (*this), boost::bind (&StreamView::undisplay_diskstream, this));
+               Gtkmm2ext::UI::instance()->call_slot (invalidator (*this), boost::bind (&StreamView::undisplay_track, this));
        }
 }
 
 void
 StreamView::apply_color (Gdk::Color& color, ColorTarget target)
-
 {
        list<RegionView *>::iterator i;
 
@@ -412,7 +410,7 @@ StreamView::update_rec_box ()
        if (rec_active && rec_rects.size() > 0) {
                /* only update the last box */
                RecBoxInfo & rect = rec_rects.back();
-               nframes_t at = _trackview.get_diskstream()->current_capture_end();
+               nframes_t at = _trackview.track()->current_capture_end();
                double xstart;
                double xend;
 
@@ -427,7 +425,7 @@ StreamView::update_rec_box ()
 
                case Destructive:
                        rect.length = 2;
-                       xstart = _trackview.editor().frame_to_pixel (_trackview.get_diskstream()->current_capture_start());
+                       xstart = _trackview.editor().frame_to_pixel (_trackview.track()->current_capture_start());
                        xend = _trackview.editor().frame_to_pixel (at);
                        break;
                }
@@ -577,7 +575,7 @@ StreamView::set_layer_display (LayerDisplay d)
        _layer_display = d;
        update_contents_height ();
        update_coverage_frames ();
-       _trackview.get_diskstream()->playlist()->set_explicit_relayering (_layer_display == Stacked);
+       _trackview.track()->playlist()->set_explicit_relayering (_layer_display == Stacked);
 }
 
 void
index 17a1c4182b17a154ed0df3acfc33a0791a543094..14b30a42fcb99f9875c7f96e521d60c5f3fdba2d 100644 (file)
@@ -35,11 +35,11 @@ namespace Gdk {
 
 namespace ARDOUR {
        class Route;
-       class Diskstream;
        class Crossfade;
        class PeakData;
        class Region;
        class Source;
+       class Track;
 }
 
 struct RecBoxInfo {
@@ -104,7 +104,7 @@ public:
        void region_layered (RegionView*);
        virtual void update_contents_height ();
 
-       virtual void redisplay_diskstream () = 0;
+       virtual void redisplay_track () = 0;
        double child_height () const;
        ARDOUR::layer_t layers () const { return _layers; }
 
@@ -129,13 +129,13 @@ protected:
                      bool wait_for_waves, bool recording = false) = 0;
        virtual void remove_region_view (boost::weak_ptr<ARDOUR::Region> );
 
-       void         display_diskstream (boost::shared_ptr<ARDOUR::Diskstream>);
-       virtual void undisplay_diskstream ();
+       void         display_track (boost::shared_ptr<ARDOUR::Track>);
+       virtual void undisplay_track ();
        void         diskstream_changed ();
        void         layer_regions ();
 
-       virtual void playlist_switched (boost::weak_ptr<ARDOUR::Diskstream>);
-       virtual void playlist_layered (boost::weak_ptr<ARDOUR::Diskstream>);
+       virtual void playlist_switched (boost::weak_ptr<ARDOUR::Track>);
+       virtual void playlist_layered (boost::weak_ptr<ARDOUR::Track>);
 
        virtual void color_handler () = 0;
 
index e4db441e74dddacb0c9c34da0b834460f6c294ad..5fef5e46eee4a6bb5957cf9b30ca54ba4c0418fd 100644 (file)
@@ -27,7 +27,6 @@
 #include "ardour/playlist.h"
 #include "ardour/audioregion.h"
 #include "ardour/audiosource.h"
-#include "ardour/audio_diskstream.h"
 
 #include "tape_region_view.h"
 #include "audio_time_axis.h"
index 04280e00111aee0ec73a1efd1556796dc704b462..d1650430b24b6a7dd39071601e44e23c070098f7 100644 (file)
@@ -41,7 +41,6 @@
 #include "ardour/audioplaylist.h"
 #include "ardour/audio_track.h"
 #include "ardour/audioregion.h"
-#include "ardour/audio_diskstream.h"
 #include "ardour/stretch.h"
 #include "ardour/midi_stretch.h"
 #include "ardour/pitch.h"
index 0a8a7a0a8eb6e1b00a848840b7b04109a798ea16..6cf064a61d18e713c4fbecac860b01621015db5c 100644 (file)
@@ -228,7 +228,7 @@ class AudioDiskstream : public Diskstream
                        ChannelInfo* channel_info, int channel, bool reversed);
 
        void finish_capture (bool rec_monitors_input, boost::shared_ptr<ChannelList>);
-       void transport_stopped (struct tm&, time_t, bool abort);
+       void transport_stopped_wallclock (struct tm&, time_t, bool abort);
        void transport_looped (nframes_t transport_frame);
 
        void init ();
index 0c4f29ee867c7d7ab99c72943e5e4a8a38ea0ec5..d74f5e53b99f5a0d9805bdd0a6419818374628f8 100644 (file)
@@ -28,6 +28,7 @@ class Session;
 class AudioDiskstream;
 class AudioPlaylist;
 class RouteGroup;
+class AudioFileSource; 
 
 class AudioTrack : public Track
 {
@@ -56,6 +57,8 @@ class AudioTrack : public Track
 
        int set_state(const XMLNode&, int version);
 
+       boost::shared_ptr<AudioFileSource> write_source (uint32_t n = 0);
+
   protected:
        XMLNode& state (bool full);
        
index da6297e0fb185e58222e8b2b780607256854a45a..97a512cf3f8b8bf38b13399c80efe85308332bf2 100644 (file)
@@ -37,6 +37,7 @@
 #include "ardour/session_object.h"
 #include "ardour/types.h"
 #include "ardour/utils.h"
+#include "ardour/public_diskstream.h"
 
 struct tm;
 
@@ -46,10 +47,10 @@ class IO;
 class Playlist;
 class Processor;
 class Region;
-class Route;
 class Session;
+class Track;   
 
-class Diskstream : public SessionObject
+class Diskstream : public SessionObject, public PublicDiskstream
 {
   public:
        enum Flag {
@@ -66,7 +67,7 @@ class Diskstream : public SessionObject
        bool set_name (const std::string& str);
 
        boost::shared_ptr<ARDOUR::IO> io() const { return _io; }
-       void set_route (ARDOUR::Route&);
+       void set_track (ARDOUR::Track *);
 
        virtual float playback_buffer_load() const = 0;
        virtual float capture_buffer_load() const = 0;
@@ -99,7 +100,6 @@ class Diskstream : public SessionObject
        virtual void punch_in()  {}
        virtual void punch_out() {}
 
-       void set_speed (double);
        void non_realtime_set_speed ();
        virtual void non_realtime_locate (nframes_t /*location*/) {};
        virtual void playlist_modified ();
@@ -143,6 +143,14 @@ class Diskstream : public SessionObject
        void move_processor_automation (boost::weak_ptr<Processor>,
                        std::list<Evoral::RangeMove<framepos_t> > const &);
 
+       /** For non-butler contexts (allocates temporary working buffers) */
+       virtual int do_refill_with_alloc() = 0;
+       virtual void set_block_size (nframes_t) = 0;
+
+       bool pending_overwrite () const {
+               return _pending_overwrite;
+       }
+
        PBD::Signal0<void>            RecordEnableChanged;
        PBD::Signal0<void>            SpeedChanged;
        PBD::Signal0<void>            ReverseChanged;
@@ -163,7 +171,6 @@ class Diskstream : public SessionObject
 
        virtual void set_pending_overwrite (bool) = 0;
        virtual int  overwrite_existing_buffers () = 0;
-       virtual void set_block_size (nframes_t) = 0;
        virtual int  internal_playback_seek (nframes_t distance) = 0;
        virtual int  can_internal_playback_seek (nframes_t distance) = 0;
        virtual int  rename_write_sources () = 0;
@@ -199,16 +206,13 @@ class Diskstream : public SessionObject
        virtual int do_flush (RunContext context, bool force = false) = 0;
        virtual int do_refill () = 0;
 
-       /** For non-butler contexts (allocates temporary working buffers) */
-       virtual int do_refill_with_alloc() = 0;
-
        /* XXX fix this redundancy ... */
 
        virtual void playlist_changed (const PBD::PropertyChange&);
        virtual void playlist_deleted (boost::weak_ptr<Playlist>);
        virtual void playlist_ranges_moved (std::list< Evoral::RangeMove<framepos_t> > const &);
 
-       virtual void transport_stopped (struct tm&, time_t, bool abort) = 0;
+       virtual void transport_stopped_wallclock (struct tm&, time_t, bool abort) = 0;
        virtual void transport_looped (nframes_t transport_frame) = 0;
 
        struct CaptureInfo {
@@ -245,7 +249,7 @@ class Diskstream : public SessionObject
        uint32_t i_am_the_modifier;
 
        boost::shared_ptr<ARDOUR::IO>  _io;
-       Route*       _route;
+       Track*       _track;
        ChanCount    _n_channels;
 
        boost::shared_ptr<Playlist> _playlist;
@@ -273,7 +277,7 @@ class Diskstream : public SessionObject
        Location*     loop_location;
        nframes_t     overwrite_frame;
        off_t         overwrite_offset;
-       bool          pending_overwrite;
+       bool          _pending_overwrite;
        bool          overwrite_queued;
        IOChange      input_change_pending;
        nframes_t     wrap_buffer_size;
index 81f2979f3f3ffcd83a1b9342d08fc43256c723f3..abbfc28feb80bc96a8244b892213964fb3cf62bf 100644 (file)
@@ -151,7 +151,7 @@ class MidiDiskstream : public Diskstream
        int read (nframes_t& start, nframes_t cnt, bool reversed);
 
        void finish_capture (bool rec_monitors_input);
-       void transport_stopped (struct tm&, time_t, bool abort);
+       void transport_stopped_wallclock (struct tm&, time_t, bool abort);
        void transport_looped (nframes_t transport_frame);
 
        void init ();
index f4f29398b2202be74475638ac885b73602b20e0e..0399492a0252ff6e5fcace4b4144690bcf6843f6 100644 (file)
@@ -31,6 +31,7 @@ class Session;
 class MidiDiskstream;
 class MidiPlaylist;
 class RouteGroup;
+class SMFSource;       
 
 class MidiTrack : public Track
 {
@@ -90,6 +91,8 @@ public:
        bool midi_thru() const { return _midi_thru; }
        void set_midi_thru (bool yn);
 
+       boost::shared_ptr<SMFSource> write_source (uint32_t n = 0);
+       
 protected:
        XMLNode& state (bool full);
        
index d9a14c01fd750c9bbe4a1e523b51bf33030a4d4a..c5b79644c65fb0f6fd2e23ce19d005cf282b3517 100644 (file)
@@ -195,6 +195,7 @@ class Playlist : public SessionObject
 
        uint32_t read_data_count() const { return _read_data_count; }
 
+       /* XXX: use of diskstream here is a little unfortunate */
        const PBD::ID& get_orig_diskstream_id () const { return _orig_diskstream_id; }
        void set_orig_diskstream_id (const PBD::ID& did) { _orig_diskstream_id = did; }
 
diff --git a/libs/ardour/ardour/public_diskstream.h b/libs/ardour/ardour/public_diskstream.h
new file mode 100755 (executable)
index 0000000..90ca030
--- /dev/null
@@ -0,0 +1,80 @@
+/*
+    Copyright (C) 2010 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.
+
+*/
+
+#ifndef __ardour_public_diskstream_h__
+#define __ardour_public_diskstream_h__
+
+namespace ARDOUR {
+
+class Playlist;
+class Region;
+class Location;
+
+/** Public interface to a Diskstream */        
+class PublicDiskstream
+{
+public:
+
+       virtual boost::shared_ptr<Playlist> playlist () = 0;
+       virtual void monitor_input (bool) = 0;
+       virtual bool destructive () const = 0;
+       virtual std::list<boost::shared_ptr<Region> > & last_capture_regions () = 0;
+       virtual void set_capture_offset () = 0;
+       virtual void reset_write_sources (bool, bool force = false) = 0;
+       virtual float playback_buffer_load () const = 0;
+       virtual float capture_buffer_load () const = 0;
+       virtual int do_refill () = 0;
+       virtual int do_flush (RunContext, bool force = false) = 0;
+       virtual uint32_t read_data_count() const = 0;
+       virtual uint32_t write_data_count() const = 0;
+       virtual void set_pending_overwrite (bool) = 0;
+       virtual int seek (nframes_t, bool complete_refill = false) = 0;
+       virtual bool hidden () const = 0;
+       virtual int can_internal_playback_seek (nframes_t) = 0;
+       virtual int internal_playback_seek (nframes_t) = 0;
+       virtual void non_realtime_input_change () = 0;
+       virtual void non_realtime_locate (nframes_t) = 0;
+       virtual void non_realtime_set_speed () = 0;
+       virtual int overwrite_existing_buffers () = 0;
+       virtual nframes_t get_captured_frames (uint32_t n = 0) = 0;
+       virtual int set_loop (Location *) = 0;
+       virtual void transport_looped (nframes_t) = 0;
+       virtual bool realtime_set_speed (double, bool) = 0;
+       virtual void transport_stopped_wallclock (struct tm &, time_t, bool) = 0;
+       virtual bool pending_overwrite () const = 0;
+       virtual double speed () const = 0;
+        virtual void prepare_to_stop (framepos_t) = 0;
+       virtual void set_slaved (bool) = 0;
+       virtual ChanCount n_channels () = 0;
+       virtual nframes_t get_capture_start_frame (uint32_t n = 0) = 0;
+       virtual AlignStyle alignment_style () const = 0;
+       virtual void set_record_enabled (bool) = 0;
+       virtual nframes_t current_capture_start () const = 0;
+       virtual nframes_t current_capture_end () const = 0;
+       virtual void playlist_modified () = 0;
+       virtual int use_playlist (boost::shared_ptr<Playlist>) = 0;
+       virtual void set_align_style (AlignStyle) = 0;
+       virtual int use_copy_playlist () = 0;
+       virtual int use_new_playlist () = 0;
+       
+};
+
+}
+
+#endif
index ae514e2f188eed03933020c6187329e0a6cd28d5..f9ba1a8e8adf82e6abc2e6b6855aeb9f449df32d 100644 (file)
@@ -338,10 +338,10 @@ class Route : public SessionObject, public AutomatableControls, public RouteGrou
 
        void catch_up_on_solo_mute_override ();
        void mod_solo_by_others (int32_t);
-       void set_block_size (nframes_t nframes);
        bool has_external_redirects() const;
        void curve_reallocate ();
        void just_meter_input (sframes_t start_frame, sframes_t end_frame, nframes_t nframes);
+       virtual void set_block_size (nframes_t nframes);
 
   protected:
        nframes_t check_initial_delay (nframes_t, nframes_t&);
index ed1dc68f434da39b14dc6f430de5ee9cb5824e15..e2f3ff1625ab1007e47baeac77d136b9ca049588 100644 (file)
@@ -77,7 +77,6 @@ namespace Evoral {
 
 namespace ARDOUR {
 
-class AudioDiskstream;
 class AudioEngine;
 class AudioFileSource;
 class AudioRegion;
@@ -96,7 +95,6 @@ class ExportStatus;
 class IO;
 class IOProcessor;
 class ImportStatus;
-class MidiDiskstream;
 class MidiRegion;
 class MidiSource;
 class MidiTrack;
@@ -121,6 +119,7 @@ class Slave;
 class Source;
 class TempoMap;
 class VSTPlugin;
+class Track;
 
 extern void setup_enum_writer ();
 
@@ -193,26 +192,18 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi
        BufferSet& get_scratch_buffers (ChanCount count = ChanCount::ZERO);
        BufferSet& get_mix_buffers (ChanCount count = ChanCount::ZERO);
 
-       void add_diskstream (boost::shared_ptr<Diskstream>);
-       boost::shared_ptr<Diskstream> diskstream_by_id (const PBD::ID& id);
-       boost::shared_ptr<Diskstream> diskstream_by_name (std::string name);
-       bool have_rec_enabled_diskstream () const;
+       bool have_rec_enabled_track () const;
 
        bool have_captured() const { return _have_captured; }
 
-       void refill_all_diskstream_buffers ();
+       void refill_all_track_buffers ();
        Butler* butler() { return _butler; }
        void butler_transport_work ();
 
-       uint32_t get_next_diskstream_id() const { return n_diskstreams(); }
-       uint32_t n_diskstreams() const;
-
        void refresh_disk_space ();
 
-       typedef std::list<boost::shared_ptr<Diskstream> > DiskstreamList;
-
-       SerializedRCUManager<DiskstreamList>& diskstream_list() { return diskstreams; }
-
+       int load_diskstreams_2X (XMLNode const &, int);
+       
        int load_routes (const XMLNode&, int);
        boost::shared_ptr<RouteList> get_routes() const {
                return routes.reader ();
@@ -307,8 +298,8 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi
        void use_rf_shuttle_speed ();
        void allow_auto_play (bool yn);
        void request_transport_speed (double speed);
-       void request_overwrite_buffer (Diskstream*);
-       void request_diskstream_speed (Diskstream&, double speed);
+       void request_overwrite_buffer (Track *);
+       void request_track_speed (Track *, double speed);
        void request_input_change_handling ();
 
        bool locate_pending() const { return static_cast<bool>(post_transport_work()&PostTransportLocate); }
@@ -542,9 +533,9 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi
        */
        static PBD::Signal0<int> AskAboutPendingState;
 
-       boost::shared_ptr<AudioFileSource> create_audio_source_for_session (ARDOUR::AudioDiskstream&, uint32_t which_channel, bool destructive);
+       boost::shared_ptr<AudioFileSource> create_audio_source_for_session (size_t, std::string const &, uint32_t, bool);
 
-       boost::shared_ptr<MidiSource> create_midi_source_for_session (ARDOUR::MidiDiskstream&);
+       boost::shared_ptr<MidiSource> create_midi_source_for_session (std::string const &);
 
        boost::shared_ptr<Source> source_by_id (const PBD::ID&);
        boost::shared_ptr<Source> source_by_path_and_channel (const Glib::ustring&, uint16_t);
@@ -932,7 +923,7 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi
 
        PBD::ScopedConnection export_freewheel_connection;
 
-       void get_diskstream_statistics ();
+       void get_track_statistics ();
        int  process_routes (nframes_t, bool& need_butler);
        int  silent_process_routes (nframes_t, bool& need_butler);
 
@@ -1174,13 +1165,13 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi
 
        void set_play_loop (bool yn);
        void unset_play_loop ();
-       void overwrite_some_buffers (Diskstream*);
+       void overwrite_some_buffers (Track *);
        void flush_all_inserts ();
        int  micro_locate (nframes_t distance);
         void locate (nframes64_t, bool with_roll, bool with_flush, bool with_loop=false, bool force=false);
         void start_locate (nframes64_t, bool with_roll, bool with_flush, bool with_loop=false, bool force=false);
        void force_locate (nframes64_t frame, bool with_roll = false);
-       void set_diskstream_speed (Diskstream*, double speed);
+       void set_track_speed (Track *, double speed);
         void set_transport_speed (double speed, bool abort = false, bool clear_state = false);
        void stop_transport (bool abort = false, bool clear_state = false);
        void start_transport ();
@@ -1203,12 +1194,6 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi
 
        std::list<RouteGroup *> _route_groups;
 
-       /* disk-streams */
-
-       SerializedRCUManager<DiskstreamList>  diskstreams;
-
-       int load_diskstreams (const XMLNode&);
-
        /* routes stuff */
 
        SerializedRCUManager<RouteList>  routes;
@@ -1217,6 +1202,7 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi
        uint32_t destructive_index;
 
        boost::shared_ptr<Route> XMLRouteFactory (const XMLNode&, int);
+       boost::shared_ptr<Route> XMLRouteFactory_2X (const XMLNode&, int);
 
        void route_processors_changed (RouteProcessorChange);
 
@@ -1265,7 +1251,7 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi
 
        void remove_playlist (boost::weak_ptr<Playlist>);
        void playlist_length_changed ();
-       void diskstream_playlist_changed (boost::weak_ptr<Diskstream>);
+       void track_playlist_changed (boost::weak_ptr<Track>);
 
        /* NAMED SELECTIONS */
 
@@ -1342,7 +1328,7 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi
        XMLNode* _bundle_xml_node;
        int load_bundles (XMLNode const &);
 
-       void reverse_diskstream_buffers ();
+       void reverse_track_buffers ();
 
        UndoHistory                  _history;
        std::stack<UndoTransaction*> _current_trans;
@@ -1436,8 +1422,8 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi
 
        mutable bool have_looped; ///< Used in ::audible_frame(*)
 
-       void update_have_rec_enabled_diskstream ();
-       gint _have_rec_enabled_diskstream;
+       void update_have_rec_enabled_track ();
+       gint _have_rec_enabled_track;
 
        static int ask_about_playlist_deletion (boost::shared_ptr<Playlist>);
 
@@ -1450,6 +1436,9 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi
        void rt_set_mute (boost::shared_ptr<RouteList>, bool yn, bool group_override);
        void rt_set_listen (boost::shared_ptr<RouteList>, bool yn, bool group_override);
        void rt_set_record_enable (boost::shared_ptr<RouteList>, bool yn, bool group_override);
+
+       /** temporary list of Diskstreams used only during load of 2.X sessions */
+       std::list<boost::shared_ptr<Diskstream> > _diskstreams_2X;
 };
 
 } // namespace ARDOUR
index 2306bb7c1a6c3628ce7192e1fbc45f1be301133d..726c5be47b6d8c775f14a26fe89274962d208eb9 100644 (file)
@@ -19,7 +19,7 @@ class Region;
 struct SessionEvent {
     enum Type {
            SetTransportSpeed,
-           SetDiskstreamSpeed,
+           SetTrackSpeed,
            Locate,
            LocateRoll,
            LocateRollLocate,
index c05d222cc21b6d308876c70986b26a1236639650..a40b82916b638d84f2742114cf36a4b854de8015 100644 (file)
 #include <boost/shared_ptr.hpp>
 
 #include "ardour/route.h"
+#include "ardour/public_diskstream.h"
 
 namespace ARDOUR {
 
 class Session;
-class Diskstream;
 class Playlist;
 class RouteGroup;
 class Region;
+class Diskstream;
 
-class Track : public Route
+class Track : public Route, public PublicDiskstream
 {
   public:
        Track (Session&, std::string name, Route::Flag f = Route::Flag (0), TrackMode m = Normal, DataType default_type = DataType::AUDIO);
@@ -60,10 +61,8 @@ class Track : public Route
 
        bool can_record();
 
-       boost::shared_ptr<Diskstream> diskstream() const { return _diskstream; }
-
         virtual void use_new_diskstream () = 0;
-        virtual void set_diskstream (boost::shared_ptr<Diskstream>) = 0;
+        virtual void set_diskstream (boost::shared_ptr<Diskstream>);
 
        nframes_t update_total_latency();
        void           set_latency_delay (nframes_t);
@@ -92,8 +91,60 @@ class Track : public Route
        bool record_enabled() const;
        void set_record_enable (bool yn, void *src);
 
+       /* XXX: unfortunate that this is exposed */
+       PBD::ID const & diskstream_id () const;
+
+       void set_block_size (nframes_t);
+
+       /* PublicDiskstream interface */
+       boost::shared_ptr<Playlist> playlist ();
+       void monitor_input (bool);
+       bool destructive () const;
+       std::list<boost::shared_ptr<Region> > & last_capture_regions ();
+       void set_capture_offset ();
+       void reset_write_sources (bool, bool force = false);
+       float playback_buffer_load () const;
+       float capture_buffer_load () const;
+       int do_refill ();
+       int do_flush (RunContext, bool force = false);
+       uint32_t read_data_count() const;
+       uint32_t write_data_count() const;
+       void set_pending_overwrite (bool);
+       int seek (nframes_t, bool complete_refill = false);
+       bool hidden () const;
+       int can_internal_playback_seek (nframes_t);
+       int internal_playback_seek (nframes_t);
+       void non_realtime_input_change ();
+       void non_realtime_locate (nframes_t);
+       void non_realtime_set_speed ();
+       int overwrite_existing_buffers ();
+       nframes_t get_captured_frames (uint32_t n = 0);
+       int set_loop (Location *);
+       void transport_looped (nframes_t);
+       bool realtime_set_speed (double, bool);
+       void transport_stopped_wallclock (struct tm &, time_t, bool);
+       bool pending_overwrite () const;
+       double speed () const;
+        void prepare_to_stop (framepos_t);
+       void set_slaved (bool);
+       ChanCount n_channels ();
+       nframes_t get_capture_start_frame (uint32_t n = 0);
+       AlignStyle alignment_style () const;
+       void set_record_enabled (bool);
+       nframes_t current_capture_start () const;
+       nframes_t current_capture_end () const;
+       void playlist_modified ();
+       int use_playlist (boost::shared_ptr<Playlist>);
+       void set_align_style (AlignStyle);
+       int use_copy_playlist ();
+       int use_new_playlist ();
+
        PBD::Signal0<void> DiskstreamChanged;
        PBD::Signal0<void> FreezeChange;
+       PBD::Signal0<void> PlaylistChanged;
+       PBD::Signal0<void> RecordEnableChanged;
+       PBD::Signal0<void> SpeedChanged;
+       PBD::Signal0<void> AlignmentStyleChanged;
 
   protected:
        virtual XMLNode& state (bool full) = 0;
@@ -144,6 +195,12 @@ class Track : public Route
        bool                  _destructive;
 
        boost::shared_ptr<RecEnableControllable> _rec_enable_control;
+
+private:
+       void diskstream_playlist_changed ();
+       void diskstream_record_enable_changed ();
+       void diskstream_speed_changed ();
+       void diskstream_alignment_style_changed ();
 };
 
 }; /* namespace ARDOUR*/
index c8cc1c9ebf2f0dbb53b08a3b7822a780bbd22fe8..91ca6a8f64d5b952224d830b8e0609474e64fee6 100644 (file)
@@ -59,6 +59,7 @@
 #include "ardour/source_factory.h"
 #include "ardour/utils.h"
 #include "ardour/session_playlists.h"
+#include "ardour/route.h"
 
 #include "i18n.h"
 #include <locale.h>
@@ -321,7 +322,7 @@ AudioDiskstream::use_copy_playlist ()
 
        newname = Playlist::bump_name (_playlist->name(), _session);
 
-       if ((playlist  = boost::dynamic_pointer_cast<AudioPlaylist>(PlaylistFactory::create (audio_playlist(), newname))) != 0) {
+       if ((playlist = boost::dynamic_pointer_cast<AudioPlaylist>(PlaylistFactory::create (audio_playlist(), newname))) != 0) {
                playlist->set_orig_diskstream_id (id());
                return use_playlist (playlist);
        } else {
@@ -729,7 +730,7 @@ AudioDiskstream::set_pending_overwrite (bool yn)
 {
        /* called from audio thread, so we can use the read ptr and playback sample as we wish */
 
-       pending_overwrite = yn;
+       _pending_overwrite = yn;
 
        overwrite_frame = playback_sample;
        overwrite_offset = channels.reader()->front()->playback_buf->get_read_ptr();
@@ -798,7 +799,7 @@ AudioDiskstream::overwrite_existing_buffers ()
        ret = 0;
 
   out:
-       pending_overwrite = false;
+       _pending_overwrite = false;
        delete [] gain_buffer;
        delete [] mixdown_buffer;
        return ret;
@@ -1334,7 +1335,7 @@ AudioDiskstream::do_flush (RunContext /*context*/, bool force_flush)
 }
 
 void
-AudioDiskstream::transport_stopped (struct tm& when, time_t twhen, bool abort_capture)
+AudioDiskstream::transport_stopped_wallclock (struct tm& when, time_t twhen, bool abort_capture)
 {
        uint32_t buffer_position;
        bool more_work = true;
@@ -1701,7 +1702,7 @@ AudioDiskstream::disengage_record_enable ()
 XMLNode&
 AudioDiskstream::get_state ()
 {
-       XMLNode* node = new XMLNode ("AudioDiskstream");
+       XMLNode* node = new XMLNode ("Diskstream");
        char buf[64] = "";
        LocaleGuard lg (X_("POSIX"));
        boost::shared_ptr<ChannelList> c = channels.reader();
@@ -1827,7 +1828,7 @@ AudioDiskstream::set_state (const XMLNode& node, int /*version*/)
                }
 
                if (!had_playlist) {
-                       _playlist->set_orig_diskstream_id (_id);
+                       _playlist->set_orig_diskstream_id (id());
                }
 
                if (!destructive() && capture_pending_node) {
@@ -1884,7 +1885,7 @@ AudioDiskstream::use_new_write_source (uint32_t n)
        }
 
        try {
-               if ((chan->write_source = _session.create_audio_source_for_session (*this, n, destructive())) == 0) {
+               if ((chan->write_source = _session.create_audio_source_for_session (n_channels().n_audio(), name(), n, destructive())) == 0) {
                        throw failed_constructor();
                }
        }
@@ -1991,7 +1992,7 @@ AudioDiskstream::allocate_temporary_buffers ()
           when slaving to MTC, Timecode etc.
        */
 
-       double sp = max (fabsf (_actual_speed), 1.2f);
+       double const sp = max (fabsf (_actual_speed), 1.2f);
        nframes_t required_wrap_size = (nframes_t) floor (_session.get_block_size() * sp) + 1;
 
        if (required_wrap_size > wrap_buffer_size) {
index f46e22143bb5516ec00cc4f3dcf0b410f9ef4d04..862f15b68cc2fd5f5b923e714187d758b77b0611 100644 (file)
@@ -81,7 +81,8 @@ AudioTrack::use_new_diskstream ()
        AudioDiskstream* dsp (new AudioDiskstream (_session, name(), dflags));
        boost::shared_ptr<AudioDiskstream> ds (dsp);
 
-       _session.add_diskstream (ds);
+       ds->do_refill_with_alloc ();
+       ds->set_block_size (_session.get_block_size ());
 
        set_diskstream (ds);
 }
@@ -89,8 +90,9 @@ AudioTrack::use_new_diskstream ()
 void
 AudioTrack::set_diskstream (boost::shared_ptr<Diskstream> ds)
 {
-       _diskstream = ds;
-        _diskstream->set_route (*this);
+       Track::set_diskstream (ds);
+
+        _diskstream->set_track (this);
        _diskstream->set_destructive (_mode == Destructive);
        _diskstream->set_non_layered (_mode == NonLayered);
 
@@ -234,6 +236,14 @@ AudioTrack::_set_state (const XMLNode& node, int version, bool call_base)
                }
        }
 
+       if (version >= 3000) {
+               if ((child = find_named_node (node, X_("Diskstream"))) != 0) {
+                       boost::shared_ptr<AudioDiskstream> ds (new AudioDiskstream (_session, *child));
+                       ds->do_refill_with_alloc ();
+                       set_diskstream (ds);
+               }
+       }
+
        pending_state = const_cast<XMLNode*> (&node);
 
        if (_session.state_of_the_state() & Session::Loading) {
@@ -246,7 +256,7 @@ AudioTrack::_set_state (const XMLNode& node, int version, bool call_base)
 }
 
 XMLNode&
-AudioTrack::state(bool full_state)
+AudioTrack::state (bool full_state)
 {
        XMLNode& root (Route::state(full_state));
        XMLNode* freeze_node;
@@ -271,25 +281,9 @@ AudioTrack::state(bool full_state)
                root.add_child_nocopy (*freeze_node);
        }
 
-       /* Alignment: act as a proxy for the diskstream */
-
-       XMLNode* align_node = new XMLNode (X_("Alignment"));
-       AlignStyle as = _diskstream->alignment_style ();
-       align_node->add_property (X_("style"), enum_2_string (as));
-       root.add_child_nocopy (*align_node);
-
        root.add_property (X_("mode"), enum_2_string (_mode));
-
-       /* we don't return diskstream state because we don't
-          own the diskstream exclusively. control of the diskstream
-          state is ceded to the Session, even if we create the
-          diskstream.
-       */
-
-       _diskstream->id().print (buf, sizeof (buf));
-       root.add_property ("diskstream-id", buf);
-
        root.add_child_nocopy (_rec_enable_control->get_state());
+       root.add_child_nocopy (_diskstream->get_state ());
 
        return root;
 }
@@ -351,30 +345,6 @@ AudioTrack::set_state_part_two ()
                        _freeze_record.processor_info.push_back (frii);
                }
        }
-
-       /* Alignment: act as a proxy for the diskstream */
-
-       if ((fnode = find_named_node (*pending_state, X_("Alignment"))) != 0) {
-
-               if ((prop = fnode->property (X_("style"))) != 0) {
-
-                       /* fix for older sessions from before EnumWriter */
-
-                       string pstr;
-
-                       if (prop->value() == "capture") {
-                               pstr = "CaptureTime";
-                       } else if (prop->value() == "existing") {
-                               pstr = "ExistingMaterial";
-                       } else {
-                               pstr = prop->value();
-                       }
-
-                       AlignStyle as = AlignStyle (string_2_enum (pstr, as));
-                       _diskstream->set_persistent_align_style (as);
-               }
-       }
-       return;
 }
 
 int
@@ -713,7 +683,7 @@ AudioTrack::freeze_me (InterThreadInfo& itt)
 
        boost::shared_ptr<Region> region (RegionFactory::create (srcs, plist, false));
 
-       new_playlist->set_orig_diskstream_id (diskstream->id());
+       new_playlist->set_orig_diskstream_id (_diskstream->id());
        new_playlist->add_region (region, _session.current_start_frame());
        new_playlist->set_frozen (true);
        region->set_locked (true);
@@ -757,3 +727,10 @@ AudioTrack::unfreeze ()
        FreezeChange (); /* EMIT SIGNAL */
 }
 
+boost::shared_ptr<AudioFileSource>
+AudioTrack::write_source (uint32_t n)
+{
+       boost::shared_ptr<AudioDiskstream> ds = boost::dynamic_pointer_cast<AudioDiskstream> (_diskstream);
+       assert (ds);
+       return ds->write_source (n);
+}
index aad20f9317284d44f635ba6954f28bc1132bb789..c5a584a7f4ec604726b14fc734d0362789d811e1 100644 (file)
@@ -278,7 +278,8 @@ AudioTrackImporter::_move ()
 
        boost::shared_ptr<Diskstream> new_ds (new AudioDiskstream (session, *ds_node));
        new_ds->set_name (name);
-       session.add_diskstream (new_ds);
+       new_ds->do_refill_with_alloc ();
+       new_ds->set_block_size (session.get_block_size ());
 
        /* Import playlists */
 
index b201960e0e6b5c0b336c03e9afba54f1fce29edc..35fb6bcc035c9f70bce30a47855fd4824ceea76e 100644 (file)
@@ -28,6 +28,7 @@
 #include "ardour/io.h"
 #include "ardour/midi_diskstream.h"
 #include "ardour/session.h"
+#include "ardour/track.h"
 
 #include "i18n.h"
 
@@ -131,7 +132,7 @@ Butler::thread_work ()
 
        struct pollfd pfd[1];
        bool disk_work_outstanding = false;
-       Session::DiskstreamList::iterator i;
+       RouteList::iterator i;
 
        while (true) {
                pfd[0].fd = request_pipe[0];
@@ -207,30 +208,33 @@ Butler::thread_work ()
 
                begin = get_microseconds();
 
-               boost::shared_ptr<Session::DiskstreamList> dsl = _session.diskstream_list().reader ();
+               boost::shared_ptr<RouteList> rl = _session.get_routes();
 
 //             for (i = dsl->begin(); i != dsl->end(); ++i) {
 //                     cerr << "BEFORE " << (*i)->name() << ": pb = " << (*i)->playback_buffer_load() << " cp = " << (*i)->capture_buffer_load() << endl;
 //             }
 
-               for (i = dsl->begin(); !transport_work_requested() && should_run && i != dsl->end(); ++i) {
+               for (i = rl->begin(); !transport_work_requested() && should_run && i != rl->end(); ++i) {
 
-                       boost::shared_ptr<Diskstream> ds = *i;
+                       boost::shared_ptr<Track> tr = boost::dynamic_pointer_cast<Track> (*i);
+                       if (!tr) {
+                               continue;
+                       }
 
                        /* don't read inactive tracks */
 
-                       boost::shared_ptr<IO> io = ds->io();
+                       boost::shared_ptr<IO> io = tr->input ();
 
                        if (io && !io->active()) {
                                continue;
                        }
 
-                       switch (ds->do_refill ()) {
+                       switch (tr->do_refill ()) {
                        case 0:
-                               bytes += ds->read_data_count();
+                               bytes += tr->read_data_count();
                                break;
                        case 1:
-                               bytes += ds->read_data_count();
+                               bytes += tr->read_data_count();
                                disk_work_outstanding = true;
                                break;
 
@@ -242,7 +246,7 @@ Butler::thread_work ()
 
                }
 
-               if (i != dsl->begin() && i != dsl->end()) {
+               if (i != rl->begin() && i != rl->end()) {
                        /* we didn't get to all the streams */
                        disk_work_outstanding = true;
                }
@@ -264,18 +268,23 @@ Butler::thread_work ()
                compute_io = true;
                begin = get_microseconds();
 
-               for (i = dsl->begin(); !transport_work_requested() && should_run && i != dsl->end(); ++i) {
+               for (i = rl->begin(); !transport_work_requested() && should_run && i != rl->end(); ++i) {
                        // cerr << "write behind for " << (*i)->name () << endl;
 
+                       boost::shared_ptr<Track> tr = boost::dynamic_pointer_cast<Track> (*i);
+                       if (!tr) {
+                               continue;
+                       }
+                       
                        /* note that we still try to flush diskstreams attached to inactive routes
                         */
 
-                       switch ((*i)->do_flush (ButlerContext)) {
+                       switch (tr->do_flush (ButlerContext)) {
                        case 0:
-                               bytes += (*i)->write_data_count();
+                               bytes += tr->write_data_count();
                                break;
                        case 1:
-                               bytes += (*i)->write_data_count();
+                               bytes += tr->write_data_count();
                                disk_work_outstanding = true;
                                break;
 
@@ -296,7 +305,7 @@ Butler::thread_work ()
                        _session.request_stop ();
                }
 
-               if (i != dsl->begin() && i != dsl->end()) {
+               if (i != rl->begin() && i != rl->end()) {
                        /* we didn't get to all the streams */
                        disk_work_outstanding = true;
                }
index ab4bd71663d46f7d1dcbab8b8d6b3f525fe19995..40a2714dc0735e9ea865109d5bbf9797d41e236f 100644 (file)
@@ -52,7 +52,7 @@
 #include "ardour/panner.h"
 #include "ardour/session.h"
 #include "ardour/io.h"
-#include "ardour/route.h"
+#include "ardour/track.h"
 
 #include "i18n.h"
 #include <locale.h>
@@ -74,7 +74,7 @@ PBD::Signal0<void>                Diskstream::DiskUnderrun;
 Diskstream::Diskstream (Session &sess, const string &name, Flag flag)
        : SessionObject(sess, name)
         , i_am_the_modifier (0)
-        , _route (0)
+        , _track (0)
         , _record_enabled (0)
         , _visible_speed (1.0f)
         , _actual_speed (1.0f)
@@ -96,7 +96,7 @@ Diskstream::Diskstream (Session &sess, const string &name, Flag flag)
         , loop_location (0)
         , overwrite_frame (0)
         , overwrite_offset (0)
-        , pending_overwrite (false)
+        , _pending_overwrite (false)
         , overwrite_queued (false)
         , input_change_pending (NoChange)
         , wrap_buffer_size (0)
@@ -122,7 +122,7 @@ Diskstream::Diskstream (Session &sess, const string &name, Flag flag)
 Diskstream::Diskstream (Session& sess, const XMLNode& /*node*/)
        : SessionObject(sess, "unnamed diskstream")
         , i_am_the_modifier (0)
-        , _route (0)
+        , _track (0)
         , _record_enabled (0)
         , _visible_speed (1.0f)
         , _actual_speed (1.0f)
@@ -144,7 +144,7 @@ Diskstream::Diskstream (Session& sess, const XMLNode& /*node*/)
         , loop_location (0)
         , overwrite_frame (0)
         , overwrite_offset (0)
-        , pending_overwrite (false)
+        , _pending_overwrite (false)
         , overwrite_queued (false)
         , input_change_pending (NoChange)
         , wrap_buffer_size (0)
@@ -176,10 +176,10 @@ Diskstream::~Diskstream ()
 }
 
 void
-Diskstream::set_route (Route& r)
+Diskstream::set_track (Track* t)
 {
-       _route = &r;
-       _io = _route->input();
+       _track = t;
+       _io = _track->input();
 
        ic_connection.disconnect();
        _io->changed.connect_same_thread (ic_connection, boost::bind (&Diskstream::handle_input_change, this, _1, _2));
@@ -188,7 +188,7 @@ Diskstream::set_route (Route& r)
        non_realtime_input_change ();
        set_align_style_from_io ();
 
-       _route->Destroyed.connect_same_thread (*this, boost::bind (&Diskstream::route_going_away, this));
+       _track->Destroyed.connect_same_thread (*this, boost::bind (&Diskstream::route_going_away, this));
 }
 
 void
@@ -331,15 +331,6 @@ Diskstream::set_roll_delay (ARDOUR::nframes_t nframes)
        _roll_delay = nframes;
 }
 
-void
-Diskstream::set_speed (double sp)
-{
-       _session.request_diskstream_speed (*this, sp);
-
-       /* to force a rebuffering at the right place */
-       playlist_modified();
-}
-
 int
 Diskstream::use_playlist (boost::shared_ptr<Playlist> playlist)
 {
@@ -381,7 +372,7 @@ Diskstream::use_playlist (boost::shared_ptr<Playlist> playlist)
        */
 
        if (!overwrite_queued && prior_playlist) {
-               _session.request_overwrite_buffer (this);
+               _session.request_overwrite_buffer (_track);
                overwrite_queued = true;
        }
 
@@ -401,7 +392,7 @@ void
 Diskstream::playlist_modified ()
 {
        if (!i_am_the_modifier && !overwrite_queued) {
-               _session.request_overwrite_buffer (this);
+               _session.request_overwrite_buffer (_track);
                overwrite_queued = true;
        }
 }
@@ -459,7 +450,7 @@ Diskstream::remove_region_from_last_capture (boost::weak_ptr<Region> wregion)
 void
 Diskstream::playlist_ranges_moved (list< Evoral::RangeMove<framepos_t> > const & movements_frames)
 {
-       if (!_route || Config->get_automation_follows_regions () == false) {
+       if (!_track || Config->get_automation_follows_regions () == false) {
                return;
        }
 
@@ -473,7 +464,7 @@ Diskstream::playlist_ranges_moved (list< Evoral::RangeMove<framepos_t> > const &
        }
 
        /* move panner automation */
-       boost::shared_ptr<Panner> p = _route->main_outs()->panner ();
+       boost::shared_ptr<Panner> p = _track->main_outs()->panner ();
        if (p) {
                for (uint32_t i = 0; i < p->npanners (); ++i) {
                        boost::shared_ptr<AutomationList> pan_alist = p->streampanner(i).pan_control()->alist();
@@ -485,7 +476,7 @@ Diskstream::playlist_ranges_moved (list< Evoral::RangeMove<framepos_t> > const &
        }
 
        /* move processor automation */
-       _route->foreach_processor (boost::bind (&Diskstream::move_processor_automation, this, _1, movements_frames));
+       _track->foreach_processor (boost::bind (&Diskstream::move_processor_automation, this, _1, movements_frames));
 }
 
 void
index a75880456480171b729df77f1309e2b377b9d8f2..3f7fee3aeeae872ee6780ff440b6402e4b9b9c73 100644 (file)
@@ -290,7 +290,7 @@ setup_enum_writer ()
        REGISTER (_Session_RecordState);
 
        REGISTER_CLASS_ENUM (SessionEvent, SetTransportSpeed);
-       REGISTER_CLASS_ENUM (SessionEvent, SetDiskstreamSpeed);
+       REGISTER_CLASS_ENUM (SessionEvent, SetTrackSpeed);
        REGISTER_CLASS_ENUM (SessionEvent, Locate);
        REGISTER_CLASS_ENUM (SessionEvent, LocateRoll);
        REGISTER_CLASS_ENUM (SessionEvent, LocateRollLocate);
index 8bf5ce89b7a1760ebeccad94631a5557535c1424..8b047490e772ff11d83919c510d28ada17404ad7 100644 (file)
@@ -55,6 +55,7 @@
 #include "ardour/smf_source.h"
 #include "ardour/utils.h"
 #include "ardour/session_playlists.h"
+#include "ardour/route.h"
 
 #include "midi++/types.h"
 
@@ -608,7 +609,7 @@ MidiDiskstream::set_pending_overwrite (bool yn)
 {
        /* called from audio thread, so we can use the read ptr and playback sample as we wish */
 
-       pending_overwrite = yn;
+       _pending_overwrite = yn;
 
        overwrite_frame = playback_sample;
 }
@@ -618,7 +619,7 @@ MidiDiskstream::overwrite_existing_buffers ()
 {
        //read(overwrite_frame, disk_io_chunk_frames, false);
        overwrite_queued = false;
-       pending_overwrite = false;
+       _pending_overwrite = false;
 
        return 0;
 }
@@ -882,7 +883,7 @@ out:
 }
 
 void
-MidiDiskstream::transport_stopped (struct tm& /*when*/, time_t /*twhen*/, bool abort_capture)
+MidiDiskstream::transport_stopped_wallclock (struct tm& /*when*/, time_t /*twhen*/, bool abort_capture)
 {
        bool more_work = true;
        int err = 0;
@@ -1160,7 +1161,7 @@ MidiDiskstream::disengage_record_enable ()
 XMLNode&
 MidiDiskstream::get_state ()
 {
-       XMLNode* node = new XMLNode ("MidiDiskstream");
+       XMLNode* node = new XMLNode ("Diskstream");
        char buf[64];
        LocaleGuard lg (X_("POSIX"));
 
@@ -1276,7 +1277,7 @@ MidiDiskstream::set_state (const XMLNode& node, int /*version*/)
                }
 
                if (!had_playlist) {
-                       _playlist->set_orig_diskstream_id (_id);
+                       _playlist->set_orig_diskstream_id (id());
                }
 
                if (capture_pending_node) {
@@ -1329,7 +1330,7 @@ MidiDiskstream::use_new_write_source (uint32_t n)
        }
 
        try {
-               _write_source = boost::dynamic_pointer_cast<SMFSource>(_session.create_midi_source_for_session (*this));
+               _write_source = boost::dynamic_pointer_cast<SMFSource>(_session.create_midi_source_for_session (name ()));
                if (!_write_source) {
                        throw failed_constructor();
                }
index 2c543ed8771a7d4fddd08717703eaaae607d48af..10bd7a23a5cb1c57713a924b045087ed82d143fe 100644 (file)
@@ -77,7 +77,8 @@ MidiTrack::use_new_diskstream ()
        assert(_mode != Destructive);
 
        boost::shared_ptr<MidiDiskstream> ds (new MidiDiskstream (_session, name(), dflags));
-       _session.add_diskstream (ds);
+       ds->do_refill_with_alloc ();
+       ds->set_block_size (_session.get_block_size ());
 
        set_diskstream (boost::dynamic_pointer_cast<MidiDiskstream> (ds));
 }
@@ -85,8 +86,9 @@ MidiTrack::use_new_diskstream ()
 void
 MidiTrack::set_diskstream (boost::shared_ptr<Diskstream> ds)
 {
-       _diskstream = ds;
-       _diskstream->set_route (*this);
+       Track::set_diskstream (ds);
+       
+       _diskstream->set_track (this);
        _diskstream->set_destructive (_mode == Destructive);
 
        _diskstream->set_record_enabled (false);
@@ -185,25 +187,9 @@ MidiTrack::state(bool full_state)
                root.add_child_nocopy (*freeze_node);
        }
 
-       /* Alignment: act as a proxy for the diskstream */
-
-       XMLNode* align_node = new XMLNode (X_("Alignment"));
-       AlignStyle as = _diskstream->alignment_style ();
-       align_node->add_property (X_("style"), enum_2_string (as));
-       root.add_child_nocopy (*align_node);
-
        root.add_property (X_("note-mode"), enum_2_string (_note_mode));
-
-       /* we don't return diskstream state because we don't
-          own the diskstream exclusively. control of the diskstream
-          state is ceded to the Session, even if we create the
-          diskstream.
-       */
-
-       _diskstream->id().print (buf, sizeof(buf));
-       root.add_property ("diskstream-id", buf);
-
        root.add_child_nocopy (_rec_enable_control->get_state());
+       root.add_child_nocopy (_diskstream->get_state ());
 
        root.add_property ("step-editing", (_step_editing ? "yes" : "no"));
        root.add_property ("note-mode", enum_2_string (_note_mode));
@@ -272,28 +258,13 @@ MidiTrack::set_state_part_two ()
                }
        }
 
-       /* Alignment: act as a proxy for the diskstream */
-
-       if ((fnode = find_named_node (*pending_state, X_("Alignment"))) != 0) {
-
-               if ((prop = fnode->property (X_("style"))) != 0) {
-
-                       /* fix for older sessions from before EnumWriter */
-
-                       string pstr;
-
-                       if (prop->value() == "capture") {
-                               pstr = "CaptureTime";
-                       } else if (prop->value() == "existing") {
-                               pstr = "ExistingMaterial";
-                       } else {
-                               pstr = prop->value();
-                       }
-
-                       AlignStyle as = AlignStyle (string_2_enum (pstr, as));
-                       _diskstream->set_persistent_align_style (as);
-               }
+       if ((fnode = find_named_node (*pending_state, X_("Diskstream"))) != 0) {
+               boost::shared_ptr<MidiDiskstream> ds (new MidiDiskstream (_session, *fnode));
+               ds->do_refill_with_alloc ();
+               ds->set_block_size (_session.get_block_size ());
+               set_diskstream (ds);
        }
+
        return;
 }
 
@@ -392,7 +363,7 @@ MidiTrack::no_roll (nframes_t nframes, sframes_t start_frame, sframes_t end_fram
 {
        int ret = Track::no_roll (nframes, start_frame, end_frame, state_changing, can_record, rec_monitors_input);
 
-       if (ret == 0 && diskstream()->record_enabled() && _step_editing) {
+       if (ret == 0 && _diskstream->record_enabled() && _step_editing) {
                push_midi_input_to_step_edit_ringbuffer (nframes);
        }
 
@@ -595,3 +566,11 @@ MidiTrack::set_midi_thru (bool yn)
 {
        _midi_thru = yn;
 }
+
+boost::shared_ptr<SMFSource>
+MidiTrack::write_source (uint32_t n)
+{
+       boost::shared_ptr<MidiDiskstream> ds = boost::dynamic_pointer_cast<MidiDiskstream> (_diskstream);
+       assert (ds);
+       return ds->write_source ();
+}
index 6fc7fdc2cffa9d92020485a07aa77d672b850647..649d549b8658d9ec13a7f31949ecfc09a47396f1 100644 (file)
@@ -178,7 +178,7 @@ Playlist::Playlist (boost::shared_ptr<const Playlist> other, string namestr, boo
        : SessionObject(other->_session, namestr)
         , regions (*this)
        , _type(other->_type)
-       , _orig_diskstream_id(other->_orig_diskstream_id)
+       , _orig_diskstream_id (other->_orig_diskstream_id)
 {
        init (hide);
 
@@ -213,7 +213,7 @@ Playlist::Playlist (boost::shared_ptr<const Playlist> other, framepos_t start, f
        : SessionObject(other->_session, str)
         , regions (*this)
        , _type(other->_type)
-       , _orig_diskstream_id(other->_orig_diskstream_id)
+       , _orig_diskstream_id (other->_orig_diskstream_id)
 {
        RegionLock rlock2 (const_cast<Playlist*> (other.get()));
 
index 7f316c953a4d1662e40236f038df7c6f5f3e3d41..5c9ee380c99da5db7890763de5e3eeb14e797c4e 100644 (file)
@@ -141,7 +141,6 @@ Session::Session (AudioEngine &eng,
          _butler (new Butler (*this)),
          _post_transport_work (0),
          _send_timecode_update (false),
-         diskstreams (new DiskstreamList),
          routes (new RouteList),
          _total_free_4k_blocks (0),
          _bundles (new BundleList),
@@ -151,7 +150,7 @@ Session::Session (AudioEngine &eng,
          click_emphasis_data (0),
          main_outs (0),
          _metadata (new SessionMetadata()),
-         _have_rec_enabled_diskstream (false)
+         _have_rec_enabled_track (false)
 
 {
        playlists.reset (new SessionPlaylists);
@@ -246,7 +245,6 @@ Session::destroy ()
        /* clear out any pending dead wood from RCU managed objects */
 
        routes.flush ();
-       diskstreams.flush ();
        _bundles.flush ();
        
        AudioDiskstream::free_working_buffers();
@@ -286,19 +284,6 @@ Session::destroy ()
 
        boost::shared_ptr<RouteList> r = routes.reader ();
 
-       DEBUG_TRACE (DEBUG::Destruction, "delete diskstreams\n");
-       {
-               RCUWriter<DiskstreamList> dwriter (diskstreams);
-               boost::shared_ptr<DiskstreamList> dsl = dwriter.get_copy();
-               for (DiskstreamList::iterator i = dsl->begin(); i != dsl->end(); ++i) {
-                       DEBUG_TRACE(DEBUG::Destruction, string_compose ("Dropping for diskstream %1 ; pre-ref = %2\n", (*i)->name(), (*i).use_count()));
-                       (*i)->drop_references ();
-               }
-
-               dsl->clear ();
-       }
-       diskstreams.flush ();
-
        DEBUG_TRACE (DEBUG::Destruction, "delete sources\n");
        for (SourceMap::iterator i = sources.begin(); i != sources.end(); ++i) {
                DEBUG_TRACE(DEBUG::Destruction, string_compose ("Dropping for source %1 ; pre-ref = %2\n", i->second->path(), i->second.use_count()));
@@ -722,16 +707,16 @@ Session::playlist_length_changed ()
 }
 
 void
-Session::diskstream_playlist_changed (boost::weak_ptr<Diskstream> wp)
+Session::track_playlist_changed (boost::weak_ptr<Track> wp)
 {
-       boost::shared_ptr<Diskstream> dstream = wp.lock ();
-       if (!dstream) {
+       boost::shared_ptr<Track> track = wp.lock ();
+       if (!track) {
                return;
        }
        
        boost::shared_ptr<Playlist> playlist;
 
-       if ((playlist = dstream->playlist()) != 0) {
+       if ((playlist = track->playlist()) != 0) {
                playlist->LengthChanged.connect_same_thread (*this, boost::bind (&Session::playlist_length_changed, this));
        }
 
@@ -758,21 +743,23 @@ Session::reset_input_monitor_state ()
 {
        if (transport_rolling()) {
 
-               boost::shared_ptr<DiskstreamList> dsl = diskstreams.reader();
-
-               for (DiskstreamList::iterator i = dsl->begin(); i != dsl->end(); ++i) {
-                       if ((*i)->record_enabled ()) {
+               boost::shared_ptr<RouteList> rl = routes.reader ();
+               for (RouteList::iterator i = rl->begin(); i != rl->end(); ++i) {
+                       boost::shared_ptr<Track> tr = boost::dynamic_pointer_cast<Track> (*i);
+                       if (tr && tr->record_enabled ()) {
                                //cerr << "switching to input = " << !auto_input << __FILE__ << __LINE__ << endl << endl;
-                               (*i)->monitor_input (Config->get_monitoring_model() == HardwareMonitoring && !config.get_auto_input());
+                               tr->monitor_input (Config->get_monitoring_model() == HardwareMonitoring && !config.get_auto_input());
                        }
                }
+               
        } else {
-               boost::shared_ptr<DiskstreamList> dsl = diskstreams.reader();
-
-               for (DiskstreamList::iterator i = dsl->begin(); i != dsl->end(); ++i) {
-                       if ((*i)->record_enabled ()) {
+               
+               boost::shared_ptr<RouteList> rl = routes.reader ();
+               for (RouteList::iterator i = rl->begin(); i != rl->end(); ++i) {
+                       boost::shared_ptr<Track> tr = boost::dynamic_pointer_cast<Track> (*i);
+                       if (tr && tr->record_enabled ()) {
                                //cerr << "switching to input = " << !Config->get_auto_input() << __FILE__ << __LINE__ << endl << endl;
-                               (*i)->monitor_input (Config->get_monitoring_model() == HardwareMonitoring);
+                               tr->monitor_input (Config->get_monitoring_model() == HardwareMonitoring);
                        }
                }
        }
@@ -979,10 +966,12 @@ Session::enable_record ()
                deliver_mmc(MIDI::MachineControl::cmdRecordStrobe, _last_record_location);
 
                if (Config->get_monitoring_model() == HardwareMonitoring && config.get_auto_input()) {
-                       boost::shared_ptr<DiskstreamList> dsl = diskstreams.reader();
-                       for (DiskstreamList::iterator i = dsl->begin(); i != dsl->end(); ++i) {
-                               if ((*i)->record_enabled ()) {
-                                       (*i)->monitor_input (true);
+                       
+                       boost::shared_ptr<RouteList> rl = routes.reader ();
+                       for (RouteList::iterator i = rl->begin(); i != rl->end(); ++i) {
+                               boost::shared_ptr<Track> tr = boost::dynamic_pointer_cast<Track> (*i);
+                               if (tr && tr->record_enabled ()) {
+                                       tr->monitor_input (true);
                                }
                        }
                }
@@ -1014,11 +1003,12 @@ Session::disable_record (bool rt_context, bool force)
                }
 
                if (Config->get_monitoring_model() == HardwareMonitoring && config.get_auto_input()) {
-                       boost::shared_ptr<DiskstreamList> dsl = diskstreams.reader();
 
-                       for (DiskstreamList::iterator i = dsl->begin(); i != dsl->end(); ++i) {
-                               if ((*i)->record_enabled ()) {
-                                       (*i)->monitor_input (false);
+                       boost::shared_ptr<RouteList> rl = routes.reader ();
+                       for (RouteList::iterator i = rl->begin(); i != rl->end(); ++i) {
+                               boost::shared_ptr<Track> tr = boost::dynamic_pointer_cast<Track> (*i);
+                               if (tr && tr->record_enabled ()) {
+                                       tr->monitor_input (false);
                                }
                        }
                }
@@ -1037,12 +1027,12 @@ Session::step_back_from_record ()
        if (g_atomic_int_compare_and_exchange (&_record_status, Recording, Enabled)) {
 
                if (Config->get_monitoring_model() == HardwareMonitoring && config.get_auto_input()) {
-                       boost::shared_ptr<DiskstreamList> dsl = diskstreams.reader();
-
-                       for (DiskstreamList::iterator i = dsl->begin(); i != dsl->end(); ++i) {
-                               if ((*i)->record_enabled ()) {
+                       boost::shared_ptr<RouteList> rl = routes.reader ();
+                       for (RouteList::iterator i = rl->begin(); i != rl->end(); ++i) {
+                               boost::shared_ptr<Track> tr = boost::dynamic_pointer_cast<Track> (*i);
+                               if (tr && tr->record_enabled ()) {
                                        //cerr << "switching from input" << __FILE__ << __LINE__ << endl << endl;
-                                       (*i)->monitor_input (false);
+                                       tr->monitor_input (false);
                                }
                        }
                }
@@ -1194,9 +1184,12 @@ Session::set_block_size (nframes_t nframes)
                        (*i)->set_block_size (nframes);
                }
 
-               boost::shared_ptr<DiskstreamList> dsl = diskstreams.reader();
-               for (DiskstreamList::iterator i = dsl->begin(); i != dsl->end(); ++i) {
-                       (*i)->set_block_size (nframes);
+               boost::shared_ptr<RouteList> rl = routes.reader ();
+               for (RouteList::iterator i = rl->begin(); i != rl->end(); ++i) {
+                       boost::shared_ptr<Track> tr = boost::dynamic_pointer_cast<Track> (*i);
+                       if (tr) {
+                               tr->set_block_size (nframes);
+                       }
                }
 
                set_worst_io_latencies ();
@@ -1482,36 +1475,12 @@ Session::new_midi_track (TrackMode mode, RouteGroup* route_group, uint32_t how_m
 
                catch (failed_constructor &err) {
                        error << _("Session: could not create new midi track.") << endmsg;
-
-                       if (track) {
-                               /* we need to get rid of this, since the track failed to be created */
-                               /* XXX arguably, AudioTrack::AudioTrack should not do the Session::add_diskstream() */
-
-                               {
-                                       RCUWriter<DiskstreamList> writer (diskstreams);
-                                       boost::shared_ptr<DiskstreamList> ds = writer.get_copy();
-                                       ds->remove (track->midi_diskstream());
-                               }
-                       }
-
                        goto failed;
                }
 
                catch (AudioEngine::PortRegistrationFailure& pfe) {
 
                        error << string_compose (_("No more JACK ports are available. You will need to stop %1 and restart JACK with ports if you need this many tracks."), PROGRAM_NAME) << endmsg;
-
-                       if (track) {
-                               /* we need to get rid of this, since the track failed to be created */
-                               /* XXX arguably, MidiTrack::MidiTrack should not do the Session::add_diskstream() */
-
-                               {
-                                       RCUWriter<DiskstreamList> writer (diskstreams);
-                                       boost::shared_ptr<DiskstreamList> ds = writer.get_copy();
-                                       ds->remove (track->midi_diskstream());
-                               }
-                       }
-
                        goto failed;
                }
 
@@ -1673,36 +1642,12 @@ Session::new_audio_track (int input_channels, int output_channels, TrackMode mod
 
                catch (failed_constructor &err) {
                        error << _("Session: could not create new audio track.") << endmsg;
-
-                       if (track) {
-                               /* we need to get rid of this, since the track failed to be created */
-                               /* XXX arguably, AudioTrack::AudioTrack should not do the Session::add_diskstream() */
-
-                               {
-                                       RCUWriter<DiskstreamList> writer (diskstreams);
-                                       boost::shared_ptr<DiskstreamList> ds = writer.get_copy();
-                                       ds->remove (track->audio_diskstream());
-                               }
-                       }
-
                        goto failed;
                }
 
                catch (AudioEngine::PortRegistrationFailure& pfe) {
 
                        error << pfe.what() << endmsg;
-
-                       if (track) {
-                               /* we need to get rid of this, since the track failed to be created */
-                               /* XXX arguably, AudioTrack::AudioTrack should not do the Session::add_diskstream() */
-
-                               {
-                                       RCUWriter<DiskstreamList> writer (diskstreams);
-                                       boost::shared_ptr<DiskstreamList> ds = writer.get_copy();
-                                       ds->remove (track->audio_diskstream());
-                               }
-                       }
-
                        goto failed;
                }
 
@@ -1947,6 +1892,13 @@ Session::add_routes (RouteList& new_routes, bool save)
                if (r->is_monitor()) {
                        _monitor_out = r;
                }
+
+               boost::shared_ptr<Track> tr = boost::dynamic_pointer_cast<Track> (r);
+               if (tr) {
+                       tr->PlaylistChanged.connect_same_thread (*this, boost::bind (&Session::track_playlist_changed, this, boost::weak_ptr<Track> (tr)));
+                       track_playlist_changed (boost::weak_ptr<Track> (tr));
+                       tr->RecordEnableChanged.connect_same_thread (*this, boost::bind (&Session::update_have_rec_enabled_track, this));
+               }
        }
 
        if (_monitor_out && IO::connecting_legal) {
@@ -2067,28 +2019,6 @@ Session::add_internal_sends (boost::shared_ptr<Route> dest, Placement p, boost::
        graph_reordered ();
 }
 
-void
-Session::add_diskstream (boost::shared_ptr<Diskstream> dstream)
-{
-       /* need to do this in case we're rolling at the time, to prevent false underruns */
-       dstream->do_refill_with_alloc ();
-
-       dstream->set_block_size (current_block_size);
-
-       {
-               RCUWriter<DiskstreamList> writer (diskstreams);
-               boost::shared_ptr<DiskstreamList> ds = writer.get_copy();
-               ds->push_back (dstream);
-               /* writer goes out of scope, copies ds back to main */
-       }
-
-       dstream->PlaylistChanged.connect_same_thread (*this, boost::bind (&Session::diskstream_playlist_changed, this, boost::weak_ptr<Diskstream> (dstream)));
-       /* this will connect to future changes, and check the current length */
-       diskstream_playlist_changed (boost::weak_ptr<Diskstream> (dstream));
-
-       dstream->RecordEnableChanged.connect_same_thread (*this, boost::bind (&Session::update_have_rec_enabled_diskstream, this));
-}
-
 void
 Session::remove_route (shared_ptr<Route> route)
 {
@@ -2123,22 +2053,6 @@ Session::remove_route (shared_ptr<Route> route)
                /* writer goes out of scope, forces route list update */
        }
 
-       boost::shared_ptr<Track> t;
-       boost::shared_ptr<Diskstream> ds;
-
-       if ((t = boost::dynamic_pointer_cast<Track>(route)) != 0) {
-               ds = t->diskstream();
-       }
-
-       if (ds) {
-
-               {
-                       RCUWriter<DiskstreamList> dsl (diskstreams);
-                       boost::shared_ptr<DiskstreamList> d = dsl.get_copy();
-                       d->remove (ds);
-               }
-       }
-
        find_current_end ();
 
        // We need to disconnect the routes inputs and outputs
@@ -2385,13 +2299,16 @@ Session::get_maximum_extent () const
 {
        nframes_t max = 0;
        nframes_t me;
-
-       boost::shared_ptr<DiskstreamList> dsl = diskstreams.reader();
-
-       for (DiskstreamList::const_iterator i = dsl->begin(); i != dsl->end(); ++i) {
-               if ((*i)->destructive())  //ignore tape tracks when getting max extents
+       
+       boost::shared_ptr<RouteList> rl = routes.reader ();
+       for (RouteList::iterator i = rl->begin(); i != rl->end(); ++i) {
+               boost::shared_ptr<Track> tr = boost::dynamic_pointer_cast<Track> (*i);
+               if (!tr || tr->destructive()) {
+                       //ignore tape tracks when getting max extents
                        continue;
-               boost::shared_ptr<Playlist> pl = (*i)->playlist();
+               }
+               
+               boost::shared_ptr<Playlist> pl = tr->playlist();
                if ((me = pl->get_maximum_extent()) > max) {
                        max = me;
                }
@@ -2400,34 +2317,6 @@ Session::get_maximum_extent () const
        return max;
 }
 
-boost::shared_ptr<Diskstream>
-Session::diskstream_by_name (string name)
-{
-       boost::shared_ptr<DiskstreamList> dsl = diskstreams.reader();
-
-       for (DiskstreamList::iterator i = dsl->begin(); i != dsl->end(); ++i) {
-               if ((*i)->name() == name) {
-                       return *i;
-               }
-       }
-
-       return boost::shared_ptr<Diskstream>((Diskstream*) 0);
-}
-
-boost::shared_ptr<Diskstream>
-Session::diskstream_by_id (const PBD::ID& id)
-{
-       boost::shared_ptr<DiskstreamList> dsl = diskstreams.reader();
-
-       for (DiskstreamList::iterator i = dsl->begin(); i != dsl->end(); ++i) {
-               if ((*i)->id() == id) {
-                       return *i;
-               }
-       }
-
-       return boost::shared_ptr<Diskstream>((Diskstream*) 0);
-}
-
 /* Region management */
 
 boost::shared_ptr<Region>
@@ -2496,10 +2385,14 @@ Session::remove_last_capture ()
 {
        list<boost::shared_ptr<Region> > r;
 
-       boost::shared_ptr<DiskstreamList> dsl = diskstreams.reader();
-
-       for (DiskstreamList::iterator i = dsl->begin(); i != dsl->end(); ++i) {
-               list<boost::shared_ptr<Region> >& l = (*i)->last_capture_regions();
+       boost::shared_ptr<RouteList> rl = routes.reader ();
+       for (RouteList::iterator i = rl->begin(); i != rl->end(); ++i) {
+               boost::shared_ptr<Track> tr = boost::dynamic_pointer_cast<Track> (*i);
+               if (!tr) {
+                       continue;
+               }
+               
+               list<boost::shared_ptr<Region> >& l = tr->last_capture_regions();
 
                if (!l.empty()) {
                        r.insert (r.end(), l.begin(), l.end());
@@ -2840,10 +2733,9 @@ Session::new_audio_source_name (const string& base, uint32_t nchan, uint32_t cha
 
 /** Create a new within-session audio source */
 boost::shared_ptr<AudioFileSource>
-Session::create_audio_source_for_session (AudioDiskstream& ds, uint32_t chan, bool destructive)
+Session::create_audio_source_for_session (size_t n_chans, string const & n, uint32_t chan, bool destructive)
 {
-       const size_t n_chans = ds.n_channels().n_audio();
-       const string name    = new_audio_source_name (ds.name(), n_chans, chan, destructive);
+       const string name    = new_audio_source_name (n, n_chans, chan, destructive);
        const string path    = new_source_path_from_name(DataType::AUDIO, name);
 
        return boost::dynamic_pointer_cast<AudioFileSource> (
@@ -2901,9 +2793,9 @@ Session::new_midi_source_name (const string& base)
 
 /** Create a new within-session MIDI source */
 boost::shared_ptr<MidiSource>
-Session::create_midi_source_for_session (MidiDiskstream& ds)
+Session::create_midi_source_for_session (string const & n)
 {
-       const string name = new_midi_source_name (ds.name());
+       const string name = new_midi_source_name (n);
        const string path = new_source_path_from_name (DataType::MIDI, name);
 
        return boost::dynamic_pointer_cast<SMFSource> (
@@ -3050,21 +2942,6 @@ Session::is_auditioning () const
        }
 }
 
-uint32_t
-Session::n_diskstreams () const
-{
-       uint32_t n = 0;
-
-       boost::shared_ptr<DiskstreamList> dsl = diskstreams.reader();
-
-       for (DiskstreamList::const_iterator i = dsl->begin(); i != dsl->end(); ++i) {
-               if (!(*i)->hidden()) {
-                       n++;
-               }
-       }
-       return n;
-}
-
 void
 Session::graph_reordered ()
 {
@@ -3088,10 +2965,12 @@ Session::graph_reordered ()
           reflect any changes in latencies within the graph.
        */
 
-       boost::shared_ptr<DiskstreamList> dsl = diskstreams.reader();
-
-       for (DiskstreamList::iterator i = dsl->begin(); i != dsl->end(); ++i) {
-               (*i)->set_capture_offset ();
+       boost::shared_ptr<RouteList> rl = routes.reader ();
+       for (RouteList::iterator i = rl->begin(); i != rl->end(); ++i) {
+               boost::shared_ptr<Track> tr = boost::dynamic_pointer_cast<Track> (*i);
+               if (tr) {
+                       tr->set_capture_offset ();
+               }
        }
 }
 
@@ -3381,10 +3260,12 @@ Session::remove_named_selection (boost::shared_ptr<NamedSelection> named_selecti
 void
 Session::reset_native_file_format ()
 {
-       boost::shared_ptr<DiskstreamList> dsl = diskstreams.reader();
-
-       for (DiskstreamList::iterator i = dsl->begin(); i != dsl->end(); ++i) {
-               (*i)->reset_write_sources (false);
+       boost::shared_ptr<RouteList> rl = routes.reader ();
+       for (RouteList::iterator i = rl->begin(); i != rl->end(); ++i) {
+               boost::shared_ptr<Track> tr = boost::dynamic_pointer_cast<Track> (*i);
+               if (tr) {
+                       tr->reset_write_sources (false);
+               }
        }
 }
 
@@ -3469,7 +3350,7 @@ Session::write_one_track (AudioTrack& track, nframes_t start, nframes_t end,
 
        /* call tree *MUST* hold route_lock */
 
-       if ((playlist = track.diskstream()->playlist()) == 0) {
+       if ((playlist = track.playlist()) == 0) {
                goto out;
        }
 
@@ -3725,28 +3606,34 @@ Session::sync_order_keys (std::string const & base)
        set_remote_control_ids ();
 }
 
-/** @return true if there is at least one record-enabled diskstream, otherwise false */
+/** @return true if there is at least one record-enabled track, otherwise false */
 bool
-Session::have_rec_enabled_diskstream () const
+Session::have_rec_enabled_track () const
 {
-       return g_atomic_int_get (&_have_rec_enabled_diskstream) == 1;
+       return g_atomic_int_get (&_have_rec_enabled_track) == 1;
 }
 
-/** Update the state of our rec-enabled diskstreams flag */
+/** Update the state of our rec-enabled tracks flag */
 void
-Session::update_have_rec_enabled_diskstream ()
+Session::update_have_rec_enabled_track ()
 {
-       boost::shared_ptr<DiskstreamList> dsl = diskstreams.reader ();
-       DiskstreamList::iterator i = dsl->begin ();
-       while (i != dsl->end () && (*i)->record_enabled () == false) {
+       boost::shared_ptr<RouteList> rl = routes.reader ();
+       RouteList::iterator i = rl->begin();
+       while (i != rl->end ()) {
+
+               boost::shared_ptr<Track> tr = boost::dynamic_pointer_cast<Track> (*i);
+               if (tr && tr->record_enabled ()) {
+                       break;
+               }
+               
                ++i;
        }
 
-       int const old = g_atomic_int_get (&_have_rec_enabled_diskstream);
+       int const old = g_atomic_int_get (&_have_rec_enabled_track);
 
-       g_atomic_int_set (&_have_rec_enabled_diskstream, i != dsl->end () ? 1 : 0);
+       g_atomic_int_set (&_have_rec_enabled_track, i != rl->end () ? 1 : 0);
 
-       if (g_atomic_int_get (&_have_rec_enabled_diskstream) != old) {
+       if (g_atomic_int_get (&_have_rec_enabled_track) != old) {
                RecordStateChanged (); /* EMIT SIGNAL */
        }
 }
@@ -3821,12 +3708,7 @@ Session::get_routes_with_regions_at (nframes64_t const p) const
                        continue;
                }
                
-               boost::shared_ptr<Diskstream> ds = tr->diskstream ();
-               if (!ds) {
-                       continue;
-               }
-
-               boost::shared_ptr<Playlist> pl = ds->playlist ();
+               boost::shared_ptr<Playlist> pl = tr->playlist ();
                if (!pl) {
                        continue;
                }
index 156784875a8e73f842d0dc20e6d8b683a45a66fe..1aa061313d00fe4e72c3668c3b96c7a8ebbc79e9 100644 (file)
@@ -40,6 +40,7 @@
 #include "ardour/midi_diskstream.h"
 #include "ardour/session.h"
 #include "ardour/timestamps.h"
+#include "ardour/track.h"
 
 #include "i18n.h"
 
@@ -73,30 +74,33 @@ Session::schedule_curve_reallocation ()
 }
 
 void
-Session::request_overwrite_buffer (Diskstream* stream)
+Session::request_overwrite_buffer (Track* t)
 {
        SessionEvent *ev = new SessionEvent (SessionEvent::Overwrite, SessionEvent::Add, SessionEvent::Immediate, 0, 0, 0.0);
-       ev->set_ptr (stream);
+       ev->set_ptr (t);
        queue_event (ev);
 }
 
 /** Process thread. */
 void
-Session::overwrite_some_buffers (Diskstream* ds)
+Session::overwrite_some_buffers (Track* t)
 {
        if (actively_recording()) {
                return;
        }
 
-       if (ds) {
+       if (t) {
 
-               ds->set_pending_overwrite (true);
+               t->set_pending_overwrite (true);
 
        } else {
 
-               boost::shared_ptr<DiskstreamList> dsl = diskstreams.reader();
-               for (DiskstreamList::iterator i = dsl->begin(); i != dsl->end(); ++i) {
-                       (*i)->set_pending_overwrite (true);
+               boost::shared_ptr<RouteList> rl = routes.reader();
+               for (RouteList::iterator i = rl->begin(); i != rl->end(); ++i) {
+                       boost::shared_ptr<Track> tr = boost::dynamic_pointer_cast<Track> (*i);
+                       if (tr) {
+                               tr->set_pending_overwrite (true);
+                       }
                }
        }
 
index ea215e6058c47ee28caefccbed30a1da1709d8cb..17387ebd5e682e086c1d6bd8eef68f158aad7a5d 100644 (file)
 #include "pbd/error.h"
 #include <glibmm/thread.h>
 
-#include "ardour/audio_diskstream.h"
 #include "ardour/audioengine.h"
 #include "ardour/butler.h"
 #include "ardour/export_failed.h"
 #include "ardour/export_handler.h"
 #include "ardour/export_status.h"
-#include "ardour/route.h"
 #include "ardour/session.h"
+#include "ardour/track.h"
 
 #include "i18n.h"
 
@@ -105,10 +104,11 @@ Session::start_audio_export (nframes_t position, bool /* realtime */)
        /* get everyone to the right position */
 
        {
-               boost::shared_ptr<DiskstreamList> dsl = diskstreams.reader();
+               boost::shared_ptr<RouteList> rl = routes.reader();
 
-               for (DiskstreamList::iterator i = dsl->begin(); i != dsl->end(); ++i) {
-                       if ((*i)-> seek (position, true)) {
+               for (RouteList::iterator i = rl->begin(); i != rl->end(); ++i) {
+                       boost::shared_ptr<Track> tr = boost::dynamic_pointer_cast<Track> (*i);
+                       if (tr && tr->seek (position, true)) {
                                error << string_compose (_("%1: cannot seek to %2 for export"),
                                                  (*i)->name(), position)
                                      << endmsg;
index 85c424e40cd8498464ab13f6c19fc0b0068428a5..e24b660fb69297521dc271983eabfb183a7c9d79 100644 (file)
@@ -28,7 +28,6 @@
 #include <glibmm/thread.h>
 
 #include "ardour/ardour.h"
-#include "ardour/audio_diskstream.h"
 #include "ardour/audioengine.h"
 #include "ardour/auditioner.h"
 #include "ardour/butler.h"
@@ -37,6 +36,7 @@
 #include "ardour/session.h"
 #include "ardour/slave.h"
 #include "ardour/timestamps.h"
+#include "ardour/port.h"
 
 #include "midi++/manager.h"
 
@@ -194,20 +194,22 @@ Session::silent_process_routes (nframes_t nframes, bool& need_butler)
 }
 
 void
-Session::get_diskstream_statistics ()
+Session::get_track_statistics ()
 {
        float pworst = 1.0f;
        float cworst = 1.0f;
 
-       boost::shared_ptr<DiskstreamList> dsl = diskstreams.reader();
-       for (DiskstreamList::iterator i = dsl->begin(); i != dsl->end(); ++i) {
+       boost::shared_ptr<RouteList> rl = routes.reader();
+       for (RouteList::iterator i = rl->begin(); i != rl->end(); ++i) {
 
-               if ((*i)->hidden()) {
+               boost::shared_ptr<Track> tr = boost::dynamic_pointer_cast<Track> (*i);
+
+               if (!tr || tr->hidden()) {
                        continue;
                }
 
-               pworst = min (pworst, (*i)->playback_buffer_load());
-               cworst = min (cworst, (*i)->capture_buffer_load());
+               pworst = min (pworst, tr->playback_buffer_load());
+               cworst = min (cworst, tr->capture_buffer_load());
        }
 
        uint32_t pmin = g_atomic_int_get (&_playback_load);
@@ -639,18 +641,21 @@ Session::track_slave_state (float slave_speed, nframes_t slave_transport_frame,
                                bool ok = true;
                                nframes_t frame_delta = slave_transport_frame - _transport_frame;
 
-                               boost::shared_ptr<DiskstreamList> dsl = diskstreams.reader();
-
-                               for (DiskstreamList::iterator i = dsl->begin(); i != dsl->end(); ++i) {
-                                       if (!(*i)->can_internal_playback_seek (frame_delta)) {
+                               boost::shared_ptr<RouteList> rl = routes.reader();
+                               for (RouteList::iterator i = rl->begin(); i != rl->end(); ++i) {
+                                       boost::shared_ptr<Track> tr = boost::dynamic_pointer_cast<Track> (*i);
+                                       if (tr && !tr->can_internal_playback_seek (frame_delta)) {
                                                ok = false;
                                                break;
                                        }
                                }
 
                                if (ok) {
-                                       for (DiskstreamList::iterator i = dsl->begin(); i != dsl->end(); ++i) {
-                                               (*i)->internal_playback_seek (frame_delta);
+                                       for (RouteList::iterator i = rl->begin(); i != rl->end(); ++i) {
+                                               boost::shared_ptr<Track> tr = boost::dynamic_pointer_cast<Track> (*i);
+                                               if (tr) {
+                                                       tr->internal_playback_seek (frame_delta);
+                                               }
                                        }
                                        _transport_frame += frame_delta;
 
@@ -1048,11 +1053,11 @@ Session::process_event (SessionEvent* ev)
                break;
 
        case SessionEvent::Overwrite:
-               overwrite_some_buffers (static_cast<Diskstream*>(ev->ptr));
+               overwrite_some_buffers (static_cast<Track*>(ev->ptr));
                break;
 
-       case SessionEvent::SetDiskstreamSpeed:
-               set_diskstream_speed (static_cast<Diskstream*> (ev->ptr), ev->speed);
+       case SessionEvent::SetTrackSpeed:
+               set_track_speed (static_cast<Track*> (ev->ptr), ev->speed);
                break;
 
        case SessionEvent::SetSyncSource:
index 9f1adcfe99874235faf90a84682813ce1a7a000d..833ead56e2d2af7757fc564f38283cdeca2d405a 100644 (file)
@@ -605,40 +605,6 @@ Session::create (const string& mix_template, nframes_t initial_length, BusProfil
        return 0;
 }
 
-
-int
-Session::load_diskstreams (const XMLNode& node)
-{
-       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") {
-                               AudioDiskstream* dsp (new AudioDiskstream (*this, **citer));
-                               boost::shared_ptr<AudioDiskstream> dstream (dsp);
-                               add_diskstream (dstream);
-                       } else if ((*citer)->name() == "MidiDiskstream") {
-                               boost::shared_ptr<MidiDiskstream> dstream (new MidiDiskstream (*this, **citer));
-                               add_diskstream (dstream);
-                       } 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;
-}
-
 void
 Session::maybe_write_autosave()
 {
@@ -1075,17 +1041,6 @@ Session::state(bool full_state)
                 }
        }
 
-       child = node->add_child ("DiskStreams");
-
-       {
-               boost::shared_ptr<DiskstreamList> dsl = diskstreams.reader();
-               for (DiskstreamList::iterator i = dsl->begin(); i != dsl->end(); ++i) {
-                       if (!(*i)->hidden()) {
-                               child->add_child_nocopy ((*i)->get_state());
-                       }
-               }
-       }
-
        if (full_state) {
                node->add_child_nocopy (_locations.get_state());
        } else {
@@ -1236,7 +1191,6 @@ Session::set_state (const XMLNode& node, int version)
        Locations
        Sources
        AudioRegions
-       AudioDiskstreams
        Connections
        Routes
        RouteGroups
@@ -1327,13 +1281,6 @@ Session::set_state (const XMLNode& node, int version)
                }
        }
 
-       if ((child = find_named_node (node, "DiskStreams")) == 0) {
-               error << _("Session: XML state has no diskstreams section") << endmsg;
-               goto out;
-       } else if (load_diskstreams (*child)) {
-               goto out;
-       }
-
        if (version >= 3000) {
                if ((child = find_named_node (node, "Bundles")) == 0) {
                        warning << _("Session: XML state has no bundles section") << endmsg;
@@ -1353,6 +1300,13 @@ Session::set_state (const XMLNode& node, int version)
                goto out;
        }
 
+       if (version < 3000 && ((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, "Routes")) == 0) {
                error << _("Session: XML state has no routes section") << endmsg;
                goto out;
@@ -1360,6 +1314,9 @@ Session::set_state (const XMLNode& node, int version)
                goto out;
        }
 
+       /* our diskstreams list is no longer needed as they are now all owned by their Route */
+       _diskstreams_2X.clear ();
+
        if (version >= 3000) {
                
                if ((child = find_named_node (node, "RouteGroups")) == 0) {
@@ -1419,8 +1376,13 @@ Session::load_routes (const XMLNode& node, int version)
 
        for (niter = nlist.begin(); niter != nlist.end(); ++niter) {
 
-               boost::shared_ptr<Route> route (XMLRouteFactory (**niter, version));
-
+               boost::shared_ptr<Route> route;
+               if (version < 3000) {
+                       route = XMLRouteFactory_2X (**niter, version);
+               } else {
+                       route = XMLRouteFactory (**niter, version);
+               }
+               
                if (route == 0) {
                        error << _("Session: cannot create Route from XML description.") << endmsg;
                        return -1;
@@ -1445,12 +1407,8 @@ Session::XMLRouteFactory (const XMLNode& node, int version)
                return ret;
        }
 
-        const XMLProperty* dsprop;
+       XMLNode* ds_child = find_named_node (node, X_("Diskstream"));
 
-        if ((dsprop = node.property (X_("diskstream-id"))) == 0) {
-                dsprop = node.property (X_("diskstream"));
-        }
-        
        DataType type = DataType::AUDIO;
        const XMLProperty* prop = node.property("default-type");
 
@@ -1460,28 +1418,80 @@ Session::XMLRouteFactory (const XMLNode& node, int version)
 
        assert (type != DataType::NIL);
 
-       if (dsprop) {
+       if (ds_child) {
 
-                boost::shared_ptr<Diskstream> ds;
-                PBD::ID diskstream_id (dsprop->value());
-               PBD::ID zero ("0");
-
-               /* this wierd hack is used when creating
-                  tracks from a template. We have a special
-                  ID for the diskstream that means "you
-                  should create a new diskstream here, not
-                  look for an old one."
-               */
+                Track* track;
+                
+                if (type == DataType::AUDIO) {
+                        track = new AudioTrack (*this, X_("toBeResetFroXML"));
+                        
+                } else {
+                        track = new MidiTrack (*this, X_("toBeResetFroXML"));
+                }
+                
+                if (track->init()) {
+                        delete track;
+                        return ret;
+                }
+                
+                if (track->set_state (node, version)) {
+                        delete track;
+                        return ret;
+                }
+                
+                boost_debug_shared_ptr_mark_interesting (track, "Track");
+                ret.reset (track);
                 
-               if (diskstream_id != zero) {
+       } else {
+               Route* rt = new Route (*this, X_("toBeResetFroXML"));
 
-                        ds = diskstream_by_id (diskstream_id);
+                if (rt->init () == 0 && rt->set_state (node, version) == 0) {
+                        boost_debug_shared_ptr_mark_interesting (rt, "Route");
+                        ret.reset (rt);
+                } else {
+                        delete rt;
+                }
+       }
 
-                        if (!ds) {
-                                error << string_compose (_("cannot find diskstream ID %1"), diskstream_id.to_s()) << endmsg;
-                                return ret;
-                        }
-               } 
+       return ret;
+}
+
+boost::shared_ptr<Route>
+Session::XMLRouteFactory_2X (const XMLNode& node, int version)
+{
+       boost::shared_ptr<Route> ret;
+
+       if (node.name() != "Route") {
+               return ret;
+       }
+
+       XMLProperty const * ds_prop = node.property (X_("diskstream-id"));
+       if (!ds_prop) {
+               ds_prop = node.property (X_("diskstream"));
+       }
+
+       cout << "ds_prop " << ds_prop << "\n";
+
+       DataType type = DataType::AUDIO;
+       const XMLProperty* prop = node.property("default-type");
+
+       if (prop) {
+               type = DataType (prop->value());
+       }
+
+       assert (type != DataType::NIL);
+
+       if (ds_prop) {
+
+               list<boost::shared_ptr<Diskstream> >::iterator i = _diskstreams_2X.begin ();
+               while (i != _diskstreams_2X.end() && (*i)->id() != ds_prop->value()) {
+                       ++i;
+               }
+
+               if (i == _diskstreams_2X.end()) {
+                       error << _("Could not find diskstream for route") << endmsg;
+                       return boost::shared_ptr<Route> ();
+               }
 
                 Track* track;
                 
@@ -1497,16 +1507,12 @@ Session::XMLRouteFactory (const XMLNode& node, int version)
                         return ret;
                 }
                 
-                if (ds) {
-                        track->set_diskstream (ds);
-                } else {
-                        track->use_new_diskstream ();
-                }
-                
                 if (track->set_state (node, version)) {
                         delete track;
                         return ret;
                 }
+
+               track->set_diskstream (*i);
                 
                 boost_debug_shared_ptr_mark_interesting (track, "Track");
                 ret.reset (track);
@@ -3099,11 +3105,11 @@ Session::config_changed (std::string p, bool ours)
                if (Config->get_monitoring_model() == HardwareMonitoring && transport_rolling()) {
                        /* auto-input only makes a difference if we're rolling */
 
-                       boost::shared_ptr<DiskstreamList> dsl = diskstreams.reader();
-
-                       for (DiskstreamList::iterator i = dsl->begin(); i != dsl->end(); ++i) {
-                               if ((*i)->record_enabled ()) {
-                                       (*i)->monitor_input (!config.get_auto_input());
+                       boost::shared_ptr<RouteList> rl = routes.reader ();
+                       for (RouteList::iterator i = rl->begin(); i != rl->end(); ++i) {
+                               boost::shared_ptr<Track> tr = boost::dynamic_pointer_cast<Track> (*i);
+                               if (tr && tr->record_enabled ()) {
+                                       tr->monitor_input (!config.get_auto_input());
                                }
                        }
                }
@@ -3317,3 +3323,32 @@ Session::set_history_depth (uint32_t 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;
+}
index c5e6795325e41fbb61197169bf5b8a7bea1ca7d0..aab27fe68b6435d6b2755867fed9d4c3166f118f 100644 (file)
@@ -32,7 +32,6 @@
 #include "midi++/port.h"
 
 #include "ardour/ardour.h"
-#include "ardour/audio_diskstream.h"
 #include "ardour/audioengine.h"
 #include "ardour/auditioner.h"
 #include "ardour/butler.h"
@@ -107,10 +106,10 @@ Session::request_transport_speed (double speed)
 }
 
 void
-Session::request_diskstream_speed (Diskstream& ds, double speed)
+Session::request_track_speed (Track* tr, double speed)
 {
-       SessionEvent* ev = new SessionEvent (SessionEvent::SetDiskstreamSpeed, SessionEvent::Add, SessionEvent::Immediate, 0, speed);
-       ev->set_ptr (&ds);
+       SessionEvent* ev = new SessionEvent (SessionEvent::SetTrackSpeed, SessionEvent::Add, SessionEvent::Immediate, 0, speed);
+       ev->set_ptr (tr);
        queue_event (ev);
 }
 
@@ -155,7 +154,7 @@ Session::request_play_loop (bool yn, bool leave_rolling)
        queue_event (ev);
 
        if (!leave_rolling && !yn && Config->get_seamless_loop() && transport_rolling()) {
-               // request an immediate locate to refresh the diskstreams
+               // request an immediate locate to refresh the tracks
                // after disabling looping
                request_locate (_transport_frame-1, false);
        }
@@ -252,7 +251,6 @@ Session::butler_transport_work ()
        bool finished;
        PostTransportWork ptw;
        boost::shared_ptr<RouteList> r = routes.reader ();
-       boost::shared_ptr<DiskstreamList> dsl = diskstreams.reader();
 
        int on_entry = g_atomic_int_get (&_butler->should_do_transport_work);
        finished = true;
@@ -267,8 +265,11 @@ Session::butler_transport_work ()
        }
 
        if (ptw & PostTransportInputChange) {
-               for (DiskstreamList::iterator i = dsl->begin(); i != dsl->end(); ++i) {
-                       (*i)->non_realtime_input_change ();
+               for (RouteList::iterator i = r->begin(); i != r->end(); ++i) {
+                       boost::shared_ptr<Track> tr = boost::dynamic_pointer_cast<Track> (*i);
+                       if (tr) {
+                               tr->non_realtime_input_change ();
+                       }
                }
        }
 
@@ -286,9 +287,10 @@ Session::butler_transport_work ()
 
                if (!(ptw & PostTransportLocate)) {
 
-                       for (DiskstreamList::iterator i = dsl->begin(); i != dsl->end(); ++i) {
-                               if (!(*i)->hidden()) {
-                                       (*i)->non_realtime_locate (_transport_frame);
+                       for (RouteList::iterator i = r->begin(); i != r->end(); ++i) {
+                               boost::shared_ptr<Track> tr = boost::dynamic_pointer_cast<Track> (*i);
+                               if (tr && !tr->hidden()) {
+                                       tr->non_realtime_locate (_transport_frame);
                                }
                                if (on_entry != g_atomic_int_get (&_butler->should_do_transport_work)) {
                                        /* new request, stop seeking, and start again */
@@ -331,21 +333,23 @@ Session::butler_transport_work ()
 void
 Session::non_realtime_set_speed ()
 {
-       boost::shared_ptr<DiskstreamList> dsl = diskstreams.reader();
-
-       for (DiskstreamList::iterator i = dsl->begin(); i != dsl->end(); ++i) {
-               (*i)->non_realtime_set_speed ();
+       boost::shared_ptr<RouteList> rl = routes.reader();
+       for (RouteList::iterator i = rl->begin(); i != rl->end(); ++i) {
+               boost::shared_ptr<Track> tr = boost::dynamic_pointer_cast<Track> (*i);
+               if (tr) {
+                       tr->non_realtime_set_speed ();
+               }
        }
 }
 
 void
 Session::non_realtime_overwrite (int on_entry, bool& finished)
 {
-       boost::shared_ptr<DiskstreamList> dsl = diskstreams.reader();
-
-       for (DiskstreamList::iterator i = dsl->begin(); i != dsl->end(); ++i) {
-               if ((*i)->pending_overwrite) {
-                       (*i)->overwrite_existing_buffers ();
+       boost::shared_ptr<RouteList> rl = routes.reader();
+       for (RouteList::iterator i = rl->begin(); i != rl->end(); ++i) {
+               boost::shared_ptr<Track> tr = boost::dynamic_pointer_cast<Track> (*i);
+               if (tr && tr->pending_overwrite ()) {
+                       tr->overwrite_existing_buffers ();
                }
                if (on_entry != g_atomic_int_get (&_butler->should_do_transport_work)) {
                        finished = false;
@@ -358,10 +362,12 @@ Session::non_realtime_overwrite (int on_entry, bool& finished)
 void
 Session::non_realtime_locate ()
 {
-       boost::shared_ptr<DiskstreamList> dsl = diskstreams.reader();
-
-       for (DiskstreamList::iterator i = dsl->begin(); i != dsl->end(); ++i) {
-               (*i)->non_realtime_locate (_transport_frame);
+       boost::shared_ptr<RouteList> rl = routes.reader();
+       for (RouteList::iterator i = rl->begin(); i != rl->end(); ++i) {
+               boost::shared_ptr<Track> tr = boost::dynamic_pointer_cast<Track> (*i);
+               if (tr) {
+                       tr->non_realtime_locate (_transport_frame);
+               }
        }
 }
 
@@ -378,10 +384,10 @@ Session::non_realtime_stop (bool abort, int on_entry, bool& finished)
        did_record = false;
        saved = false;
 
-       boost::shared_ptr<DiskstreamList> dsl = diskstreams.reader();
-
-       for (DiskstreamList::iterator i = dsl->begin(); i != dsl->end(); ++i) {
-               if ((*i)->get_captured_frames () != 0) {
+       boost::shared_ptr<RouteList> rl = routes.reader();
+       for (RouteList::iterator i = rl->begin(); i != rl->end(); ++i) {
+               boost::shared_ptr<Track> tr = boost::dynamic_pointer_cast<Track> (*i);
+               if (tr && tr->get_captured_frames () != 0) {
                        did_record = true;
                        break;
                }
@@ -436,8 +442,11 @@ Session::non_realtime_stop (bool abort, int on_entry, bool& finished)
        }
 
        DEBUG_TRACE (DEBUG::Transport, X_("Butler PTW: DS stop\n"));
-       for (DiskstreamList::iterator i = dsl->begin(); i != dsl->end(); ++i) {
-               (*i)->transport_stopped (*now, xnow, abort);
+       for (RouteList::iterator i = rl->begin(); i != rl->end(); ++i) {
+               boost::shared_ptr<Track> tr = boost::dynamic_pointer_cast<Track> (*i);
+               if (tr) {
+                       tr->transport_stopped_wallclock (*now, xnow, abort);
+               }
        }
 
        boost::shared_ptr<RouteList> r = routes.reader ();
@@ -531,7 +540,7 @@ Session::non_realtime_stop (bool abort, int on_entry, bool& finished)
 
        }
 
-       /* do this before seeking, because otherwise the Diskstreams will do the wrong thing in seamless loop mode.
+       /* do this before seeking, because otherwise the tracks will do the wrong thing in seamless loop mode.
        */
 
        if (ptw & PostTransportClearSubstate) {
@@ -541,13 +550,12 @@ Session::non_realtime_stop (bool abort, int on_entry, bool& finished)
 
        /* this for() block can be put inside the previous if() and has the effect of ... ??? what */
 
-
        DEBUG_TRACE (DEBUG::Transport, X_("Butler PTW: locate\n"));
-
-       for (DiskstreamList::iterator i = dsl->begin(); i != dsl->end(); ++i) {
-               if (!(*i)->hidden()) {
-                        DEBUG_TRACE (DEBUG::Transport, string_compose ("Butler PTW: locate on %1\n", (*i)->name()));
-                       (*i)->non_realtime_locate (_transport_frame);
+       for (RouteList::iterator i = r->begin(); i != r->end(); ++i) {
+               DEBUG_TRACE (DEBUG::Transport, string_compose ("Butler PTW: locate on %1\n", (*i)->name()));
+               boost::shared_ptr<Track> tr = boost::dynamic_pointer_cast<Track> (*i);
+               if (tr && !tr->hidden()) {
+                       tr->non_realtime_locate (_transport_frame);
                }
 
                if (on_entry != g_atomic_int_get (&_butler->should_do_transport_work)) {
@@ -631,11 +639,12 @@ Session::unset_play_loop ()
        play_loop = false;
        clear_events (SessionEvent::AutoLoop);
        
-       // set all diskstreams to NOT use internal looping
-       boost::shared_ptr<DiskstreamList> dsl = diskstreams.reader();
-       for (DiskstreamList::iterator i = dsl->begin(); i != dsl->end(); ++i) {
-               if (!(*i)->hidden()) {
-                       (*i)->set_loop (0);
+       // set all tracks to NOT use internal looping
+       boost::shared_ptr<RouteList> rl = routes.reader ();
+       for (RouteList::iterator i = rl->begin(); i != rl->end(); ++i) {
+               boost::shared_ptr<Track> tr = boost::dynamic_pointer_cast<Track> (*i);
+               if (tr && !tr->hidden()) {
+                       tr->set_loop (0);
                }
        }
 }
@@ -670,20 +679,22 @@ Session::set_play_loop (bool yn)
                        unset_play_range ();
 
                        if (Config->get_seamless_loop()) {
-                               // set all diskstreams to use internal looping
-                               boost::shared_ptr<DiskstreamList> dsl = diskstreams.reader();
-                               for (DiskstreamList::iterator i = dsl->begin(); i != dsl->end(); ++i) {
-                                       if (!(*i)->hidden()) {
-                                               (*i)->set_loop (loc);
+                               // set all tracks to use internal looping
+                               boost::shared_ptr<RouteList> rl = routes.reader ();
+                               for (RouteList::iterator i = rl->begin(); i != rl->end(); ++i) {
+                                       boost::shared_ptr<Track> tr = boost::dynamic_pointer_cast<Track> (*i);
+                                       if (tr && !tr->hidden()) {
+                                               tr->set_loop (loc);
                                        }
                                }
                        }
                        else {
-                               // set all diskstreams to NOT use internal looping
-                               boost::shared_ptr<DiskstreamList> dsl = diskstreams.reader();
-                               for (DiskstreamList::iterator i = dsl->begin(); i != dsl->end(); ++i) {
-                                       if (!(*i)->hidden()) {
-                                               (*i)->set_loop (0);
+                               // set all tracks to NOT use internal looping
+                               boost::shared_ptr<RouteList> rl = routes.reader ();
+                               for (RouteList::iterator i = rl->begin(); i != rl->end(); ++i) {
+                                       boost::shared_ptr<Track> tr = boost::dynamic_pointer_cast<Track> (*i);
+                                       if (tr && !tr->hidden()) {
+                                               tr->set_loop (0);
                                        }
                                }
                        }
@@ -749,16 +760,19 @@ Session::start_locate (nframes64_t target_frame, bool with_roll, bool with_flush
 int
 Session::micro_locate (nframes_t distance)
 {
-       boost::shared_ptr<DiskstreamList> dsl = diskstreams.reader();
-
-       for (DiskstreamList::iterator i = dsl->begin(); i != dsl->end(); ++i) {
-               if (!(*i)->can_internal_playback_seek (distance)) {
+       boost::shared_ptr<RouteList> rl = routes.reader();
+       for (RouteList::iterator i = rl->begin(); i != rl->end(); ++i) {
+               boost::shared_ptr<Track> tr = boost::dynamic_pointer_cast<Track> (*i);
+               if (tr && !tr->can_internal_playback_seek (distance)) {
                        return -1;
                }
        }
 
-       for (DiskstreamList::iterator i = dsl->begin(); i != dsl->end(); ++i) {
-               (*i)->internal_playback_seek (distance);
+       for (RouteList::iterator i = rl->begin(); i != rl->end(); ++i) {
+               boost::shared_ptr<Track> tr = boost::dynamic_pointer_cast<Track> (*i);
+               if (tr) {
+                       tr->internal_playback_seek (distance);
+               }
        }
 
        _transport_frame += distance;
@@ -834,24 +848,25 @@ Session::locate (nframes64_t target_frame, bool with_roll, bool with_flush, bool
                /* switch from input if we're going to roll */
                if (Config->get_monitoring_model() == HardwareMonitoring) {
 
-                       boost::shared_ptr<DiskstreamList> dsl = diskstreams.reader();
-
-                       for (DiskstreamList::iterator i = dsl->begin(); i != dsl->end(); ++i) {
-                               if ((*i)->record_enabled ()) {
+                       boost::shared_ptr<RouteList> rl = routes.reader();
+                       for (RouteList::iterator i = rl->begin(); i != rl->end(); ++i) {
+                               boost::shared_ptr<Track> tr = boost::dynamic_pointer_cast<Track> (*i);
+                               if (tr && tr->record_enabled ()) {
                                        //cerr << "switching from input" << __FILE__ << __LINE__ << endl << endl;
-                                       (*i)->monitor_input (!config.get_auto_input());
+                                       tr->monitor_input (!config.get_auto_input());
                                }
                        }
                }
        } else {
                /* otherwise we're going to stop, so do the opposite */
                if (Config->get_monitoring_model() == HardwareMonitoring) {
-                       boost::shared_ptr<DiskstreamList> dsl = diskstreams.reader();
 
-                       for (DiskstreamList::iterator i = dsl->begin(); i != dsl->end(); ++i) {
-                               if ((*i)->record_enabled ()) {
+                       boost::shared_ptr<RouteList> rl = routes.reader();
+                       for (RouteList::iterator i = rl->begin(); i != rl->end(); ++i) {
+                               boost::shared_ptr<Track> tr = boost::dynamic_pointer_cast<Track> (*i);
+                               if (tr && tr->record_enabled ()) {
                                        //cerr << "switching to input" << __FILE__ << __LINE__ << endl << endl;
-                                       (*i)->monitor_input (true);
+                                       tr->monitor_input (true);
                                }
                        }
                }
@@ -869,12 +884,12 @@ Session::locate (nframes64_t target_frame, bool with_roll, bool with_flush, bool
                        if (with_loop) {
                                // this is only necessary for seamless looping
 
-                               boost::shared_ptr<DiskstreamList> dsl = diskstreams.reader();
-
-                               for (DiskstreamList::iterator i = dsl->begin(); i != dsl->end(); ++i) {
-                                       if ((*i)->record_enabled ()) {
+                               boost::shared_ptr<RouteList> rl = routes.reader();
+                               for (RouteList::iterator i = rl->begin(); i != rl->end(); ++i) {
+                                       boost::shared_ptr<Track> tr = boost::dynamic_pointer_cast<Track> (*i);
+                                       if (tr && tr->record_enabled ()) {
                                                // tell it we've looped, so it can deal with the record state
-                                               (*i)->transport_looped(_transport_frame);
+                                               tr->transport_looped(_transport_frame);
                                        }
                                }
                        }
@@ -921,12 +936,12 @@ Session::set_transport_speed (double speed, bool abort, bool clear_state)
 
                if (Config->get_monitoring_model() == HardwareMonitoring)
                {
-                       boost::shared_ptr<DiskstreamList> dsl = diskstreams.reader();
-
-                       for (DiskstreamList::iterator i = dsl->begin(); i != dsl->end(); ++i) {
-                               if ((*i)->record_enabled ()) {
+                       boost::shared_ptr<RouteList> rl = routes.reader();
+                       for (RouteList::iterator i = rl->begin(); i != rl->end(); ++i) {
+                               boost::shared_ptr<Track> tr = boost::dynamic_pointer_cast<Track> (*i);
+                               if (tr && tr->record_enabled ()) {
                                        //cerr << "switching to input" << __FILE__ << __LINE__ << endl << endl;
-                                       (*i)->monitor_input (true);
+                                       tr->monitor_input (true);
                                }
                        }
                }
@@ -950,12 +965,12 @@ Session::set_transport_speed (double speed, bool abort, bool clear_state)
 
                if (Config->get_monitoring_model() == HardwareMonitoring) {
 
-                       boost::shared_ptr<DiskstreamList> dsl = diskstreams.reader();
-
-                       for (DiskstreamList::iterator i = dsl->begin(); i != dsl->end(); ++i) {
-                               if (config.get_auto_input() && (*i)->record_enabled ()) {
+                       boost::shared_ptr<RouteList> rl = routes.reader();
+                       for (RouteList::iterator i = rl->begin(); i != rl->end(); ++i) {
+                               boost::shared_ptr<Track> tr = boost::dynamic_pointer_cast<Track> (*i);
+                               if (config.get_auto_input() && tr && tr->record_enabled ()) {
                                        //cerr << "switching from input" << __FILE__ << __LINE__ << endl << endl;
-                                       (*i)->monitor_input (false);
+                                       tr->monitor_input (false);
                                }
                        }
                }
@@ -1002,9 +1017,10 @@ Session::set_transport_speed (double speed, bool abort, bool clear_state)
                _last_transport_speed = _transport_speed;
                _transport_speed = speed;
 
-               boost::shared_ptr<DiskstreamList> dsl = diskstreams.reader();
-               for (DiskstreamList::iterator i = dsl->begin(); i != dsl->end(); ++i) {
-                       if ((*i)->realtime_set_speed ((*i)->speed(), true)) {
+               boost::shared_ptr<RouteList> rl = routes.reader();
+               for (RouteList::iterator i = rl->begin(); i != rl->end(); ++i) {
+                       boost::shared_ptr<Track> tr = boost::dynamic_pointer_cast<Track> (*i);
+                       if (tr && tr->realtime_set_speed (tr->speed(), true)) {
                                todo = PostTransportWork (todo | PostTransportSpeed);
                                break;
                        }
@@ -1028,10 +1044,12 @@ Session::stop_transport (bool abort, bool clear_state)
 
        if (actively_recording() && !(transport_sub_state & StopPendingCapture) && _worst_output_latency > current_block_size) {
 
-                boost::shared_ptr<DiskstreamList> dsl = diskstreams.reader();
-
-                for (DiskstreamList::iterator i = dsl->begin(); i != dsl->end(); ++i) {
-                        (*i)->prepare_to_stop (_transport_frame);
+               boost::shared_ptr<RouteList> rl = routes.reader();
+               for (RouteList::iterator i = rl->begin(); i != rl->end(); ++i) {
+                       boost::shared_ptr<Track> tr = boost::dynamic_pointer_cast<Track> (*i);
+                       if (tr) {
+                               tr->prepare_to_stop (_transport_frame);
+                       }
                 }
 
                /* we need to capture the audio that has still not yet been received by the system
@@ -1056,10 +1074,12 @@ Session::stop_transport (bool abort, bool clear_state)
        if ((transport_sub_state & PendingDeclickOut) == 0) {
 
                 if (!(transport_sub_state & StopPendingCapture)) {
-                        boost::shared_ptr<DiskstreamList> dsl = diskstreams.reader();
-                        
-                        for (DiskstreamList::iterator i = dsl->begin(); i != dsl->end(); ++i) {
-                                (*i)->prepare_to_stop (_transport_frame);
+                       boost::shared_ptr<RouteList> rl = routes.reader();
+                       for (RouteList::iterator i = rl->begin(); i != rl->end(); ++i) {
+                               boost::shared_ptr<Track> tr = boost::dynamic_pointer_cast<Track> (*i);
+                               if (tr) {
+                                       tr->prepare_to_stop (_transport_frame);
+                               }
                         }
                 }
                 
@@ -1105,9 +1125,12 @@ Session::start_transport ()
        _transport_speed = 1.0;
        _target_transport_speed = 1.0;
 
-       boost::shared_ptr<DiskstreamList> dsl = diskstreams.reader();
-       for (DiskstreamList::iterator i = dsl->begin(); i != dsl->end(); ++i) {
-               (*i)->realtime_set_speed ((*i)->speed(), true);
+       boost::shared_ptr<RouteList> rl = routes.reader();
+       for (RouteList::iterator i = rl->begin(); i != rl->end(); ++i) {
+               boost::shared_ptr<Track> tr = boost::dynamic_pointer_cast<Track> (*i);
+               if (tr) {
+                       tr->realtime_set_speed (tr->speed(), true);
+               }
        }
 
        deliver_mmc(MIDI::MachineControl::cmdDeferredPlay, _transport_frame);
@@ -1185,13 +1208,14 @@ Session::use_sync_source (Slave* new_slave)
        delete _slave;
        _slave = new_slave;
 
-       boost::shared_ptr<DiskstreamList> dsl = diskstreams.reader();
-       for (DiskstreamList::iterator i = dsl->begin(); i != dsl->end(); ++i) {
-               if (!(*i)->hidden()) {
-                       if ((*i)->realtime_set_speed ((*i)->speed(), true)) {
+       boost::shared_ptr<RouteList> rl = routes.reader();
+       for (RouteList::iterator i = rl->begin(); i != rl->end(); ++i) {
+               boost::shared_ptr<Track> tr = boost::dynamic_pointer_cast<Track> (*i);
+               if (tr && !tr->hidden()) {
+                       if (tr->realtime_set_speed (tr->speed(), true)) {
                                non_rt_required = true;
                        }
-                       (*i)->set_slaved (_slave != 0);
+                       tr->set_slaved (_slave != 0);
                }
        }
 
@@ -1274,16 +1298,16 @@ Session::switch_to_sync_source (SyncSource src)
 }
 
 void
-Session::reverse_diskstream_buffers ()
+Session::reverse_track_buffers ()
 {
        add_post_transport_work (PostTransportReverse);
        _butler->schedule_transport_work ();
 }
 
 void
-Session::set_diskstream_speed (Diskstream* stream, double speed)
+Session::set_track_speed (Track* track, double speed)
 {
-       if (stream->realtime_set_speed (speed, false)) {
+       if (track->realtime_set_speed (speed, false)) {
                add_post_transport_work (PostTransportSpeed);
                _butler->schedule_transport_work ();
                set_dirty ();
@@ -1501,11 +1525,13 @@ Session::update_latency_compensation (bool with_stop, bool abort)
 
        /* reflect any changes in latencies into capture offsets
        */
-
-       boost::shared_ptr<DiskstreamList> dsl = diskstreams.reader();
-
-       for (DiskstreamList::iterator i = dsl->begin(); i != dsl->end(); ++i) {
-               (*i)->set_capture_offset ();
+       
+       boost::shared_ptr<RouteList> rl = routes.reader();
+       for (RouteList::iterator i = rl->begin(); i != rl->end(); ++i) {
+               boost::shared_ptr<Track> tr = boost::dynamic_pointer_cast<Track> (*i);
+               if (tr) {
+                       tr->set_capture_offset ();
+               }
        }
 }
 
index 47ec248d59adc31c7aa7f14723e861b7f17b1c8f..a7325189c81547b98c464879811daf242d58c393 100644 (file)
@@ -261,7 +261,7 @@ Track::no_roll (nframes_t nframes, framepos_t start_frame, framepos_t end_frame,
                */
        }
 
-       diskstream()->check_record_status (start_frame, nframes, can_record);
+       _diskstream->check_record_status (start_frame, nframes, can_record);
 
        bool send_silence;
 
@@ -346,7 +346,7 @@ Track::silent_roll (nframes_t nframes, framepos_t /*start_frame*/, framepos_t /*
 
        silence (nframes);
 
-       return diskstream()->process (_session.transport_frame(), nframes, can_record, rec_monitors_input, need_butler);
+       return _diskstream->process (_session.transport_frame(), nframes, can_record, rec_monitors_input, need_butler);
 }
 
 ChanCount
@@ -361,3 +361,297 @@ Track::input_streams () const
         return cc;
 }
 
+void
+Track::set_diskstream (boost::shared_ptr<Diskstream> ds)
+{
+       _diskstream = ds;
+       
+       ds->PlaylistChanged.connect_same_thread (*this, boost::bind (&Track::diskstream_playlist_changed, this));
+       diskstream_playlist_changed ();
+       ds->RecordEnableChanged.connect_same_thread (*this, boost::bind (&Track::diskstream_record_enable_changed, this));
+       ds->SpeedChanged.connect_same_thread (*this, boost::bind (&Track::diskstream_speed_changed, this));
+       ds->AlignmentStyleChanged.connect_same_thread (*this, boost::bind (&Track::diskstream_alignment_style_changed, this));
+}
+
+void
+Track::diskstream_playlist_changed ()
+{
+       PlaylistChanged (); /* EMIT SIGNAL */
+}
+
+void
+Track::diskstream_record_enable_changed ()
+{
+       RecordEnableChanged (); /* EMIT SIGNAL */
+}
+
+void
+Track::diskstream_speed_changed ()
+{
+       SpeedChanged (); /* EMIT SIGNAL */
+}
+
+void
+Track::diskstream_alignment_style_changed ()
+{
+       AlignmentStyleChanged (); /* EMIT SIGNAL */
+}
+
+boost::shared_ptr<Playlist>
+Track::playlist ()
+{
+       return _diskstream->playlist ();
+}
+
+void
+Track::monitor_input (bool m)
+{
+       _diskstream->monitor_input (m);
+}
+
+bool
+Track::destructive () const
+{
+       return _diskstream->destructive ();
+}
+
+list<boost::shared_ptr<Region> > &
+Track::last_capture_regions ()
+{
+       return _diskstream->last_capture_regions ();
+}
+
+void
+Track::set_capture_offset ()
+{
+       _diskstream->set_capture_offset ();
+}
+
+void
+Track::reset_write_sources (bool r, bool force)
+{
+       _diskstream->reset_write_sources (r, force);
+}
+
+float
+Track::playback_buffer_load () const
+{
+       return _diskstream->playback_buffer_load ();
+}
+
+float
+Track::capture_buffer_load () const
+{
+       return _diskstream->capture_buffer_load ();
+}
+
+int
+Track::do_refill ()
+{
+       return _diskstream->do_refill ();
+}
+
+int
+Track::do_flush (RunContext c, bool force)
+{
+       return _diskstream->do_flush (c, force);
+}
+
+void
+Track::set_pending_overwrite (bool o)
+{
+       _diskstream->set_pending_overwrite (o);
+}
+
+int
+Track::seek (nframes_t s, bool complete_refill)
+{
+       return _diskstream->seek (s, complete_refill);
+}
+
+bool
+Track::hidden () const
+{
+       return _diskstream->hidden ();
+}
+
+int
+Track::can_internal_playback_seek (nframes_t d)
+{
+       return _diskstream->can_internal_playback_seek (d);
+}
+
+int
+Track::internal_playback_seek (nframes_t d)
+{
+       return _diskstream->internal_playback_seek (d);
+}
+
+void
+Track::non_realtime_input_change ()
+{
+       _diskstream->non_realtime_input_change ();
+}
+
+void
+Track::non_realtime_locate (nframes_t p)
+{
+       _diskstream->non_realtime_locate (p);
+}
+
+void
+Track::non_realtime_set_speed ()
+{
+       _diskstream->non_realtime_set_speed ();
+}
+
+int
+Track::overwrite_existing_buffers ()
+{
+       return _diskstream->overwrite_existing_buffers ();
+}
+
+nframes_t
+Track::get_captured_frames (uint32_t n)
+{
+       return _diskstream->get_captured_frames (n);
+}
+
+int
+Track::set_loop (Location* l)
+{
+       return _diskstream->set_loop (l);
+}
+
+void
+Track::transport_looped (nframes_t f)
+{
+       _diskstream->transport_looped (f);
+}
+
+bool
+Track::realtime_set_speed (double s, bool g)
+{
+       return _diskstream->realtime_set_speed (s, g);
+}
+
+void
+Track::transport_stopped_wallclock (struct tm & n, time_t t, bool g)
+{
+       _diskstream->transport_stopped_wallclock (n, t, g);
+}
+
+bool
+Track::pending_overwrite () const
+{
+       return _diskstream->pending_overwrite ();
+}
+
+double
+Track::speed () const
+{
+       return _diskstream->speed ();
+}
+
+void
+Track::prepare_to_stop (framepos_t p)
+{
+       _diskstream->prepare_to_stop (p);
+}
+
+void
+Track::set_slaved (bool s)
+{
+       _diskstream->set_slaved (s);
+}
+
+ChanCount
+Track::n_channels ()
+{
+       return _diskstream->n_channels ();
+}
+
+nframes_t
+Track::get_capture_start_frame (uint32_t n)
+{
+       return _diskstream->get_capture_start_frame (n);
+}
+
+AlignStyle
+Track::alignment_style () const
+{
+       return _diskstream->alignment_style ();
+}
+
+void
+Track::set_record_enabled (bool r)
+{
+       _diskstream->set_record_enabled (r);
+}
+
+nframes_t
+Track::current_capture_start () const
+{
+       return _diskstream->current_capture_start ();
+}
+
+nframes_t
+Track::current_capture_end () const
+{
+       return _diskstream->current_capture_end ();
+}
+
+void
+Track::playlist_modified ()
+{
+       _diskstream->playlist_modified ();
+}
+
+int
+Track::use_playlist (boost::shared_ptr<Playlist> p)
+{
+       return _diskstream->use_playlist (p);
+}
+
+int
+Track::use_copy_playlist ()
+{
+       return _diskstream->use_copy_playlist ();
+}
+
+int
+Track::use_new_playlist ()
+{
+       return _diskstream->use_new_playlist ();
+}
+
+uint32_t
+Track::read_data_count () const
+{
+       return _diskstream->read_data_count ();
+}
+
+void
+Track::set_align_style (AlignStyle s)
+{
+       _diskstream->set_align_style (s);
+}
+
+uint32_t
+Track::write_data_count () const
+{
+       return _diskstream->write_data_count ();
+}
+
+PBD::ID const &
+Track::diskstream_id () const
+{
+       return _diskstream->id ();
+}
+
+void
+Track::set_block_size (nframes_t n)
+{
+       Route::set_block_size (n);
+       _diskstream->set_block_size (n);
+}