#include <pbd/error.h>
#include <pbd/convert.h>
#include <pbd/pthread_utils.h>
+#include <pbd/stacktrace.h>
#include <ardour/source_factory.h>
#include <ardour/sndfilesource.h>
#include <ardour/silentfilesource.h>
#include <ardour/configuration.h>
-#undef USE_COREAUDIO_FOR_FILES
+#ifdef HAVE_COREAUDIO
+#define USE_COREAUDIO_FOR_FILES
+#endif
#ifdef USE_COREAUDIO_FOR_FILES
#include <ardour/coreaudiosource.h>
#endif
+
#include "i18n.h"
using namespace ARDOUR;
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) {
if (!as) {
continue;
}
+
as->setup_peakfile ();
}
}
return ret;
}
-#ifdef USE_COREAUDIO_FOR_FILES
boost::shared_ptr<Source>
SourceFactory::create (Session& s, const XMLNode& node, bool defer_peaks)
{
try {
- boost::shared_ptr<Source> ret (new CoreAudioSource (s, node));
+ boost::shared_ptr<Source> ret (new SndFileSource (s, node));
if (setup_peakfile (ret, defer_peaks)) {
return boost::shared_ptr<Source>();
}
catch (failed_constructor& err) {
+#ifdef USE_COREAUDIO_FOR_FILES
+
/* this is allowed to throw */
- boost::shared_ptr<Source> ret (new SndFileSource (s, node));
+ boost::shared_ptr<Source> ret (new CoreAudioSource (s, node));
if (setup_peakfile (ret, defer_peaks)) {
return boost::shared_ptr<Source>();
}
ret->check_for_analysis_data_on_disk ();
SourceCreated (ret);
return ret;
- }
-
- return boost::shared_ptr<Source>();
-}
-
#else
+ throw; // rethrow
+#endif
-boost::shared_ptr<Source>
-SourceFactory::create (Session& s, const XMLNode& node, bool defer_peaks)
-{
- /* this is allowed to throw */
-
- boost::shared_ptr<Source> ret (new SndFileSource (s, node));
-
- if (setup_peakfile (ret, defer_peaks)) {
- return boost::shared_ptr<Source>();
}
- ret->check_for_analysis_data_on_disk ();
- SourceCreated (ret);
- return ret;
-}
-#endif // USE_COREAUDIO_FOR_FILES
+ return boost::shared_ptr<Source>(); // keep stupid gcc happy
+}
-#ifdef USE_COREAUDIO_FOR_FILES
boost::shared_ptr<Source>
SourceFactory::createReadable (Session& s, string path, int chn, AudioFileSource::Flag flags, bool announce, bool defer_peaks)
{
if (!(flags & Destructive)) {
try {
- boost::shared_ptr<Source> ret (new CoreAudioSource (s, path, chn, flags));
+
+ boost::shared_ptr<Source> ret (new SndFileSource (s, path, chn, flags));
if (setup_peakfile (ret, defer_peaks)) {
return boost::shared_ptr<Source>();
}
/* this is allowed to throw */
- boost::shared_ptr<Source> ret (new SndFileSource (s, path, chn, flags));
+#ifdef USE_COREAUDIO_FOR_FILES
+
+ boost::shared_ptr<Source> ret (new CoreAudioSource (s, path, chn, flags));
if (setup_peakfile (ret, defer_peaks)) {
return boost::shared_ptr<Source>();
}
SourceCreated (ret);
}
return ret;
+
+#else
+ throw; // rethrow
+#endif
}
} else {
- boost::shared_ptr<Source> ret (new SndFileSource (s, path, chn, flags));
- if (setup_peakfile (ret, defer_peaks)) {
- return boost::shared_ptr<Source>();
- }
- ret->check_for_analysis_data_on_disk ();
- if (announce) {
- SourceCreated (ret);
- }
- return ret;
}
return boost::shared_ptr<Source>();
}
-#else
-
-boost::shared_ptr<Source>
-SourceFactory::createReadable (Session& s, string path, int chn, AudioFileSource::Flag flags, bool announce, bool defer_peaks)
-{
- boost::shared_ptr<Source> ret (new SndFileSource (s, path, chn, flags));
-
- if (setup_peakfile (ret, defer_peaks)) {
- return boost::shared_ptr<Source>();
- }
-
- ret->check_for_analysis_data_on_disk ();
-
- if (announce) {
- SourceCreated (ret);
- }
-
- return ret;
-}
-
-#endif // USE_COREAUDIO_FOR_FILES
-
boost::shared_ptr<Source>
SourceFactory::createWritable (Session& s, std::string path, bool destructive, nframes_t rate, bool announce, bool defer_peaks)
{