+ if (type == DataType::AUDIO) {
+
+ if (!(flags & Destructive)) {
+
+ try {
+
+ Source* src = new SndFileSource (s, path, chn, flags);
+ // boost_debug_shared_ptr_mark_interesting (src, "Source");
+ boost::shared_ptr<Source> ret (src);
+
+ if (setup_peakfile (ret, defer_peaks)) {
+ return boost::shared_ptr<Source>();
+ }
+
+ ret->check_for_analysis_data_on_disk ();
+ if (announce) {
+ SourceCreated (ret);
+ }
+ return ret;
+ }
+
+ catch (failed_constructor& err) {
+#ifdef USE_COREAUDIO_FOR_FILES
+
+ Source* src = new CoreAudioSource (s, path, chn, flags);
+ // boost_debug_shared_ptr_mark_interesting (src, "Source");
+ boost::shared_ptr<Source> ret (src);
+ if (setup_peakfile (ret, defer_peaks)) {
+ return boost::shared_ptr<Source>();
+ }
+ ret->check_for_analysis_data_on_disk ();
+ if (announce) {
+ SourceCreated (ret);
+ }
+ return ret;
+
+#else
+ throw; // rethrow
+#endif
+ }
+
+ } else {
+ // eh?
+ }
+
+ } else if (type == DataType::MIDI) {
+
+ Source* src = new SMFSource (s, path, SMFSource::Flag(0));
+ // boost_debug_shared_ptr_mark_interesting (src, "Source");
+ boost::shared_ptr<Source> ret (src);
+
+ if (announce) {
+ SourceCreated (ret);
+ }
+
+ return ret;
+