mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-19 21:26:26 +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> createForRecovery (DataType, Session&, const std::string& path, int chn);
|
||||||
|
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);
|
||||||
|
|
||||||
static boost::shared_ptr<Source> createExternal
|
static Glib::Threads::Cond PeaksToBuild;
|
||||||
(DataType type, Session&,
|
static Glib::Threads::Mutex peak_building_lock;
|
||||||
const std::string& path,
|
|
||||||
int chn, Source::Flag flags, bool announce = true, bool async = false);
|
|
||||||
|
|
||||||
static boost::shared_ptr<Source> createWritable
|
static std::list<boost::weak_ptr<AudioSource>> files_with_peaks;
|
||||||
(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::Mutex peak_building_lock;
|
|
||||||
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"
|
||||||
|
|
@ -51,10 +51,10 @@ using namespace ARDOUR;
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace PBD;
|
using namespace PBD;
|
||||||
|
|
||||||
PBD::Signal1<void,boost::shared_ptr<Source> > SourceFactory::SourceCreated;
|
PBD::Signal1<void, boost::shared_ptr<Source>> SourceFactory::SourceCreated;
|
||||||
Glib::Threads::Cond SourceFactory::PeaksToBuild;
|
Glib::Threads::Cond SourceFactory::PeaksToBuild;
|
||||||
Glib::Threads::Mutex SourceFactory::peak_building_lock;
|
Glib::Threads::Mutex SourceFactory::peak_building_lock;
|
||||||
std::list<boost::weak_ptr<AudioSource> > SourceFactory::files_with_peaks;
|
std::list<boost::weak_ptr<AudioSource>> SourceFactory::files_with_peaks;
|
||||||
|
|
||||||
static int active_threads = 0;
|
static int active_threads = 0;
|
||||||
|
|
||||||
|
|
@ -65,19 +65,18 @@ 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:
|
||||||
if (SourceFactory::files_with_peaks.empty()) {
|
if (SourceFactory::files_with_peaks.empty ()) {
|
||||||
SourceFactory::PeaksToBuild.wait (SourceFactory::peak_building_lock);
|
SourceFactory::PeaksToBuild.wait (SourceFactory::peak_building_lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (SourceFactory::files_with_peaks.empty()) {
|
if (SourceFactory::files_with_peaks.empty ()) {
|
||||||
goto wait;
|
goto wait;
|
||||||
}
|
}
|
||||||
|
|
||||||
boost::shared_ptr<AudioSource> as (SourceFactory::files_with_peaks.front().lock());
|
boost::shared_ptr<AudioSource> as (SourceFactory::files_with_peaks.front ().lock ());
|
||||||
SourceFactory::files_with_peaks.pop_front ();
|
SourceFactory::files_with_peaks.pop_front ();
|
||||||
++active_threads;
|
++active_threads;
|
||||||
SourceFactory::peak_building_lock.unlock ();
|
SourceFactory::peak_building_lock.unlock ();
|
||||||
|
|
@ -115,18 +114,15 @@ 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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -138,7 +134,7 @@ SourceFactory::setup_peakfile (boost::shared_ptr<Source> s, bool async)
|
||||||
boost::shared_ptr<Source>
|
boost::shared_ptr<Source>
|
||||||
SourceFactory::createSilent (Session& s, const XMLNode& node, samplecnt_t nframes, float sr)
|
SourceFactory::createSilent (Session& s, const XMLNode& node, samplecnt_t nframes, float sr)
|
||||||
{
|
{
|
||||||
Source* src = new SilentFileSource (s, node, nframes, sr);
|
Source* src = new SilentFileSource (s, node, nframes, sr);
|
||||||
boost::shared_ptr<Source> ret (src);
|
boost::shared_ptr<Source> ret (src);
|
||||||
BOOST_MARK_SOURCE (ret);
|
BOOST_MARK_SOURCE (ret);
|
||||||
// no analysis data - the file is non-existent
|
// no analysis data - the file is non-existent
|
||||||
|
|
@ -149,19 +145,17 @@ SourceFactory::createSilent (Session& s, const XMLNode& node, samplecnt_t nframe
|
||||||
boost::shared_ptr<Source>
|
boost::shared_ptr<Source>
|
||||||
SourceFactory::create (Session& s, const XMLNode& node, bool defer_peaks)
|
SourceFactory::create (Session& s, const XMLNode& node, bool defer_peaks)
|
||||||
{
|
{
|
||||||
DataType type = DataType::AUDIO;
|
DataType type = DataType::AUDIO;
|
||||||
XMLProperty const * prop = node.property("type");
|
XMLProperty const* prop = node.property ("type");
|
||||||
|
|
||||||
if (prop) {
|
if (prop) {
|
||||||
type = DataType (prop->value());
|
type = DataType (prop->value ());
|
||||||
}
|
}
|
||||||
|
|
||||||
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,9 +173,8 @@ 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);
|
||||||
BOOST_MARK_SOURCE (ret);
|
BOOST_MARK_SOURCE (ret);
|
||||||
if (setup_peakfile (ret, defer_peaks)) {
|
if (setup_peakfile (ret, defer_peaks)) {
|
||||||
|
|
@ -190,11 +183,12 @@ 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 {
|
||||||
Source* src = new CoreAudioSource (s, node);
|
Source* src = new CoreAudioSource (s, node);
|
||||||
boost::shared_ptr<Source> ret (src);
|
boost::shared_ptr<Source> ret (src);
|
||||||
BOOST_MARK_SOURCE (ret);
|
BOOST_MARK_SOURCE (ret);
|
||||||
|
|
||||||
|
|
@ -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 ();
|
||||||
|
|
@ -214,7 +209,7 @@ SourceFactory::create (Session& s, const XMLNode& node, bool defer_peaks)
|
||||||
} else if (type == DataType::MIDI) {
|
} else if (type == DataType::MIDI) {
|
||||||
try {
|
try {
|
||||||
boost::shared_ptr<SMFSource> src (new SMFSource (s, node));
|
boost::shared_ptr<SMFSource> src (new SMFSource (s, node));
|
||||||
Source::Lock lock(src->mutex());
|
Source::Lock lock (src->mutex ());
|
||||||
src->load_model (lock, true);
|
src->load_model (lock, true);
|
||||||
BOOST_MARK_SOURCE (src);
|
BOOST_MARK_SOURCE (src);
|
||||||
src->check_for_analysis_data_on_disk ();
|
src->check_for_analysis_data_on_disk ();
|
||||||
|
|
@ -229,12 +224,11 @@ SourceFactory::create (Session& s, const XMLNode& node, bool defer_peaks)
|
||||||
|
|
||||||
boost::shared_ptr<Source>
|
boost::shared_ptr<Source>
|
||||||
SourceFactory::createExternal (DataType type, Session& s, const string& path,
|
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);
|
||||||
BOOST_MARK_SOURCE (ret);
|
BOOST_MARK_SOURCE (ret);
|
||||||
if (setup_peakfile (ret, defer_peaks)) {
|
if (setup_peakfile (ret, defer_peaks)) {
|
||||||
|
|
@ -245,11 +239,12 @@ 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 {
|
||||||
Source* src = new CoreAudioSource (s, path, chn, flags);
|
Source* src = new CoreAudioSource (s, path, chn, flags);
|
||||||
boost::shared_ptr<Source> ret (src);
|
boost::shared_ptr<Source> ret (src);
|
||||||
BOOST_MARK_SOURCE (ret);
|
BOOST_MARK_SOURCE (ret);
|
||||||
if (setup_peakfile (ret, defer_peaks)) {
|
if (setup_peakfile (ret, defer_peaks)) {
|
||||||
|
|
@ -260,33 +255,35 @@ 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 */
|
||||||
if (!announce && (!AudioFileSource::get_build_peakfiles () || defer_peaks)) {
|
if (!announce && (!AudioFileSource::get_build_peakfiles () || defer_peaks)) {
|
||||||
try {
|
try {
|
||||||
Source* src = new Mp3FileSource (s, path, chn, flags);
|
Source* src = new Mp3FileSource (s, path, chn, flags);
|
||||||
boost::shared_ptr<Source> ret (src);
|
boost::shared_ptr<Source> ret (src);
|
||||||
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);
|
||||||
boost::shared_ptr<Source> ret (src);
|
boost::shared_ptr<Source> ret (src);
|
||||||
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 ());
|
||||||
src->load_model (lock, true);
|
src->load_model (lock, true);
|
||||||
BOOST_MARK_SOURCE (src);
|
BOOST_MARK_SOURCE (src);
|
||||||
|
|
||||||
|
|
@ -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 ();
|
||||||
|
|
@ -305,16 +301,16 @@ SourceFactory::createExternal (DataType type, Session& s, const string& path,
|
||||||
|
|
||||||
boost::shared_ptr<Source>
|
boost::shared_ptr<Source>
|
||||||
SourceFactory::createWritable (DataType type, Session& s, const std::string& path,
|
SourceFactory::createWritable (DataType type, Session& s, const std::string& path,
|
||||||
samplecnt_t rate, bool announce, bool defer_peaks)
|
samplecnt_t rate, bool announce, bool defer_peaks)
|
||||||
{
|
{
|
||||||
/* this might throw failed_constructor(), which is OK */
|
/* this might throw failed_constructor(), which is OK */
|
||||||
|
|
||||||
if (type == DataType::AUDIO) {
|
if (type == DataType::AUDIO) {
|
||||||
Source* src = new SndFileSource (s, path, string(),
|
Source* src = new SndFileSource (s, path, string (),
|
||||||
s.config.get_native_file_data_format(),
|
s.config.get_native_file_data_format (),
|
||||||
s.config.get_native_file_header_format(),
|
s.config.get_native_file_header_format (),
|
||||||
rate,
|
rate,
|
||||||
SndFileSource::default_writable_flags);
|
SndFileSource::default_writable_flags);
|
||||||
boost::shared_ptr<Source> ret (src);
|
boost::shared_ptr<Source> ret (src);
|
||||||
BOOST_MARK_SOURCE (ret);
|
BOOST_MARK_SOURCE (ret);
|
||||||
|
|
||||||
|
|
@ -330,13 +326,13 @@ SourceFactory::createWritable (DataType type, Session& s, const std::string& pat
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
} else if (type == DataType::MIDI) {
|
} else if (type == DataType::MIDI) {
|
||||||
// XXX writable flags should belong to MidiSource too
|
// XXX writable flags should belong to MidiSource too
|
||||||
try {
|
try {
|
||||||
boost::shared_ptr<SMFSource> src (new SMFSource (s, path, SndFileSource::default_writable_flags));
|
boost::shared_ptr<SMFSource> src (new SMFSource (s, path, SndFileSource::default_writable_flags));
|
||||||
|
|
||||||
assert (src->writable ());
|
assert (src->writable ());
|
||||||
|
|
||||||
Source::Lock lock(src->mutex());
|
Source::Lock lock (src->mutex ());
|
||||||
src->load_model (lock, true);
|
src->load_model (lock, true);
|
||||||
BOOST_MARK_SOURCE (src);
|
BOOST_MARK_SOURCE (src);
|
||||||
|
|
||||||
|
|
@ -388,21 +384,19 @@ SourceFactory::createForRecovery (DataType type, Session& s, const std::string&
|
||||||
|
|
||||||
boost::shared_ptr<Source>
|
boost::shared_ptr<Source>
|
||||||
SourceFactory::createFromPlaylist (DataType type, Session& s, boost::shared_ptr<Playlist> p, const PBD::ID& orig, const std::string& name,
|
SourceFactory::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)
|
uint32_t chn, timepos_t start, timepos_t const& len, bool copy, bool defer_peaks)
|
||||||
{
|
{
|
||||||
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
Source* src = new AudioPlaylistSource (s, orig, name, ap, chn, start, len, Source::Flag (0));
|
Source* src = new AudioPlaylistSource (s, orig, name, ap, chn, start, len, Source::Flag (0));
|
||||||
boost::shared_ptr<Source> ret (src);
|
boost::shared_ptr<Source> ret (src);
|
||||||
|
|
||||||
if (setup_peakfile (ret, defer_peaks)) {
|
if (setup_peakfile (ret, defer_peaks)) {
|
||||||
|
|
@ -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