Fix some erroneous resizing of port matrices.
[ardour.git] / gtk2_ardour / editor_audio_import.cc
index e7572ce8c18a6c7972b4da2285d3a7e13446b38f..2145b24352ba4a48c34fddb48072ab355b96c491 100644 (file)
@@ -47,6 +47,7 @@
 #include "ardour/region_factory.h"
 #include "ardour/source_factory.h"
 #include "ardour/session.h"
+#include "ardour/smf_source.h"
 #include "pbd/memento_command.h"
 
 #include "ardour_ui.h"
@@ -726,8 +727,9 @@ Editor::add_sources (vector<Glib::ustring> paths, SourceList& sources, nframes64
        }
 
        // kludge (for MIDI we're abusing "channel" for "track" here)
-       if (paths.front().rfind(".mid") != Glib::ustring::npos)
+       if (SMFSource::safe_midi_file_extension (paths.front())) {
                target_regions = -1;
+       }
 
        if (target_regions == 1) {
 
@@ -852,7 +854,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 +889,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 +903,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;
        }