From 0a9cef7720ed9bd83442d284d18831437b80a482 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Mon, 16 May 2011 02:17:58 +0000 Subject: very basic Join (regions) editing operation. not finished yet, no undoable, no sensible name for new region, etc. etc git-svn-id: svn://localhost/ardour2/branches/3.0@9518 d708f5d6-7413-0410-9779-e7cbd77b26cf --- libs/ardour/ardour/audio_playlist_source.h | 1 + libs/ardour/ardour/audiosource.h | 18 +++++++++++++++++- libs/ardour/ardour/playlist.h | 4 ++++ libs/ardour/ardour/region.h | 1 + libs/ardour/ardour/source.h | 4 +++- libs/ardour/ardour/source_factory.h | 3 +-- 6 files changed, 27 insertions(+), 4 deletions(-) (limited to 'libs/ardour/ardour') diff --git a/libs/ardour/ardour/audio_playlist_source.h b/libs/ardour/ardour/audio_playlist_source.h index d6047de1fc..868e8c743e 100644 --- a/libs/ardour/ardour/audio_playlist_source.h +++ b/libs/ardour/ardour/audio_playlist_source.h @@ -65,6 +65,7 @@ class AudioPlaylistSource : public AudioSource { framecnt_t _playlist_length; uint32_t _playlist_channel; std::string _peak_path; + uint32_t _level; /* how recursive is this? */ }; } /* namespace */ diff --git a/libs/ardour/ardour/audiosource.h b/libs/ardour/ardour/audiosource.h index 5f06d3ee09..d0d34a55c4 100644 --- a/libs/ardour/ardour/audiosource.h +++ b/libs/ardour/ardour/audiosource.h @@ -106,10 +106,26 @@ class AudioSource : virtual public Source, /** @return true if the each source sample s must be clamped to -1 < s < 1 */ virtual bool clamped_at_unity () const = 0; + static void allocate_working_buffers (); + protected: static bool _build_missing_peakfiles; static bool _build_peakfiles; + static size_t _working_buffers_size; + + /* these collections of working buffers for supporting + playlist's reading from potentially nested/recursive + sources assume SINGLE THREADED reads by the butler + thread, or a lock around calls that use them. + */ + + static std::vector _mixdown_buffers; + static std::vector _gain_buffers; + static Glib::StaticMutex _level_buffer_lock; + + static void ensure_buffers_for_level (uint32_t); + framecnt_t _length; std::string peakpath; std::string _captured_for; @@ -129,7 +145,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) { return std::string(); } + std::string audio_path) { return peak_path (audio_path); } virtual int read_peaks_with_fpp (PeakData *peaks, framecnt_t npeaks, framepos_t start, framecnt_t cnt, diff --git a/libs/ardour/ardour/playlist.h b/libs/ardour/ardour/playlist.h index e21199e642..e23ba264fc 100644 --- a/libs/ardour/ardour/playlist.h +++ b/libs/ardour/ardour/playlist.h @@ -97,6 +97,8 @@ public: boost::shared_ptr region_by_id (const PBD::ID&) const; + uint32_t max_source_level () const; + void set_region_ownership (); virtual void clear (bool with_signals=true); @@ -137,6 +139,8 @@ public: void partition (framepos_t start, framepos_t end, bool cut = false); void duplicate (boost::shared_ptr, framepos_t position, float times); void nudge_after (framepos_t start, framecnt_t distance, bool forwards); + void join (const RegionList&, const std::string&); + void shuffle (boost::shared_ptr, int dir); void update_after_tempo_map_change (); diff --git a/libs/ardour/ardour/region.h b/libs/ardour/ardour/region.h index 17ea1362d8..719c00acf8 100644 --- a/libs/ardour/ardour/region.h +++ b/libs/ardour/ardour/region.h @@ -114,6 +114,7 @@ class Region layer_t layer () const { return _layer; } framecnt_t source_length(uint32_t n) const; + uint32_t max_source_level () const; /* these two are valid ONLY during a StateChanged signal handler */ diff --git a/libs/ardour/ardour/source.h b/libs/ardour/ardour/source.h index aadb7a51b3..4af94d44b8 100644 --- a/libs/ardour/ardour/source.h +++ b/libs/ardour/ardour/source.h @@ -106,17 +106,19 @@ class Source : public SessionObject virtual void dec_use_count (); int use_count() const { return g_atomic_int_get (&_use_count); } bool used() const { return use_count() > 0; } + uint32_t level() const { return _level; } protected: DataType _type; Flag _flags; time_t _timestamp; - framepos_t _timeline_position; + framepos_t _timeline_position; bool _analysed; mutable Glib::Mutex _lock; mutable Glib::Mutex _analysis_lock; Glib::Mutex _playlist_lock; gint _use_count; /* atomic */ + uint32_t _level; /* how deeply nested is this source w.r.t a disk file */ private: void fix_writable_flags (); diff --git a/libs/ardour/ardour/source_factory.h b/libs/ardour/ardour/source_factory.h index b8bc5e72b5..427bf10a56 100644 --- a/libs/ardour/ardour/source_factory.h +++ b/libs/ardour/ardour/source_factory.h @@ -57,8 +57,7 @@ class SourceFactory { static boost::shared_ptr createFromPlaylist (DataType type, Session& s, boost::shared_ptr p, const std::string& name, - uint32_t chn, frameoffset_t start, framecnt_t len, bool copy, Source::Flag flags, - bool announce, bool defer_peaks); + uint32_t chn, frameoffset_t start, framecnt_t len, bool copy, bool defer_peaks); static Glib::Cond* PeaksToBuild; static Glib::StaticMutex peak_building_lock; -- cgit v1.2.3