From 900309993c485527145be4265247bd521073ee61 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Mon, 16 Feb 2009 18:08:22 +0000 Subject: Move duplicated AudioFileSource::Flags and SMFSource::Flags into Source. Clean up source stuff. git-svn-id: svn://localhost/ardour2/branches/3.0@4605 d708f5d6-7413-0410-9779-e7cbd77b26cf --- libs/ardour/ardour/audiofilesource.h | 81 +++++++++++++----------------------- libs/ardour/ardour/audiosource.h | 27 ++++++------ libs/ardour/ardour/midi_source.h | 2 +- libs/ardour/ardour/smf_source.h | 13 +----- libs/ardour/ardour/sndfilesource.h | 2 +- libs/ardour/ardour/source.h | 18 +++++++- libs/ardour/ardour/source_factory.h | 20 +++++---- libs/ardour/audiofilesource.cc | 33 ++++++--------- libs/ardour/coreaudiosource.cc | 3 +- libs/ardour/enums.cc | 20 ++++----- libs/ardour/midi_source.cc | 4 +- libs/ardour/smf_source.cc | 4 +- libs/ardour/sndfilesource.cc | 29 ++++++------- libs/ardour/source.cc | 19 +++++---- libs/ardour/source_factory.cc | 16 +++---- 15 files changed, 137 insertions(+), 154 deletions(-) (limited to 'libs/ardour') diff --git a/libs/ardour/ardour/audiofilesource.h b/libs/ardour/ardour/audiofilesource.h index de388a06fc..249651c3cf 100644 --- a/libs/ardour/ardour/audiofilesource.h +++ b/libs/ardour/ardour/audiofilesource.h @@ -43,20 +43,11 @@ struct SoundFileInfo { class AudioFileSource : public AudioSource { public: - enum Flag { - Writable = 0x1, - CanRename = 0x2, - Broadcast = 0x4, - Removable = 0x8, - RemovableIfEmpty = 0x10, - RemoveAtDestroy = 0x20, - NoPeakFile = 0x40, - Destructive = 0x80 - }; - virtual ~AudioFileSource (); - bool set_name (const std::string& newname) { return (set_source_name(newname, destructive()) == 0); } + bool set_name (const std::string& newname) { + return (set_source_name(newname, destructive()) == 0); + } int set_source_name (Glib::ustring newname, bool destructive); Glib::ustring path() const { return _path; } @@ -78,7 +69,6 @@ class AudioFileSource : public AudioSource { /* this block of methods do nothing for regular file sources, but are significant for files used in destructive recording. */ - virtual nframes_t last_capture_start_frame() const { return 0; } virtual void mark_capture_start (nframes_t) {} virtual void mark_capture_end () {} @@ -93,7 +83,7 @@ class AudioFileSource : public AudioSource { static bool is_empty (Session&, Glib::ustring path); void mark_streaming_write_completed (); - void mark_take (Glib::ustring); + void mark_take (Glib::ustring); Glib::ustring take_id() const { return _take_id; } bool is_embedded() const { return _is_embedded; } @@ -105,54 +95,50 @@ class AudioFileSource : public AudioSource { int setup_peakfile (); - static sigc::signal HeaderPositionOffsetChanged; - XMLNode& get_state (); int set_state (const XMLNode&); - bool destructive() const { return (_flags & Destructive); } - virtual bool set_destructive (bool yn) { return false; } - bool can_truncate_peaks() const { return !destructive(); } - - Flag flags() const { return _flags; } + bool destructive() const { return (_flags & Destructive); } + virtual bool set_destructive (bool yn) { return false; } + bool can_truncate_peaks() const { return !destructive(); } + bool can_be_analysed() const { return _length > 0; } void mark_immutable (); - - /* this should really be protected, but C++ is getting stricter - and creating slots from protected member functions is starting - to cause issues. - */ - - virtual void handle_header_position_change () {} - - bool can_be_analysed() const { return _length > 0; } + + static sigc::signal HeaderPositionOffsetChanged; protected: - /* constructor to be called for existing external-to-session files */ - - AudioFileSource (Session&, Glib::ustring path, Flag flags); - - /* constructor to be called for new in-session files */ + /** Constructor to be called for existing external-to-session files */ + AudioFileSource (Session&, Glib::ustring path, Source::Flag flags); - AudioFileSource (Session&, Glib::ustring path, Flag flags, + /** Constructor to be called for new in-session files */ + AudioFileSource (Session&, Glib::ustring path, Source::Flag flags, SampleFormat samp_format, HeaderFormat hdr_format); - /* constructor to be called for existing in-session files */ - + /** Constructor to be called for existing in-session files */ AudioFileSource (Session&, const XMLNode&, bool must_exit = true); int init (Glib::ustring idstr, bool must_exist); + + static bool determine_embeddedness (Glib::ustring path); + + virtual void set_timeline_position (int64_t pos); + virtual void set_header_timeline_position () = 0; + virtual void handle_header_position_change () {} + + bool find (Glib::ustring& path, bool must_exist, bool& is_new, uint16_t& chan); + bool removable() const; + bool writable() const { return _flags & Writable; } + + static Sample* get_interleave_buffer (nframes_t size); Glib::ustring _path; - Flag _flags; Glib::ustring _take_id; - int64_t timeline_position; - bool file_is_new; + int64_t _timeline_position; + bool _file_is_new; uint16_t _channel; - bool _is_embedded; - static bool determine_embeddedness(Glib::ustring path); static Glib::ustring peak_dir; static Glib::ustring search_path; @@ -163,15 +149,6 @@ class AudioFileSource : public AudioSource { static uint64_t header_position_offset; - virtual void set_timeline_position (int64_t pos); - virtual void set_header_timeline_position () = 0; - - bool find (Glib::ustring& path, bool must_exist, bool& is_new, uint16_t& chan); - bool removable() const; - bool writable() const { return _flags & Writable; } - - static Sample* get_interleave_buffer (nframes_t size); - private: Glib::ustring old_peak_path (Glib::ustring audio_path); Glib::ustring broken_peak_path (Glib::ustring audio_path); diff --git a/libs/ardour/ardour/audiosource.h b/libs/ardour/ardour/audiosource.h index d11b829694..43273301b1 100644 --- a/libs/ardour/ardour/audiosource.h +++ b/libs/ardour/ardour/audiosource.h @@ -51,12 +51,11 @@ class AudioSource : public Source, public boost::enable_shared_from_this, sigc::connection&) const; @@ -126,7 +126,8 @@ class AudioSource : public Source, public boost::enable_shared_from_this class MidiRingBuffer; /** Standard Midi File (Type 0) Source */ class SMFSource : public MidiSource, public Evoral::SMF { public: - enum Flag { - Writable = 0x1, - CanRename = 0x2, - Broadcast = 0x4, - Removable = 0x8, - RemovableIfEmpty = 0x10, - RemoveAtDestroy = 0x20, - BuildPeaks = 0x40 - }; - /** Constructor for existing external-to-session files */ - SMFSource (Session& session, std::string path, Flag flags = Flag(0)); + SMFSource (Session& session, std::string path, Source::Flag flags = Source::Flag(0)); /* Constructor for existing in-session files */ SMFSource (Session& session, const XMLNode&); @@ -107,7 +97,6 @@ class SMFSource : public MidiSource, public Evoral::SMF { void set_default_controls_interpolation(); Glib::ustring _path; - Flag _flags; string _take_id; bool _allow_remove_if_empty; double _last_ev_time_beats; diff --git a/libs/ardour/ardour/sndfilesource.h b/libs/ardour/ardour/sndfilesource.h index b7c7a9daf1..acb03391a4 100644 --- a/libs/ardour/ardour/sndfilesource.h +++ b/libs/ardour/ardour/sndfilesource.h @@ -60,7 +60,7 @@ class SndFileSource : public AudioFileSource { bool one_of_several_channels () const; static void setup_standard_crossfades (nframes_t sample_rate); - static const AudioFileSource::Flag default_writable_flags; + static const Source::Flag default_writable_flags; static int get_soundfile_info (const Glib::ustring& path, SoundFileInfo& _info, string& error_msg); diff --git a/libs/ardour/ardour/source.h b/libs/ardour/ardour/source.h index b585509c51..137aad5fbe 100644 --- a/libs/ardour/ardour/source.h +++ b/libs/ardour/ardour/source.h @@ -40,7 +40,18 @@ class Playlist; class Source : public SessionObject, public ARDOUR::Readable { public: - Source (Session&, const std::string& name, DataType type); + enum Flag { + Writable = 0x1, + CanRename = 0x2, + Broadcast = 0x4, + Removable = 0x8, + RemovableIfEmpty = 0x10, + RemoveAtDestroy = 0x20, + NoPeakFile = 0x40, + Destructive = 0x80 + }; + + Source (Session&, const std::string& name, DataType type, Flag flags=Flag(0)); Source (Session&, const XMLNode&); virtual ~Source (); @@ -68,7 +79,7 @@ class Source : public SessionObject, public ARDOUR::Readable virtual bool destructive() const { return false; } virtual bool length_mutable() const { return false; } - void use () { _in_use++; } + void use () { _in_use++; } void disuse () { if (_in_use) { _in_use--; } } void add_playlist (boost::shared_ptr); @@ -95,9 +106,12 @@ class Source : public SessionObject, public ARDOUR::Readable virtual const Evoral::TimeConverter& time_converter() const { return Evoral::IdentityConverter(); } + + Flag flags() const { return _flags; } protected: DataType _type; + Flag _flags; time_t _timestamp; nframes_t _length; bool _analysed; diff --git a/libs/ardour/ardour/source_factory.h b/libs/ardour/ardour/source_factory.h index 7e9be451e8..5370ad845d 100644 --- a/libs/ardour/ardour/source_factory.h +++ b/libs/ardour/ardour/source_factory.h @@ -26,13 +26,13 @@ #include #include -#include class XMLNode; namespace ARDOUR { class Session; +class AudioSource; class SourceFactory { public: @@ -41,16 +41,18 @@ class SourceFactory { static sigc::signal > SourceCreated; static boost::shared_ptr create (Session&, const XMLNode& node, bool async = false); - static boost::shared_ptr createSilent (Session&, const XMLNode& node, nframes_t nframes, float sample_rate); + static boost::shared_ptr createSilent (Session&, const XMLNode& node, + nframes_t nframes, float sample_rate); - static boost::shared_ptr createReadable (DataType type, Session&, std::string path, int chn, AudioFileSource::Flag flags, - bool announce = true, bool async = false); - static boost::shared_ptr createWritable (DataType type, Session&, std::string name, bool destructive, nframes_t rate, - bool announce = true, bool async = false); + static boost::shared_ptr createReadable (DataType type, Session&, std::string path, + int chn, Source::Flag flags, bool announce = true, bool async = false); - static Glib::Cond* PeaksToBuild; - static Glib::StaticMutex peak_building_lock; - static std::list > files_with_peaks; + static boost::shared_ptr createWritable (DataType type, Session&, std::string name, + bool destructive, nframes_t rate, bool announce = true, bool async = false); + + static Glib::Cond* PeaksToBuild; + static Glib::StaticMutex peak_building_lock; + static std::list< boost::weak_ptr > files_with_peaks; static int setup_peakfile (boost::shared_ptr, bool async); }; diff --git a/libs/ardour/audiofilesource.cc b/libs/ardour/audiofilesource.cc index 9ac63c21fb..434b64e88d 100644 --- a/libs/ardour/audiofilesource.cc +++ b/libs/ardour/audiofilesource.cc @@ -87,9 +87,9 @@ struct SizedSampleBuffer { Glib::StaticPrivate thread_interleave_buffer = GLIBMM_STATIC_PRIVATE_INIT; /** Constructor used for existing internal-to-session files. File must exist. */ -AudioFileSource::AudioFileSource (Session& s, ustring path, Flag flags) - : AudioSource (s, path), _flags (flags), - _channel (0) +AudioFileSource::AudioFileSource (Session& s, ustring path, Source::Flag flags) + : AudioSource (s, path) + , _channel (0) { _is_embedded = AudioFileSource::determine_embeddedness (path); @@ -100,9 +100,10 @@ AudioFileSource::AudioFileSource (Session& s, ustring path, Flag flags) } /** Constructor used for new internal-to-session files. File cannot exist. */ -AudioFileSource::AudioFileSource (Session& s, ustring path, Flag flags, SampleFormat samp_format, HeaderFormat hdr_format) - : AudioSource (s, path), _flags (flags), - _channel (0) +AudioFileSource::AudioFileSource (Session& s, ustring path, Source::Flag flags, + SampleFormat samp_format, HeaderFormat hdr_format) + : AudioSource (s, path) + , _channel (0) { _is_embedded = false; @@ -113,7 +114,7 @@ AudioFileSource::AudioFileSource (Session& s, ustring path, Flag flags, SampleFo /** Constructor used for existing internal-to-session files. File must exist. */ AudioFileSource::AudioFileSource (Session& s, const XMLNode& node, bool must_exist) - : AudioSource (s, node), _flags (Flag (Writable|CanRename)) + : AudioSource (s, node) /* _channel is set in set_state() or init() */ { if (set_state (node)) { @@ -151,14 +152,14 @@ int AudioFileSource::init (ustring pathstr, bool must_exist) { _length = 0; - timeline_position = 0; + _timeline_position = 0; _peaks_built = false; - if (!find (pathstr, must_exist, file_is_new, _channel)) { + if (!find (pathstr, must_exist, _file_is_new, _channel)) { throw non_existent_source (); } - if (file_is_new && must_exist) { + if (_file_is_new && must_exist) { return -1; } @@ -273,7 +274,6 @@ AudioFileSource::get_state () { XMLNode& root (AudioSource::get_state()); char buf[32]; - root.add_property (X_("flags"), enum_2_string (_flags)); snprintf (buf, sizeof (buf), "%u", _channel); root.add_property (X_("channel"), buf); return root; @@ -288,13 +288,6 @@ AudioFileSource::set_state (const XMLNode& node) return -1; } - if ((prop = node.property (X_("flags"))) != 0) { - _flags = Flag (string_2_enum (prop->value(), _flags)); - } else { - _flags = Flag (0); - - } - if ((prop = node.property (X_("channel"))) != 0) { _channel = atoi (prop->value()); } else { @@ -614,7 +607,7 @@ AudioFileSource::set_header_position_offset (nframes_t offset) void AudioFileSource::set_timeline_position (int64_t pos) { - timeline_position = pos; + _timeline_position = pos; } void @@ -678,7 +671,7 @@ int AudioFileSource::setup_peakfile () { if (!(_flags & NoPeakFile)) { - return initialize_peakfile (file_is_new, _path); + return initialize_peakfile (_file_is_new, _path); } else { return 0; } diff --git a/libs/ardour/coreaudiosource.cc b/libs/ardour/coreaudiosource.cc index a6aceb7842..18b9a82ec6 100644 --- a/libs/ardour/coreaudiosource.cc +++ b/libs/ardour/coreaudiosource.cc @@ -45,7 +45,8 @@ CoreAudioSource::CoreAudioSource (Session& s, const XMLNode& node) CoreAudioSource::CoreAudioSource (Session& s, const string& path, int chn, Flag flags) /* files created this way are never writable or removable */ - : AudioFileSource (s, path, Flag (flags & ~(Writable|Removable|RemovableIfEmpty|RemoveAtDestroy))) + : AudioFileSource (s, path, + Source::Flag (flags & ~(Writable|Removable|RemovableIfEmpty|RemoveAtDestroy))) { _channel = chn; init (); diff --git a/libs/ardour/enums.cc b/libs/ardour/enums.cc index 0c307d0605..48a78fe508 100644 --- a/libs/ardour/enums.cc +++ b/libs/ardour/enums.cc @@ -83,7 +83,7 @@ setup_enum_writer () AutoConnectOption _AutoConnectOption; Session::StateOfTheState _Session_StateOfTheState; Route::Flag _Route_Flag; - AudioFileSource::Flag _AudioFileSource_Flag; + Source::Flag _Source_Flag; Diskstream::Flag _Diskstream_Flag; Location::Flags _Location_Flags; RouteGroup::Flag _RouteGroup_Flag; @@ -336,15 +336,15 @@ setup_enum_writer () REGISTER_CLASS_ENUM (Route, ControlOut); REGISTER_BITS (_Route_Flag); - REGISTER_CLASS_ENUM (AudioFileSource, Writable); - REGISTER_CLASS_ENUM (AudioFileSource, CanRename); - REGISTER_CLASS_ENUM (AudioFileSource, Broadcast); - REGISTER_CLASS_ENUM (AudioFileSource, Removable); - REGISTER_CLASS_ENUM (AudioFileSource, RemovableIfEmpty); - REGISTER_CLASS_ENUM (AudioFileSource, RemoveAtDestroy); - REGISTER_CLASS_ENUM (AudioFileSource, NoPeakFile); - REGISTER_CLASS_ENUM (AudioFileSource, Destructive); - REGISTER_BITS (_AudioFileSource_Flag); + REGISTER_CLASS_ENUM (Source, Writable); + REGISTER_CLASS_ENUM (Source, CanRename); + REGISTER_CLASS_ENUM (Source, Broadcast); + REGISTER_CLASS_ENUM (Source, Removable); + REGISTER_CLASS_ENUM (Source, RemovableIfEmpty); + REGISTER_CLASS_ENUM (Source, RemoveAtDestroy); + REGISTER_CLASS_ENUM (Source, NoPeakFile); + REGISTER_CLASS_ENUM (Source, Destructive); + REGISTER_BITS (_Source_Flag); REGISTER_CLASS_ENUM (AudioRegion, Linear); REGISTER_CLASS_ENUM (AudioRegion, Fast); diff --git a/libs/ardour/midi_source.cc b/libs/ardour/midi_source.cc index ece0d9b104..03208eda02 100644 --- a/libs/ardour/midi_source.cc +++ b/libs/ardour/midi_source.cc @@ -49,8 +49,8 @@ using namespace PBD; sigc::signal MidiSource::MidiSourceCreated; -MidiSource::MidiSource (Session& s, string name) - : Source (s, name, DataType::MIDI) +MidiSource::MidiSource (Session& s, string name, Source::Flag flags) + : Source (s, name, DataType::MIDI, flags) , _timeline_position(0) , _read_data_count(0) , _write_data_count(0) diff --git a/libs/ardour/smf_source.cc b/libs/ardour/smf_source.cc index ab0c290191..d87293faed 100644 --- a/libs/ardour/smf_source.cc +++ b/libs/ardour/smf_source.cc @@ -49,10 +49,9 @@ using namespace ARDOUR; string SMFSource::_search_path; /** Constructor used for new internal-to-session files. File cannot exist. */ -SMFSource::SMFSource(Session& s, std::string path, Flag flags) +SMFSource::SMFSource(Session& s, std::string path, Source::Flag flags) : MidiSource(s, region_name_from_path(path, false)) , Evoral::SMF() - , _flags(flags) , _allow_remove_if_empty(true) , _last_ev_time_beats(0.0) , _last_ev_time_frames(0) @@ -71,7 +70,6 @@ SMFSource::SMFSource(Session& s, std::string path, Flag flags) /** Constructor used for existing internal-to-session files. File must exist. */ SMFSource::SMFSource(Session& s, const XMLNode& node) : MidiSource(s, node) - , _flags(Flag(Writable|CanRename)) , _allow_remove_if_empty(true) , _last_ev_time_beats(0.0) , _last_ev_time_frames(0) diff --git a/libs/ardour/sndfilesource.cc b/libs/ardour/sndfilesource.cc index b35d36a713..8d89f2aa92 100644 --- a/libs/ardour/sndfilesource.cc +++ b/libs/ardour/sndfilesource.cc @@ -43,10 +43,11 @@ using Glib::ustring; gain_t* SndFileSource::out_coefficient = 0; gain_t* SndFileSource::in_coefficient = 0; nframes_t SndFileSource::xfade_frames = 64; -const AudioFileSource::Flag SndFileSource::default_writable_flags = AudioFileSource::Flag (AudioFileSource::Writable| - AudioFileSource::Removable| - AudioFileSource::RemovableIfEmpty| - AudioFileSource::CanRename); +const Source::Flag SndFileSource::default_writable_flags = Source::Flag ( + Source::Writable | + Source::Removable | + Source::RemovableIfEmpty | + Source::CanRename ); SndFileSource::SndFileSource (Session& s, const XMLNode& node) : AudioFileSource (s, node) @@ -82,7 +83,7 @@ SndFileSource::SndFileSource (Session& s, ustring path, SampleFormat sfmt, Heade existing ones. */ - file_is_new = true; + _file_is_new = true; switch (hf) { case CAF: @@ -187,7 +188,7 @@ SndFileSource::init () if (destructive()) { xfade_buf = new Sample[xfade_frames]; - timeline_position = header_position_offset; + _timeline_position = header_position_offset; } AudioFileSource::HeaderPositionOffsetChanged.connect (mem_fun (*this, &SndFileSource::handle_header_position_change)); @@ -405,7 +406,7 @@ SndFileSource::destructive_write_unlocked (Sample* data, nframes_t cnt) _capture_end = false; /* move to the correct location place */ - file_pos = capture_start_frame - timeline_position; + file_pos = capture_start_frame - _timeline_position; // split cnt in half nframes_t subcnt = cnt / 2; @@ -437,7 +438,7 @@ SndFileSource::destructive_write_unlocked (Sample* data, nframes_t cnt) _capture_end = false; /* move to the correct location place */ - file_pos = capture_start_frame - timeline_position; + file_pos = capture_start_frame - _timeline_position; if (crossfade (data, cnt, 1) != cnt) { return 0; @@ -539,7 +540,7 @@ SndFileSource::set_header_timeline_position () return; } - _broadcast_info->set_time_reference (timeline_position); + _broadcast_info->set_time_reference (_timeline_position); if (!_broadcast_info->write_to_file (sf)) { error << string_compose (_("cannot set broadcast info for audio file %1 (%2); dropping broadcast info for this file"), @@ -571,7 +572,7 @@ SndFileSource::write_float (Sample* data, nframes_t frame_pos, nframes_t cnt) nframes_t SndFileSource::natural_position() const { - return timeline_position; + return _timeline_position; } bool @@ -583,10 +584,10 @@ SndFileSource::set_destructive (bool yn) xfade_buf = new Sample[xfade_frames]; } clear_capture_marks (); - timeline_position = header_position_offset; + _timeline_position = header_position_offset; } else { _flags = Flag (_flags & ~Destructive); - timeline_position = 0; + _timeline_position = 0; /* leave xfade buf alone in case we need it again later */ } @@ -604,7 +605,7 @@ void SndFileSource::mark_capture_start (nframes_t pos) { if (destructive()) { - if (pos < timeline_position) { + if (pos < _timeline_position) { _capture_start = false; } else { _capture_start = true; @@ -762,7 +763,7 @@ SndFileSource::handle_header_position_change () error << string_compose(_("Filesource: start time is already set for existing file (%1): Cannot change start time."), _path ) << endmsg; //in the future, pop up a dialog here that allows user to regenerate file with new start offset } else if (writable()) { - timeline_position = header_position_offset; + _timeline_position = header_position_offset; set_header_timeline_position (); //this will get flushed if/when the file is recorded to } } diff --git a/libs/ardour/source.cc b/libs/ardour/source.cc index f08d08b86e..aaae432570 100644 --- a/libs/ardour/source.cc +++ b/libs/ardour/source.cc @@ -34,10 +34,11 @@ #include #include #include +#include -#include #include #include +#include #include #include "i18n.h" @@ -45,13 +46,11 @@ using namespace std; using namespace ARDOUR; -Source::Source (Session& s, const string& name, DataType type) +Source::Source (Session& s, const string& name, DataType type, Flag flags) : SessionObject(s, name) , _type(type) + , _flags(flags) { - // not true.. is this supposed to be an assertion? - //assert(_name.find("/") == string::npos); - _analysed = false; _timestamp = 0; _length = 0; @@ -61,6 +60,7 @@ Source::Source (Session& s, const string& name, DataType type) Source::Source (Session& s, const XMLNode& node) : SessionObject(s, "unnamed source") , _type(DataType::AUDIO) + , _flags (Flag (Writable|CanRename)) { _timestamp = 0; _length = 0; @@ -85,6 +85,7 @@ Source::get_state () node->add_property ("name", _name); node->add_property ("type", _type.to_string()); + node->add_property (X_("flags"), enum_2_string (_flags)); _id.print (buf, sizeof (buf)); node->add_property ("id", buf); @@ -121,8 +122,12 @@ Source::set_state (const XMLNode& node) sscanf (prop->value().c_str(), "%ld", &_timestamp); } - // Don't think this is valid, absolute paths fail - //assert(_name.find("/") == string::npos); + if ((prop = node.property (X_("flags"))) != 0) { + _flags = Flag (string_2_enum (prop->value(), _flags)); + } else { + _flags = Flag (0); + + } return 0; } diff --git a/libs/ardour/source_factory.cc b/libs/ardour/source_factory.cc index 4ada6b766c..2d2d6917bd 100644 --- a/libs/ardour/source_factory.cc +++ b/libs/ardour/source_factory.cc @@ -179,7 +179,7 @@ SourceFactory::create (Session& s, const XMLNode& node, bool defer_peaks) } boost::shared_ptr -SourceFactory::createReadable (DataType type, Session& s, string path, int chn, AudioFileSource::Flag flags, bool announce, bool defer_peaks) +SourceFactory::createReadable (DataType type, Session& s, string path, int chn, Source::Flag flags, bool announce, bool defer_peaks) { if (type == DataType::AUDIO) { @@ -244,13 +244,13 @@ SourceFactory::createWritable (DataType type, Session& s, std::string path, bool /* this might throw failed_constructor(), which is OK */ if (type == DataType::AUDIO) { - boost::shared_ptr ret (new SndFileSource - (s, path, - Config->get_native_file_data_format(), - Config->get_native_file_header_format(), - rate, - (destructive ? AudioFileSource::Flag (SndFileSource::default_writable_flags | AudioFileSource::Destructive) : - SndFileSource::default_writable_flags))); + boost::shared_ptr ret (new SndFileSource (s, path, + Config->get_native_file_data_format(), + Config->get_native_file_header_format(), + rate, + (destructive + ? Source::Flag (SndFileSource::default_writable_flags | Source::Destructive) + : SndFileSource::default_writable_flags))); if (setup_peakfile (ret, defer_peaks)) { return boost::shared_ptr(); -- cgit v1.2.3