diff options
Diffstat (limited to 'libs/ardour/ardour')
-rw-r--r-- | libs/ardour/ardour/audio_playlist_source.h | 72 | ||||
-rw-r--r-- | libs/ardour/ardour/audiosource.h | 8 | ||||
-rw-r--r-- | libs/ardour/ardour/file_source.h | 2 | ||||
-rw-r--r-- | libs/ardour/ardour/session.h | 7 | ||||
-rw-r--r-- | libs/ardour/ardour/source.h | 2 | ||||
-rw-r--r-- | libs/ardour/ardour/source_factory.h | 21 |
6 files changed, 94 insertions, 18 deletions
diff --git a/libs/ardour/ardour/audio_playlist_source.h b/libs/ardour/ardour/audio_playlist_source.h new file mode 100644 index 0000000000..d6047de1fc --- /dev/null +++ b/libs/ardour/ardour/audio_playlist_source.h @@ -0,0 +1,72 @@ +/* + Copyright (C) 2011 Paul Davis + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +*/ + +#ifndef __ardour_audio_playlist_source_h__ +#define __ardour_audio_playlist_source_h__ + +#include <string> + +#include <boost/shared_ptr.hpp> + +#include "ardour/ardour.h" +#include "ardour/audiosource.h" + +namespace ARDOUR { + +class AudioPlaylist; + +class AudioPlaylistSource : public AudioSource { + public: + virtual ~AudioPlaylistSource (); + + bool empty() const; + std::string peak_path (std::string audio_path); + uint32_t n_channels() const; + bool clamped_at_unity () const { return false; } + + framecnt_t read_unlocked (Sample *dst, framepos_t start, framecnt_t cnt) const; + framecnt_t write_unlocked (Sample *src, framecnt_t cnt); + + float sample_rate () const; + int setup_peakfile (); + + XMLNode& get_state (); + int set_state (const XMLNode&, int version); + + bool can_truncate_peaks() const { return false; } + bool can_be_analysed() const { return _length > 0; } + + protected: + friend class SourceFactory; + + AudioPlaylistSource (Session&, const std::string& name, boost::shared_ptr<AudioPlaylist>, uint32_t chn, + frameoffset_t begin, framecnt_t len, bool copy, Source::Flag flags); + AudioPlaylistSource (Session&, const XMLNode&); + + private: + boost::shared_ptr<AudioPlaylist> _playlist; + frameoffset_t _playlist_offset; + framecnt_t _playlist_length; + uint32_t _playlist_channel; + std::string _peak_path; +}; + +} /* namespace */ + +#endif /* __ardour_audio_playlist_source_h__ */ diff --git a/libs/ardour/ardour/audiosource.h b/libs/ardour/ardour/audiosource.h index 22d5d1a724..5f06d3ee09 100644 --- a/libs/ardour/ardour/audiosource.h +++ b/libs/ardour/ardour/audiosource.h @@ -47,11 +47,11 @@ class AudioSource : virtual public Source, virtual ~AudioSource (); framecnt_t readable_length() const { return _length; } - uint32_t n_channels() const { return 1; } + virtual uint32_t n_channels() const { return 1; } - bool empty() const; + virtual bool empty() const; framecnt_t length (framepos_t pos) const; - void update_length (framepos_t pos, framecnt_t cnt); + void update_length (framepos_t pos, framecnt_t cnt); virtual framecnt_t available_peaks (double zoom) const; @@ -129,7 +129,7 @@ class AudioSource : virtual public Source, virtual framecnt_t write_unlocked (Sample *dst, framecnt_t cnt) = 0; virtual std::string peak_path(std::string audio_path) = 0; virtual std::string find_broken_peakfile (std::string missing_peak_path, - std::string audio_path) = 0; + std::string audio_path) { return std::string(); } virtual int read_peaks_with_fpp (PeakData *peaks, framecnt_t npeaks, framepos_t start, framecnt_t cnt, diff --git a/libs/ardour/ardour/file_source.h b/libs/ardour/ardour/file_source.h index 01fa6adb74..ff2f4cb008 100644 --- a/libs/ardour/ardour/file_source.h +++ b/libs/ardour/ardour/file_source.h @@ -46,7 +46,7 @@ class FileSource : virtual public Source { public: virtual ~FileSource () {} - const std::string& path() const { return _path; } + virtual const std::string& path() const { return _path; } virtual bool safe_file_extension (const std::string& path) const = 0; diff --git a/libs/ardour/ardour/session.h b/libs/ardour/ardour/session.h index f3893eb2f2..dd282e6cf3 100644 --- a/libs/ardour/ardour/session.h +++ b/libs/ardour/ardour/session.h @@ -173,14 +173,11 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi static PBD::Signal1<void,std::string> Dialog; - std::string sound_dir (bool with_path = true) const; - std::string peak_dir () const; - std::string dead_dir () const; + int ensure_subdirs (); + std::string automation_dir () const; std::string analysis_dir() const; std::string plugins_dir() const; - - int ensure_subdirs (); std::string peak_path (std::string) const; diff --git a/libs/ardour/ardour/source.h b/libs/ardour/ardour/source.h index 3df5929a6d..aadb7a51b3 100644 --- a/libs/ardour/ardour/source.h +++ b/libs/ardour/ardour/source.h @@ -64,8 +64,6 @@ class Source : public SessionObject virtual framecnt_t length (framepos_t pos) const = 0; virtual void update_length (framepos_t pos, framecnt_t cnt) = 0; - virtual const std::string& path() const = 0; - virtual framepos_t natural_position() const { return 0; } void mark_for_remove(); diff --git a/libs/ardour/ardour/source_factory.h b/libs/ardour/ardour/source_factory.h index c5994027ce..b8bc5e72b5 100644 --- a/libs/ardour/ardour/source_factory.h +++ b/libs/ardour/ardour/source_factory.h @@ -32,6 +32,7 @@ namespace ARDOUR { class Session; class AudioSource; +class Playlist; class SourceFactory { public: @@ -43,13 +44,21 @@ class SourceFactory { static boost::shared_ptr<Source> createSilent (Session&, const XMLNode& node, framecnt_t nframes, float sample_rate); - static boost::shared_ptr<Source> createReadable (DataType type, Session&, - const std::string& path, - int chn, Source::Flag flags, bool announce = true, bool async = false); + static boost::shared_ptr<Source> createReadable + (DataType type, Session&, + 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, const std::string& origin, - bool destructive, framecnt_t rate, bool announce = true, bool async = false); + static boost::shared_ptr<Source> createWritable + (DataType type, Session&, + const std::string& path, const std::string& origin, + bool destructive, framecnt_t rate, bool announce = true, bool async = false); + + + static boost::shared_ptr<Source> createFromPlaylist + (DataType type, Session& s, boost::shared_ptr<Playlist> p, const std::string& name, + uint32_t chn, frameoffset_t start, framecnt_t len, bool copy, Source::Flag flags, + bool announce, bool defer_peaks); static Glib::Cond* PeaksToBuild; static Glib::StaticMutex peak_building_lock; |