diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2006-02-21 05:05:59 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2006-02-21 05:05:59 +0000 |
commit | 384c8f26b59773a74b2c970179c0f34e8bb2e3fa (patch) | |
tree | f2d61e909da397be1b8ffc4d46bab50074cbe432 | |
parent | 94ba45c0571e6822268edf0ea3279901d0b93e63 (diff) |
hook up tape region views to peaks ready signal
git-svn-id: svn://localhost/trunk/ardour2@342 d708f5d6-7413-0410-9779-e7cbd77b26cf
-rw-r--r-- | gtk2_ardour/regionview.cc | 25 | ||||
-rw-r--r-- | gtk2_ardour/taperegionview.cc | 36 | ||||
-rw-r--r-- | gtk2_ardour/taperegionview.h | 1 | ||||
-rw-r--r-- | libs/ardour/destructive_filesource.cc | 10 | ||||
-rw-r--r-- | libs/ardour/filesource.cc | 2 | ||||
-rw-r--r-- | libs/ardour/source.cc | 1 |
6 files changed, 65 insertions, 10 deletions
diff --git a/gtk2_ardour/regionview.cc b/gtk2_ardour/regionview.cc index 119c4cbe58..d7c87ae1c4 100644 --- a/gtk2_ardour/regionview.cc +++ b/gtk2_ardour/regionview.cc @@ -1067,7 +1067,7 @@ AudioRegionView::create_one_wave (uint32_t which, bool direct) */ if (which < nchans) { - tmp_waves[which] = (wave); + tmp_waves[which] = wave; } else { /* n-channel track, >n-channel source */ } @@ -1080,11 +1080,31 @@ AudioRegionView::create_one_wave (uint32_t which, bool direct) } } - if (n == nwaves) { + cerr << "wave ready, n = " << n << " nwaves = " << nwaves << " new wave = " << wave + << " tmp[" << which << "] = " << tmp_waves[which] << endl; + + if (n == nwaves && waves.empty()) { /* all waves are ready */ tmp_waves.resize(nwaves); + + + for (uint32_t x = 0; x < tmp_waves.size(); ++x) { + cerr << "tmp_waves[" << x << "] = " << tmp_waves[x] << endl; + } + waves = tmp_waves; tmp_waves.clear (); + + cerr << "all waves ready, copied over ...\n"; + + for (uint32_t x = 0; x < waves.size(); ++x) { + cerr << "waves[" << x << "] = " << waves[x] << endl; + } + + for (vector<WaveView*>::iterator i = waves.begin(); i != waves.end(); ++i) { + cerr << "iterator[" << distance (i, waves.begin()) << "] = " << (*i) << endl; + } + cerr << "--------\n"; if (!zero_line) { zero_line = new ArdourCanvas::SimpleLine (*group); @@ -1094,6 +1114,7 @@ AudioRegionView::create_one_wave (uint32_t which, bool direct) manage_zero_line (); } } + cerr << "done that time\n"; } void diff --git a/gtk2_ardour/taperegionview.cc b/gtk2_ardour/taperegionview.cc index 78786be095..4fd40bcc86 100644 --- a/gtk2_ardour/taperegionview.cc +++ b/gtk2_ardour/taperegionview.cc @@ -32,6 +32,7 @@ #include "taperegionview.h" #include "audio_time_axis.h" +#include "gui_thread.h" #include "i18n.h" @@ -100,6 +101,13 @@ TapeAudioRegionView::init (double amplitude_above_axis, Gdk::Color& basic_color, set_colors (); // ColorChanged.connect (mem_fun (*this, &AudioRegionView::color_handler)); + + /* every time the wave data changes and peaks are ready, redraw */ + + for (uint32_t n = 0; n < region.n_channels(); ++n) { + region.source(n).PeaksReady.connect (bind (mem_fun(*this, &TapeAudioRegionView::update), n)); + } + } TapeAudioRegionView::~TapeAudioRegionView() @@ -107,6 +115,34 @@ TapeAudioRegionView::~TapeAudioRegionView() } void +TapeAudioRegionView::update (uint32_t n) +{ + /* check that all waves are build and ready */ + + if (!tmp_waves.empty()) { + return; + } + + ENSURE_GUI_THREAD (bind (mem_fun(*this, &TapeAudioRegionView::update), n)); + + cerr << "peaks ready for channel " << n << endl; + + cerr << "tmp waves size = " << tmp_waves.size() << " waves size = " << waves.size() << endl; + + for (uint32_t x = 0; x < waves.size(); ++x) { + cerr << "waves[" << x << "] = " << waves[x] << endl; + } + + for (vector<WaveView*>::iterator i = waves.begin(); i != waves.end(); ++i) { + cerr << "iterator[" << distance (i, waves.begin()) << "] = " << (*i) << endl; + } + + /* this triggers a cache invalidation and redraw in the waveview */ + + waves[n]->property_data_src() = ®ion; +} + +void TapeAudioRegionView::set_frame_color () { fill_opacity = 255; diff --git a/gtk2_ardour/taperegionview.h b/gtk2_ardour/taperegionview.h index 9d4b9cec2f..3e23e0fc19 100644 --- a/gtk2_ardour/taperegionview.h +++ b/gtk2_ardour/taperegionview.h @@ -39,6 +39,7 @@ class TapeAudioRegionView : public AudioRegionView void init (double amplitude_above_axis, Gdk::Color& base_color, bool wait_for_waves); void set_frame_color (); + void update (uint32_t n); }; #endif /* __gtk_ardour_tape_audio_region_view_h__ */ diff --git a/libs/ardour/destructive_filesource.cc b/libs/ardour/destructive_filesource.cc index 9081fc9b38..8604d5d84e 100644 --- a/libs/ardour/destructive_filesource.cc +++ b/libs/ardour/destructive_filesource.cc @@ -264,7 +264,7 @@ DestructiveFileSource::write (Sample* data, jack_nframes_t cnt, char * workbuf) { LockMonitor lm (_lock, __LINE__, __FILE__); - jack_nframes_t oldlen; + jack_nframes_t old_file_pos; if (_capture_start && _capture_end) { _capture_start = false; @@ -321,7 +321,7 @@ DestructiveFileSource::write (Sample* data, jack_nframes_t cnt, char * workbuf) } } - oldlen = _length; + old_file_pos = file_pos; if (file_pos + cnt > _length) { _length = file_pos + cnt; } @@ -336,7 +336,7 @@ DestructiveFileSource::write (Sample* data, jack_nframes_t cnt, char * workbuf) pbr = pending_peak_builds.back(); } - if (pbr && pbr->frame + pbr->cnt == oldlen) { + if (pbr && pbr->frame + pbr->cnt == old_file_pos) { /* the last PBR extended to the start of the current write, so just extend it again. @@ -344,15 +344,13 @@ DestructiveFileSource::write (Sample* data, jack_nframes_t cnt, char * workbuf) pbr->cnt += cnt; } else { - pending_peak_builds.push_back (new PeakBuildRecord (oldlen, cnt)); + pending_peak_builds.push_back (new PeakBuildRecord (old_file_pos, cnt)); } _peaks_built = false; } - } - if (_build_peakfiles) { queue_for_peaks (*this); } diff --git a/libs/ardour/filesource.cc b/libs/ardour/filesource.cc index 3451239d3b..7661f8f3f5 100644 --- a/libs/ardour/filesource.cc +++ b/libs/ardour/filesource.cc @@ -1020,7 +1020,7 @@ FileSource::write (Sample *data, jack_nframes_t cnt, char * workbuf) if (_build_peakfiles) { PeakBuildRecord *pbr = 0; - + if (pending_peak_builds.size()) { pbr = pending_peak_builds.back(); } diff --git a/libs/ardour/source.cc b/libs/ardour/source.cc index ee918375f6..f707dc44e5 100644 --- a/libs/ardour/source.cc +++ b/libs/ardour/source.cc @@ -700,7 +700,6 @@ Source::build_peaks () pending_peak_builds.clear (); } - #ifdef DEBUG_PEAK_BUILD cerr << "build peaks with " << pending_peak_builds.size() << " requests pending\n"; #endif |