X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=libs%2Fardour%2Fsource_factory.cc;h=a0d0edc333787a865753404966349e26e602bfe6;hb=5a3a2fad4fd1c217a5771caa64efe92a0b305275;hp=deb7e8b8e259cec04b00eb874cca10a50fd77957;hpb=6299560116cb1e024f214f4928aa88605a5cddff;p=ardour.git diff --git a/libs/ardour/source_factory.cc b/libs/ardour/source_factory.cc index deb7e8b8e2..a0d0edc333 100644 --- a/libs/ardour/source_factory.cc +++ b/libs/ardour/source_factory.cc @@ -30,12 +30,15 @@ #include #include -#undef USE_COREAUDIO_FOR_FILES +#ifdef HAVE_COREAUDIO +#define USE_COREAUDIO_FOR_FILES +#endif #ifdef USE_COREAUDIO_FOR_FILES #include #endif + #include "i18n.h" using namespace ARDOUR; @@ -51,7 +54,7 @@ std::list > SourceFactory::files_with_peaks; static void peak_thread_work () { - PBD::ThreadCreated (pthread_self(), string ("peakbuilder-") + to_string (pthread_self(), std::dec)); + PBD::notify_gui_about_thread_creation (pthread_self(), string ("peakbuilder-") + to_string (pthread_self(), std::dec)); while (true) { @@ -73,6 +76,7 @@ peak_thread_work () if (!as) { continue; } + as->setup_peakfile (); } } @@ -121,12 +125,11 @@ SourceFactory::createSilent (Session& s, const XMLNode& node, nframes_t nframes, return ret; } -#ifdef USE_COREAUDIO_FOR_FILES boost::shared_ptr SourceFactory::create (Session& s, const XMLNode& node, bool defer_peaks) { try { - boost::shared_ptr ret (new CoreAudioSource (s, node)); + boost::shared_ptr ret (new SndFileSource (s, node)); if (setup_peakfile (ret, defer_peaks)) { return boost::shared_ptr(); } @@ -138,47 +141,34 @@ SourceFactory::create (Session& s, const XMLNode& node, bool defer_peaks) catch (failed_constructor& err) { +#ifdef USE_COREAUDIO_FOR_FILES + /* this is allowed to throw */ - boost::shared_ptr ret (new SndFileSource (s, node)); + boost::shared_ptr ret (new CoreAudioSource (s, node)); if (setup_peakfile (ret, defer_peaks)) { return boost::shared_ptr(); } ret->check_for_analysis_data_on_disk (); SourceCreated (ret); return ret; - } - - return boost::shared_ptr(); -} - #else + throw; // rethrow +#endif -boost::shared_ptr -SourceFactory::create (Session& s, const XMLNode& node, bool defer_peaks) -{ - /* this is allowed to throw */ - - boost::shared_ptr ret (new SndFileSource (s, node)); - - if (setup_peakfile (ret, defer_peaks)) { - return boost::shared_ptr(); } - ret->check_for_analysis_data_on_disk (); - SourceCreated (ret); - return ret; -} -#endif // USE_COREAUDIO_FOR_FILES + return boost::shared_ptr(); // keep stupid gcc happy +} -#ifdef USE_COREAUDIO_FOR_FILES boost::shared_ptr SourceFactory::createReadable (Session& s, string path, int chn, AudioFileSource::Flag flags, bool announce, bool defer_peaks) { if (!(flags & Destructive)) { try { - boost::shared_ptr ret (new CoreAudioSource (s, path, chn, flags)); + + boost::shared_ptr ret (new SndFileSource (s, path, chn, flags)); if (setup_peakfile (ret, defer_peaks)) { return boost::shared_ptr(); } @@ -193,7 +183,9 @@ SourceFactory::createReadable (Session& s, string path, int chn, AudioFileSource /* this is allowed to throw */ - boost::shared_ptr ret (new SndFileSource (s, path, chn, flags)); +#ifdef USE_COREAUDIO_FOR_FILES + + boost::shared_ptr ret (new CoreAudioSource (s, path, chn, flags)); if (setup_peakfile (ret, defer_peaks)) { return boost::shared_ptr(); } @@ -202,46 +194,19 @@ SourceFactory::createReadable (Session& s, string path, int chn, AudioFileSource SourceCreated (ret); } return ret; + +#else + throw; // rethrow +#endif } } else { - boost::shared_ptr ret (new SndFileSource (s, path, chn, flags)); - if (setup_peakfile (ret, defer_peaks)) { - return boost::shared_ptr(); - } - ret->check_for_analysis_data_on_disk (); - if (announce) { - SourceCreated (ret); - } - return ret; } return boost::shared_ptr(); } -#else - -boost::shared_ptr -SourceFactory::createReadable (Session& s, string path, int chn, AudioFileSource::Flag flags, bool announce, bool defer_peaks) -{ - boost::shared_ptr ret (new SndFileSource (s, path, chn, flags)); - - if (setup_peakfile (ret, defer_peaks)) { - return boost::shared_ptr(); - } - - ret->check_for_analysis_data_on_disk (); - - if (announce) { - SourceCreated (ret); - } - - return ret; -} - -#endif // USE_COREAUDIO_FOR_FILES - boost::shared_ptr SourceFactory::createWritable (Session& s, std::string path, bool destructive, nframes_t rate, bool announce, bool defer_peaks) {