improving logic/flow for SMF type 1 files part 1:
authorPaul Davis <paul@linuxaudiosystems.com>
Tue, 13 Dec 2016 16:48:20 +0000 (16:48 +0000)
committerPaul Davis <paul@linuxaudiosystems.com>
Wed, 14 Dec 2016 11:46:26 +0000 (11:46 +0000)
check num tracks for type1 and offer multichannel option if appropriate

gtk2_ardour/sfdb_ui.cc

index b2f96ed8a648c90db821f5e980ba2bb89d25e408..5a8de6c5508789dadb46de51fd7d8053d1b61c57 100644 (file)
@@ -1436,7 +1436,7 @@ SoundFileOmega::reset_options ()
        vector<string> channel_strings;
 
        if (mode == ImportAsTrack || mode == ImportAsTapeTrack || mode == ImportToTrack) {
-               /// XXX needs special casing for MIDI type-1 files
+
                channel_strings.push_back (_("one track per file"));
 
                if (selection_includes_multichannel) {
@@ -1578,24 +1578,23 @@ SoundFileOmega::check_info (const vector<string>& paths, bool& same_size, bool&
                } else if (SMFSource::valid_midi_file (*i)) {
 
                        Evoral::SMF reader;
-                       reader.open(*i);
-                       if (reader.num_tracks() > 1) {
-                               /* NOTE: we cannot merge midi-tracks.
-                                * they will always be on separate tracks
-                                * "one track per file" is not possible.
-                                */
-                               //multichannel = true; // "channel" == track here...
-                       }
-                       if (reader.is_type0 () && reader.channels().size() > 1) {
-                               /* for type-0 files, we can split
-                                * "one track per channel"
-                                */
-                               multichannel = true;
-                       }
 
-                       /* XXX we need err = true handling here in case
-                          we can't check the file
-                       */
+                       if (reader.open (*i)) {
+                               err = true;
+                       } else {
+                               if (reader.is_type0 ()) {
+                                       if (reader.channels().size() > 1) {
+                                               /* for type-0 files, we can split
+                                                * "one track per channel"
+                                                */
+                                               multichannel = true;
+                                       }
+                               } else {
+                                       if (reader.num_tracks() > 1) {
+                                               multichannel = true;
+                                       }
+                               }
+                       }
 
                } else {
                        err = true;