commit 681387f8c049e3e329e9fd88ce9516035ef77540
Author: Hector Martin <marcan@marcan.st>
Date:   Sun Apr 5 21:04:18 2020 +0900

    Allow stem export of MIDI tracks

diff --git a/gtk2_ardour/export_channel_selector.cc b/gtk2_ardour/export_channel_selector.cc
index 2e59e4c140..84be504f72 100644
--- a/gtk2_ardour/export_channel_selector.cc
+++ b/gtk2_ardour/export_channel_selector.cc
@@ -680,6 +680,7 @@ TrackExportChannelSelector::select_none ()
 void
 TrackExportChannelSelector::track_outputs_selected ()
 {
+	fill_list();
 	update_config();
 }
 
@@ -707,13 +708,27 @@ TrackExportChannelSelector::fill_list()
 		}
 	}
 	for (RouteList::iterator it = routes.begin(); it != routes.end(); ++it) {
-		if (boost::dynamic_pointer_cast<AudioTrack>(*it)) {
-			if (!(*it)->active ()) {
-				// don't include inactive tracks
+		if (!(*it)->active ()) {
+			// don't include inactive tracks
+			continue;
+		}
+		if (!boost::dynamic_pointer_cast<Track>(*it)) {
+			// not a track, we've already handled it
+			continue;
+		}
+
+		if (track_output_button.get_active()) {
+			if ((*it)->output()->n_ports().n_audio() <= 0) {
+				// track has no audio outputs
+				continue;
+			}
+		} else {
+			// can only do pre-processor export of audio tracks for now
+			if (!boost::dynamic_pointer_cast<AudioTrack>(*it)) {
 				continue;
 			}
-			add_track (*it, cs.selected (*it));
 		}
+        add_track (*it, cs.selected (*it));
 	}
 }
 
