mirror of
https://github.com/Ardour/ardour.git
synced 2026-01-22 13:17:17 +01:00
hook up tape region views to peaks ready signal
git-svn-id: svn://localhost/trunk/ardour2@342 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
94ba45c057
commit
384c8f26b5
6 changed files with 65 additions and 10 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@
|
|||
|
||||
#include "taperegionview.h"
|
||||
#include "audio_time_axis.h"
|
||||
#include "gui_thread.h"
|
||||
|
||||
#include "i18n.h"
|
||||
|
||||
|
|
@ -100,12 +101,47 @@ 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()
|
||||
{
|
||||
}
|
||||
|
||||
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 ()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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__ */
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue