+ _midi_audition = false;
+
+ if (_synth_added) {
+ remove_processor(asynth);
+ _synth_added = false;
+ }
+ midi_region.reset();
+ _import_position = 0;
+
+ /* copy it */
+ the_region = boost::dynamic_pointer_cast<AudioRegion> (RegionFactory::create (region));
+ the_region->set_position (0);
+
+ _disk_reader->audio_playlist()->drop_regions ();
+ _disk_reader->audio_playlist()->add_region (the_region, 0, 1);
+
+ ProcessorStreams ps;
+ {
+ Glib::Threads::Mutex::Lock lm (AudioEngine::instance()->process_lock ());
+
+ if (configure_processors (&ps)) {
+ error << string_compose (_("Cannot setup auditioner processing flow for %1 channels"),
+ region->n_channels()) << endmsg;
+ return;
+ }
+ }
+
+ } else if (boost::dynamic_pointer_cast<MidiRegion>(region)) {
+ _midi_audition = true;
+
+ the_region.reset();
+ _import_position = region->position();
+
+ /* copy it */
+ midi_region = (boost::dynamic_pointer_cast<MidiRegion> (RegionFactory::create (region)));
+ midi_region->set_position (_import_position);
+
+ _disk_reader->midi_playlist()->drop_regions ();
+ _disk_reader->midi_playlist()->add_region (midi_region, _import_position, 1);
+ _disk_reader->reset_tracker();
+
+ ProcessorStreams ps;
+
+ if (_synth_changed && _synth_added) {
+ remove_processor(asynth);
+ _synth_added = false;
+ }
+ if (_synth_changed && !_synth_added) {
+ _synth_added = false;
+ lookup_synth();
+ }
+
+ if (!_synth_added && asynth) {
+ int rv = add_processor (asynth, PreFader, &ps, true);
+ if (rv) {
+ error << _("Failed to load synth for MIDI-Audition.") << endmsg;
+ } else {
+ _synth_added = true;
+ }
+ } else {
+ _queue_panic = true;
+ }