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 (framecnt_t cnt);
virtual framecnt_t available_peaks (double zoom) const;
void set_captured_for (std::string str) { _captured_for = str; }
std::string captured_for() const { return _captured_for; }
- uint32_t read_data_count() const { return _read_data_count; }
- uint32_t write_data_count() const { return _write_data_count; }
- void dec_read_data_count (framecnt_t);
-
int read_peaks (PeakData *peaks, framecnt_t npeaks,
framepos_t start, framecnt_t cnt, double samples_per_visual_peak) const;
/** @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 (framecnt_t framerate);
+
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<boost::shared_ptr<Sample> > _mixdown_buffers;
+ static std::vector<boost::shared_ptr<gain_t> > _gain_buffers;
+ static Glib::StaticMutex _level_buffer_lock;
+
+ static void ensure_buffers_for_level (uint32_t, framecnt_t);
+ static void ensure_buffers_for_level_locked (uint32_t, framecnt_t);
+
framecnt_t _length;
std::string peakpath;
std::string _captured_for;
- mutable uint32_t _read_data_count; // modified in read()
- mutable uint32_t _write_data_count; // modified in write()
-
int initialize_peakfile (bool newfile, std::string path);
int build_peaks_from_scratch ();
int compute_and_write_peaks (Sample* buf, framecnt_t first_frame, framecnt_t cnt,
virtual framecnt_t read_unlocked (Sample *dst, framepos_t start, framecnt_t cnt) const = 0;
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;
+ virtual std::string find_broken_peakfile (std::string /* missing_peak_path */,
+ 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,
double samples_per_visual_peak, framecnt_t fpp) const;
-
+
int compute_and_write_peaks (Sample* buf, framecnt_t first_frame, framecnt_t cnt,
- bool force, bool intermediate_peaks_ready_signal,
+ bool force, bool intermediate_peaks_ready_signal,
framecnt_t frames_per_peak);
private:
* during the handling of the signal.
*/
mutable Glib::Mutex _peaks_ready_lock;
-
+
PBD::FdFileDescriptor* _peakfile_descriptor;
int _peakfile_fd;
framecnt_t peak_leftover_cnt;