summaryrefslogtreecommitdiff
path: root/libs/ardour/ardour
diff options
context:
space:
mode:
Diffstat (limited to 'libs/ardour/ardour')
-rw-r--r--libs/ardour/ardour/audiofilesource.h1
-rw-r--r--libs/ardour/ardour/audiosource.h55
-rw-r--r--libs/ardour/ardour/configuration_variable.h5
3 files changed, 19 insertions, 42 deletions
diff --git a/libs/ardour/ardour/audiofilesource.h b/libs/ardour/ardour/audiofilesource.h
index 4daa8c24f4..899b0ea3ff 100644
--- a/libs/ardour/ardour/audiofilesource.h
+++ b/libs/ardour/ardour/audiofilesource.h
@@ -107,6 +107,7 @@ class AudioFileSource : public AudioSource {
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; }
diff --git a/libs/ardour/ardour/audiosource.h b/libs/ardour/ardour/audiosource.h
index 1f2ee64ac1..efd96e94eb 100644
--- a/libs/ardour/ardour/audiosource.h
+++ b/libs/ardour/ardour/audiosource.h
@@ -76,6 +76,8 @@ const nframes_t frames_per_peak = 256;
virtual void mark_for_remove() = 0;
virtual void mark_streaming_write_completed () {}
+ virtual bool can_truncate_peaks() const { return true; }
+
void set_captured_for (string str) { _captured_for = str; }
string captured_for() const { return _captured_for; }
@@ -92,9 +94,6 @@ const nframes_t frames_per_peak = 256;
XMLNode& get_state ();
int set_state (const XMLNode&);
- static int start_peak_thread ();
- static void stop_peak_thread ();
-
int rename_peakfile (std::string newpath);
void touch_peakfile ();
@@ -108,6 +107,9 @@ const nframes_t frames_per_peak = 256;
virtual int setup_peakfile () { return 0; }
+ int prepare_for_peakfile_writes ();
+ void done_with_peakfile_writes ();
+
protected:
static bool _build_missing_peakfiles;
static bool _build_peakfiles;
@@ -115,7 +117,6 @@ const nframes_t frames_per_peak = 256;
bool _peaks_built;
mutable Glib::Mutex _lock;
nframes_t _length;
- bool next_peak_clear_should_notify;
string peakpath;
string _captured_for;
@@ -123,12 +124,11 @@ const nframes_t frames_per_peak = 256;
mutable uint32_t _write_data_count; // modified in write()
int initialize_peakfile (bool newfile, string path);
- void build_peaks_from_scratch ();
-
- int do_build_peak (nframes_t, nframes_t);
+ int build_peaks_from_scratch ();
+ int compute_and_write_peaks (Sample* buf, nframes_t first_frame, nframes_t cnt, bool force);
void truncate_peakfile();
- mutable off_t _peak_byte_max; // modified in do_build_peaks()
+ mutable off_t _peak_byte_max; // modified in compute_and_write_peak()
virtual nframes_t read_unlocked (Sample *dst, nframes_t start, nframes_t cnt) const = 0;
virtual nframes_t write_unlocked (Sample *dst, nframes_t cnt) = 0;
@@ -137,40 +137,13 @@ const nframes_t frames_per_peak = 256;
void update_length (nframes_t pos, nframes_t cnt);
- static pthread_t peak_thread;
- static bool have_peak_thread;
- static void* peak_thread_work(void*);
-
- static int peak_request_pipe[2];
-
- struct PeakRequest {
- enum Type {
- Build,
- Quit
- };
- };
-
- static vector<boost::shared_ptr<AudioSource> > pending_peak_sources;
- static Glib::Mutex* pending_peak_sources_lock;
-
- static void queue_for_peaks (boost::shared_ptr<AudioSource>, bool notify=true);
- static void clear_queue_for_peaks ();
-
- struct PeakBuildRecord {
- nframes_t frame;
- nframes_t cnt;
-
- PeakBuildRecord (nframes_t f, nframes_t c)
- : frame (f), cnt (c) {}
- PeakBuildRecord (const PeakBuildRecord& other) {
- frame = other.frame;
- cnt = other.cnt;
- }
- };
-
- list<AudioSource::PeakBuildRecord *> pending_peak_builds;
-
private:
+ int peakfile;
+ nframes_t peak_leftover_cnt;
+ nframes_t peak_leftover_size;
+ Sample* peak_leftovers;
+ nframes_t peak_leftover_frame;
+
bool file_changed (string path);
};
diff --git a/libs/ardour/ardour/configuration_variable.h b/libs/ardour/ardour/configuration_variable.h
index 8710369a64..81e282ff64 100644
--- a/libs/ardour/ardour/configuration_variable.h
+++ b/libs/ardour/ardour/configuration_variable.h
@@ -27,10 +27,13 @@ class ConfigVariableBase {
virtual void add_to_node (XMLNode& node) = 0;
virtual bool set_from_node (const XMLNode& node, Owner owner) = 0;
+ void show_stored_value (const std::string&);
+ static void set_show_stored_values (bool yn);
protected:
std::string _name;
Owner _owner;
+ static bool show_stores;
void notify ();
void miss ();
@@ -61,7 +64,7 @@ class ConfigVariable : public ConfigVariableBase
void add_to_node (XMLNode& node) {
std::stringstream ss;
ss << value;
- cerr << "Config variable " << _name << " stored as " << ss.str() << endl;
+ show_stored_value (ss.str());
XMLNode* child = new XMLNode ("Option");
child->add_property ("name", _name);
child->add_property ("value", ss.str());