mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-20 05:36:31 +01:00
NO-OP: cleanup and lang-format
This commit is contained in:
parent
370adfa322
commit
183f00bbed
2 changed files with 69 additions and 91 deletions
|
|
@ -20,58 +20,43 @@
|
||||||
#ifndef __ardour_source_factory_h__
|
#ifndef __ardour_source_factory_h__
|
||||||
#define __ardour_source_factory_h__
|
#define __ardour_source_factory_h__
|
||||||
|
|
||||||
#include <string>
|
|
||||||
#include <stdint.h>
|
|
||||||
#include <boost/shared_ptr.hpp>
|
#include <boost/shared_ptr.hpp>
|
||||||
|
#include <stdint.h>
|
||||||
#include <glibmm/threads.h>
|
#include <string>
|
||||||
|
|
||||||
#include "ardour/source.h"
|
#include "ardour/source.h"
|
||||||
|
|
||||||
class XMLNode;
|
class XMLNode;
|
||||||
|
|
||||||
namespace ARDOUR {
|
namespace ARDOUR
|
||||||
|
{
|
||||||
class Session;
|
class Session;
|
||||||
class AudioSource;
|
class AudioSource;
|
||||||
class Playlist;
|
class Playlist;
|
||||||
|
|
||||||
class LIBARDOUR_API SourceFactory {
|
class LIBARDOUR_API SourceFactory
|
||||||
|
{
|
||||||
public:
|
public:
|
||||||
static void init ();
|
static void init ();
|
||||||
|
|
||||||
static PBD::Signal1<void, boost::shared_ptr<Source>> SourceCreated;
|
static PBD::Signal1<void, boost::shared_ptr<Source>> SourceCreated;
|
||||||
|
|
||||||
static boost::shared_ptr<Source> create (Session&, const XMLNode& node, bool async = false);
|
static boost::shared_ptr<Source> create (Session&, const XMLNode& node, bool async = false);
|
||||||
static boost::shared_ptr<Source> createSilent (Session&, const XMLNode& node,
|
static boost::shared_ptr<Source> createSilent (Session&, const XMLNode& node, samplecnt_t, float sample_rate);
|
||||||
samplecnt_t nframes, float sample_rate);
|
static boost::shared_ptr<Source> createExternal (DataType, Session&, const std::string& path, int chn, Source::Flag, bool announce = true, bool async = false);
|
||||||
|
static boost::shared_ptr<Source> createWritable (DataType, Session&, const std::string& path, samplecnt_t rate, bool announce = true, bool async = false);
|
||||||
static boost::shared_ptr<Source> createExternal
|
static boost::shared_ptr<Source> createForRecovery (DataType, Session&, const std::string& path, int chn);
|
||||||
(DataType type, Session&,
|
static boost::shared_ptr<Source> createFromPlaylist (DataType, Session&, boost::shared_ptr<Playlist> p, const PBD::ID& orig, const std::string& name, uint32_t chn, timepos_t start, timepos_t const& len, bool copy, bool defer_peaks);
|
||||||
const std::string& path,
|
|
||||||
int chn, Source::Flag flags, bool announce = true, bool async = false);
|
|
||||||
|
|
||||||
static boost::shared_ptr<Source> createWritable
|
|
||||||
(DataType type, Session&,
|
|
||||||
const std::string& path,
|
|
||||||
samplecnt_t rate, bool announce = true, bool async = false);
|
|
||||||
|
|
||||||
|
|
||||||
static boost::shared_ptr<Source> createForRecovery
|
|
||||||
(DataType type, Session&, const std::string& path, int chn);
|
|
||||||
|
|
||||||
static boost::shared_ptr<Source> createFromPlaylist
|
|
||||||
(DataType type, Session& s, boost::shared_ptr<Playlist> p, const PBD::ID& orig, const std::string& name,
|
|
||||||
uint32_t chn, timepos_t start, timepos_t const & len, bool copy, bool defer_peaks);
|
|
||||||
|
|
||||||
static Glib::Threads::Cond PeaksToBuild;
|
static Glib::Threads::Cond PeaksToBuild;
|
||||||
static Glib::Threads::Mutex peak_building_lock;
|
static Glib::Threads::Mutex peak_building_lock;
|
||||||
|
|
||||||
static std::list<boost::weak_ptr<AudioSource>> files_with_peaks;
|
static std::list<boost::weak_ptr<AudioSource>> files_with_peaks;
|
||||||
|
|
||||||
static int peak_work_queue_length ();
|
static int peak_work_queue_length ();
|
||||||
static int setup_peakfile (boost::shared_ptr<Source>, bool async);
|
static int setup_peakfile (boost::shared_ptr<Source>, bool async);
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
} // namespace ARDOUR
|
||||||
|
|
||||||
#endif /* __ardour_source_factory_h__ */
|
#endif /* __ardour_source_factory_h__ */
|
||||||
|
|
|
||||||
|
|
@ -24,22 +24,22 @@
|
||||||
#include "libardour-config.h"
|
#include "libardour-config.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "pbd/error.h"
|
|
||||||
#include "pbd/convert.h"
|
#include "pbd/convert.h"
|
||||||
|
#include "pbd/error.h"
|
||||||
#include "pbd/pthread_utils.h"
|
#include "pbd/pthread_utils.h"
|
||||||
|
|
||||||
#include "ardour/audioplaylist.h"
|
|
||||||
#include "ardour/audio_playlist_source.h"
|
#include "ardour/audio_playlist_source.h"
|
||||||
|
#include "ardour/audioplaylist.h"
|
||||||
#include "ardour/boost_debug.h"
|
#include "ardour/boost_debug.h"
|
||||||
#include "ardour/ffmpegfilesource.h"
|
#include "ardour/ffmpegfilesource.h"
|
||||||
#include "ardour/midi_playlist.h"
|
#include "ardour/midi_playlist.h"
|
||||||
#include "ardour/mp3filesource.h"
|
#include "ardour/mp3filesource.h"
|
||||||
#include "ardour/source.h"
|
#include "ardour/session.h"
|
||||||
#include "ardour/source_factory.h"
|
|
||||||
#include "ardour/sndfilesource.h"
|
|
||||||
#include "ardour/silentfilesource.h"
|
#include "ardour/silentfilesource.h"
|
||||||
#include "ardour/smf_source.h"
|
#include "ardour/smf_source.h"
|
||||||
#include "ardour/session.h"
|
#include "ardour/sndfilesource.h"
|
||||||
|
#include "ardour/source.h"
|
||||||
|
#include "ardour/source_factory.h"
|
||||||
|
|
||||||
#ifdef HAVE_COREAUDIO
|
#ifdef HAVE_COREAUDIO
|
||||||
#include "ardour/coreaudiosource.h"
|
#include "ardour/coreaudiosource.h"
|
||||||
|
|
@ -65,7 +65,6 @@ peak_thread_work ()
|
||||||
pthread_set_name ("PeakFileBuilder");
|
pthread_set_name ("PeakFileBuilder");
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
|
|
||||||
SourceFactory::peak_building_lock.lock ();
|
SourceFactory::peak_building_lock.lock ();
|
||||||
|
|
||||||
wait:
|
wait:
|
||||||
|
|
@ -115,16 +114,13 @@ SourceFactory::setup_peakfile (boost::shared_ptr<Source> s, bool async)
|
||||||
boost::shared_ptr<AudioSource> as (boost::dynamic_pointer_cast<AudioSource> (s));
|
boost::shared_ptr<AudioSource> as (boost::dynamic_pointer_cast<AudioSource> (s));
|
||||||
|
|
||||||
if (as) {
|
if (as) {
|
||||||
|
|
||||||
// immediately set 'peakfile-path' for empty and NoPeakFile sources
|
// immediately set 'peakfile-path' for empty and NoPeakFile sources
|
||||||
if (async && !as->empty () && !(as->flags () & Source::NoPeakFile)) {
|
if (async && !as->empty () && !(as->flags () & Source::NoPeakFile)) {
|
||||||
|
|
||||||
Glib::Threads::Mutex::Lock lm (peak_building_lock);
|
Glib::Threads::Mutex::Lock lm (peak_building_lock);
|
||||||
files_with_peaks.push_back (boost::weak_ptr<AudioSource> (as));
|
files_with_peaks.push_back (boost::weak_ptr<AudioSource> (as));
|
||||||
PeaksToBuild.broadcast ();
|
PeaksToBuild.broadcast ();
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
if (as->setup_peakfile ()) {
|
if (as->setup_peakfile ()) {
|
||||||
error << string_compose ("SourceFactory: could not set up peakfile for %1", as->name ()) << endmsg;
|
error << string_compose ("SourceFactory: could not set up peakfile for %1", as->name ()) << endmsg;
|
||||||
return -1;
|
return -1;
|
||||||
|
|
@ -157,11 +153,9 @@ SourceFactory::create (Session& s, const XMLNode& node, bool defer_peaks)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (type == DataType::AUDIO) {
|
if (type == DataType::AUDIO) {
|
||||||
|
|
||||||
/* it could be nested */
|
/* it could be nested */
|
||||||
|
|
||||||
if (node.property ("playlist") != 0) {
|
if (node.property ("playlist") != 0) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
boost::shared_ptr<AudioPlaylistSource> ap (new AudioPlaylistSource (s, node));
|
boost::shared_ptr<AudioPlaylistSource> ap (new AudioPlaylistSource (s, node));
|
||||||
|
|
||||||
|
|
@ -179,7 +173,6 @@ SourceFactory::create (Session& s, const XMLNode& node, bool defer_peaks)
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Source* src = new SndFileSource (s, node);
|
Source* src = new SndFileSource (s, node);
|
||||||
boost::shared_ptr<Source> ret (src);
|
boost::shared_ptr<Source> ret (src);
|
||||||
|
|
@ -190,7 +183,8 @@ SourceFactory::create (Session& s, const XMLNode& node, bool defer_peaks)
|
||||||
ret->check_for_analysis_data_on_disk ();
|
ret->check_for_analysis_data_on_disk ();
|
||||||
SourceCreated (ret);
|
SourceCreated (ret);
|
||||||
return ret;
|
return ret;
|
||||||
} catch (failed_constructor& err) { }
|
} catch (failed_constructor& err) {
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef HAVE_COREAUDIO
|
#ifdef HAVE_COREAUDIO
|
||||||
try {
|
try {
|
||||||
|
|
@ -205,7 +199,8 @@ SourceFactory::create (Session& s, const XMLNode& node, bool defer_peaks)
|
||||||
ret->check_for_analysis_data_on_disk ();
|
ret->check_for_analysis_data_on_disk ();
|
||||||
SourceCreated (ret);
|
SourceCreated (ret);
|
||||||
return ret;
|
return ret;
|
||||||
} catch (...) { }
|
} catch (...) {
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
/* this is allowed to throw */
|
/* this is allowed to throw */
|
||||||
throw failed_constructor ();
|
throw failed_constructor ();
|
||||||
|
|
@ -232,7 +227,6 @@ SourceFactory::createExternal (DataType type, Session& s, const string& path,
|
||||||
int chn, Source::Flag flags, bool announce, bool defer_peaks)
|
int chn, Source::Flag flags, bool announce, bool defer_peaks)
|
||||||
{
|
{
|
||||||
if (type == DataType::AUDIO) {
|
if (type == DataType::AUDIO) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Source* src = new SndFileSource (s, path, chn, flags);
|
Source* src = new SndFileSource (s, path, chn, flags);
|
||||||
boost::shared_ptr<Source> ret (src);
|
boost::shared_ptr<Source> ret (src);
|
||||||
|
|
@ -245,7 +239,8 @@ SourceFactory::createExternal (DataType type, Session& s, const string& path,
|
||||||
SourceCreated (ret);
|
SourceCreated (ret);
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
} catch (failed_constructor& err) { }
|
} catch (failed_constructor& err) {
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef HAVE_COREAUDIO
|
#ifdef HAVE_COREAUDIO
|
||||||
try {
|
try {
|
||||||
|
|
@ -260,7 +255,8 @@ SourceFactory::createExternal (DataType type, Session& s, const string& path,
|
||||||
SourceCreated (ret);
|
SourceCreated (ret);
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
} catch (...) { }
|
} catch (...) {
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* only create mp3s for audition: no announce, no peaks */
|
/* only create mp3s for audition: no announce, no peaks */
|
||||||
|
|
@ -271,7 +267,8 @@ SourceFactory::createExternal (DataType type, Session& s, const string& path,
|
||||||
BOOST_MARK_SOURCE (ret);
|
BOOST_MARK_SOURCE (ret);
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
} catch (failed_constructor& err) { }
|
} catch (failed_constructor& err) {
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Source* src = new FFMPEGFileSource (s, path, chn, flags);
|
Source* src = new FFMPEGFileSource (s, path, chn, flags);
|
||||||
|
|
@ -279,11 +276,11 @@ SourceFactory::createExternal (DataType type, Session& s, const string& path,
|
||||||
BOOST_MARK_SOURCE (ret);
|
BOOST_MARK_SOURCE (ret);
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
} catch (failed_constructor& err) { }
|
} catch (failed_constructor& err) {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (type == DataType::MIDI) {
|
} else if (type == DataType::MIDI) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
boost::shared_ptr<SMFSource> src (new SMFSource (s, path));
|
boost::shared_ptr<SMFSource> src (new SMFSource (s, path));
|
||||||
Source::Lock lock (src->mutex ());
|
Source::Lock lock (src->mutex ());
|
||||||
|
|
@ -297,7 +294,6 @@ SourceFactory::createExternal (DataType type, Session& s, const string& path,
|
||||||
return src;
|
return src;
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
throw failed_constructor ();
|
throw failed_constructor ();
|
||||||
|
|
@ -392,11 +388,9 @@ SourceFactory::createFromPlaylist (DataType type, Session& s, boost::shared_ptr<
|
||||||
{
|
{
|
||||||
if (type == DataType::AUDIO) {
|
if (type == DataType::AUDIO) {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
boost::shared_ptr<AudioPlaylist> ap = boost::dynamic_pointer_cast<AudioPlaylist> (p);
|
boost::shared_ptr<AudioPlaylist> ap = boost::dynamic_pointer_cast<AudioPlaylist> (p);
|
||||||
|
|
||||||
if (ap) {
|
if (ap) {
|
||||||
|
|
||||||
if (copy) {
|
if (copy) {
|
||||||
ap.reset (new AudioPlaylist (ap, start, len, name, true));
|
ap.reset (new AudioPlaylist (ap, start, len, name, true));
|
||||||
start = timecnt_t::zero (Temporal::AudioTime);
|
start = timecnt_t::zero (Temporal::AudioTime);
|
||||||
|
|
@ -420,7 +414,6 @@ SourceFactory::createFromPlaylist (DataType type, Session& s, boost::shared_ptr<
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (type == DataType::MIDI) {
|
} else if (type == DataType::MIDI) {
|
||||||
|
|
||||||
/* fail - not implemented, and probably too difficult to do */
|
/* fail - not implemented, and probably too difficult to do */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue