RCU-ification of AudioEngine port list, and DiskStreams. not well tested, but basical...
[ardour.git] / gtk2_ardour / playlist_selector.cc
index 870fa2df5f18e85063ce011388d3b9bfa80edbab..68227d193c281fb0f07dc2de54643dd247a9bfa9 100644 (file)
@@ -40,6 +40,7 @@ using namespace std;
 using namespace sigc;
 using namespace Gtk;
 using namespace ARDOUR;
+using namespace PBD;
 
 PlaylistSelector::PlaylistSelector ()
        : ArdourDialog ("playlist selector")
@@ -89,13 +90,13 @@ void
 PlaylistSelector::show_for (RouteUI* ruix)
 {
        vector<const char*> item;
-       AudioDiskstream* this_ds;
+       boost::shared_ptr<Diskstream> this_ds;
        string str;
 
        rui = ruix;
 
        str = _("ardour: playlist for ");
-       str += rui->route().name();
+       str += rui->route()->name();
 
        set_title (str);
 
@@ -115,7 +116,7 @@ PlaylistSelector::show_for (RouteUI* ruix)
        
        for (DSPL_Map::iterator x = dspl_map.begin(); x != dspl_map.end(); ++x) {
 
-               AudioDiskstream* ds = session->diskstream_by_id (x->first);
+               boost::shared_ptr<Diskstream> ds = session->diskstream_by_id (x->first);
 
                if (ds == 0) {
                        continue;
@@ -188,7 +189,7 @@ PlaylistSelector::add_playlist_to_map (Playlist *pl)
 
        if ((x = dspl_map.find (apl->get_orig_diskstream_id())) == dspl_map.end()) {
 
-               pair<ARDOUR::id_t,list<Playlist*>*> newp (apl->get_orig_diskstream_id(), new list<Playlist*>);
+               pair<PBD::ID,list<Playlist*>*> newp (apl->get_orig_diskstream_id(), new list<Playlist*>);
                
                x = dspl_map.insert (dspl_map.end(), newp);
        }
@@ -222,7 +223,7 @@ PlaylistSelector::selection_changed ()
 
        TreeModel::iterator iter = tree.get_selection()->get_selected();
 
-       if (!iter) {
+       if (!iter || rui == 0) {
                /* nothing selected */
                return;
        }
@@ -232,7 +233,7 @@ PlaylistSelector::selection_changed ()
                AudioTrack* at;
                AudioPlaylist* apl;
                
-               if ((at = dynamic_cast<AudioTrack*> (&rui->route())) == 0) {
+               if ((at = rui->audio_track()) == 0) {
                        /* eh? */
                        return;
                }
@@ -242,7 +243,7 @@ PlaylistSelector::selection_changed ()
                        return;
                }
                
-               at->disk_stream().use_playlist (apl);
+               at->diskstream()->use_playlist (apl);
 
                hide ();
        }