+ }
+
+ return boost::shared_ptr<Source>();
+}
+
+boost::shared_ptr<Source>
+SourceFactory::createReadable (DataType type, Session& s, const string& path,
+ int chn, Source::Flag flags, bool announce, bool defer_peaks)
+{
+ 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