diff --git a/gtk2_ardour/ardour_ui.cc b/gtk2_ardour/ardour_ui.cc index 8f07d091a7..febdbab088 100644 --- a/gtk2_ardour/ardour_ui.cc +++ b/gtk2_ardour/ardour_ui.cc @@ -1489,7 +1489,7 @@ ARDOUR_UI::_blink (void *arg) void ARDOUR_UI::blink () { - // Blink (blink_on = !blink_on); /* EMIT_SIGNAL */ + Blink (blink_on = !blink_on); /* EMIT_SIGNAL */ } void diff --git a/gtk2_ardour/ardour_ui2.cc b/gtk2_ardour/ardour_ui2.cc index 63104f0034..5f1f0e3b7b 100644 --- a/gtk2_ardour/ardour_ui2.cc +++ b/gtk2_ardour/ardour_ui2.cc @@ -176,20 +176,6 @@ ARDOUR_UI::transport_forwarding () auto_loop_button.set_visual_state (0); } -bool -messagefoo (GdkEventButton* ev) -{ - cerr << " roll button pressed\n"; - return false; -} - -bool -messagefoo2 (GdkEventButton* ev) -{ - cerr << " roll button release\n"; - return false; -} - void ARDOUR_UI::setup_transport () { @@ -267,9 +253,6 @@ ARDOUR_UI::setup_transport () RefPtr act; - roll_button.signal_button_press_event().connect (sigc::ptr_fun (messagefoo)); - roll_button.signal_button_release_event().connect (sigc::ptr_fun (messagefoo2)); - act = ActionManager::get_action (X_("Transport"), X_("Stop")); act->connect_proxy (stop_button); act = ActionManager::get_action (X_("Transport"), X_("Roll")); diff --git a/libs/ardour/audio_diskstream.cc b/libs/ardour/audio_diskstream.cc index 9c101bd757..c22ba75c7d 100644 --- a/libs/ardour/audio_diskstream.cc +++ b/libs/ardour/audio_diskstream.cc @@ -982,7 +982,10 @@ AudioDiskstream::read (Sample* buf, Sample* mixdown_buffer, float* gain_buffer, nframes_t offset = 0; Location *loc = 0; + /* XXX we don't currently play loops in reverse. not sure why */ + if (!reversed) { + /* Make the use of a Location atomic for this read operation. Note: Locations don't get deleted, so all we care about @@ -1006,11 +1009,16 @@ AudioDiskstream::read (Sample* buf, Sample* mixdown_buffer, float* gain_buffer, start = loop_start + ((start - loop_start) % loop_length); //cerr << "to " << start << endl; } + //cerr << "start is " << start << " loopstart: " << loop_start << " loopend: " << loop_end << endl; } while (cnt) { + if (reversed) { + start -= cnt; + } + /* take any loop into account. we can't read past the end of the loop. */ if (loc && (loop_end - start < cnt)) { @@ -1038,9 +1046,6 @@ AudioDiskstream::read (Sample* buf, Sample* mixdown_buffer, float* gain_buffer, if (reversed) { - /* don't adjust start, since caller has already done that - */ - swap_by_ptr (buf, buf + this_read - 1); } else { @@ -1096,7 +1101,7 @@ AudioDiskstream::_do_refill (Sample* mixdown_buffer, float* gain_buffer) if ((total_space = vector.len[0] + vector.len[1]) == 0) { return 0; } - + /* if there are 2+ chunks of disk i/o possible for this track, let the caller know so that it can arrange for us to be called again, ASAP. @@ -1126,6 +1131,8 @@ AudioDiskstream::_do_refill (Sample* mixdown_buffer, float* gain_buffer) return 0; } + /* never do more than disk_io_chunk_frames worth of disk input per call (limit doesn't apply for memset) */ + total_space = min (disk_io_chunk_frames, total_space); if (reversed) { @@ -1159,11 +1166,6 @@ AudioDiskstream::_do_refill (Sample* mixdown_buffer, float* gain_buffer) } else { - /* move read position backwards because we are going - to reverse the data. - */ - - file_frame -= total_space; zero_fill = 0; } @@ -1209,21 +1211,36 @@ AudioDiskstream::_do_refill (Sample* mixdown_buffer, float* gain_buffer) chan.playback_buf->get_write_vector (&vector); + if (vector.len[0] > disk_io_chunk_frames) { + + /* we're not going to fill the first chunk, so certainly do not bother with the + other part. it won't be connected with the part we do fill, as in: + + .... => writable space + ++++ => readable space + ^^^^ => 1 x disk_io_chunk_frames that would be filled + + |......|+++++++++++++|...............................| + buf1 buf0 + ^^^^^^^^^^^^^^^ + + + So, just pretend that the buf1 part isn't there. + + */ + + vector.buf[1] = 0; + vector.len[1] = 0; + + } + ts = total_space; file_frame_tmp = file_frame; - if (reversed) { - buf1 = vector.buf[1]; - len1 = vector.len[1]; - buf2 = vector.buf[0]; - len2 = vector.len[0]; - } else { - buf1 = vector.buf[0]; - len1 = vector.len[0]; - buf2 = vector.buf[1]; - len2 = vector.len[1]; - } - + buf1 = vector.buf[0]; + len1 = vector.len[0]; + buf2 = vector.buf[1]; + len2 = vector.len[1]; to_read = min (ts, len1); to_read = min (to_read, disk_io_chunk_frames); @@ -1234,7 +1251,7 @@ AudioDiskstream::_do_refill (Sample* mixdown_buffer, float* gain_buffer) ret = -1; goto out; } - + chan.playback_buf->increment_write_ptr (to_read); ts -= to_read; } @@ -1243,7 +1260,6 @@ AudioDiskstream::_do_refill (Sample* mixdown_buffer, float* gain_buffer) if (to_read) { - /* we read all of vector.len[0], but it wasn't an entire disk_io_chunk_frames of data, so read some or all of vector.len[1] as well. */ diff --git a/libs/ardour/audiofilter.cc b/libs/ardour/audiofilter.cc index a7117cf9dc..6987ec7c0b 100644 --- a/libs/ardour/audiofilter.cc +++ b/libs/ardour/audiofilter.cc @@ -79,6 +79,7 @@ AudioFilter::finish (boost::shared_ptr region, SourceList& nsrcs) boost::shared_ptr afs = boost::dynamic_pointer_cast(*si); if (afs) { afs->update_header (region->position(), *now, xnow); + afs->mark_immutable (); } } diff --git a/libs/ardour/reverse.cc b/libs/ardour/reverse.cc index eb68a09049..7495fd177f 100644 --- a/libs/ardour/reverse.cc +++ b/libs/ardour/reverse.cc @@ -47,10 +47,9 @@ Reverse::run (boost::shared_ptr region) { SourceList nsrcs; SourceList::iterator si; - const nframes_t blocksize = 256 * 1048; - Sample buf[blocksize]; + nframes_t blocksize = 256 * 1024; + Sample* buf; nframes_t fpos; - nframes_t fend; nframes_t fstart; nframes_t to_read; int ret = -1; @@ -61,31 +60,34 @@ Reverse::run (boost::shared_ptr region) goto out; } - fend = region->start() + region->length(); fstart = region->start(); - if (blocksize < fend) { - fpos =max(fstart, fend - blocksize); - } else { - fpos = fstart; + if (blocksize > region->length()) { + blocksize = region->length(); } - to_read = min (region->length(), blocksize); + fpos = max (fstart, (fstart + region->length() - blocksize)); + buf = new Sample[blocksize]; + to_read = blocksize; + + cerr << "Reverse " << region->name() << " len = " << region->length() << " blocksize = " << blocksize << " start at " << fstart << endl; /* now read it backwards */ - while (1) { + while (to_read) { uint32_t n; for (n = 0, si = nsrcs.begin(); n < region->n_channels(); ++n, ++si) { /* read it in */ + + cerr << "read at " << fpos << " for " << to_read << endl; if (region->source (n)->read (buf, fpos, to_read) != to_read) { goto out; } - + /* swap memory order */ for (nframes_t i = 0; i < to_read/2; ++i) { @@ -99,13 +101,12 @@ Reverse::run (boost::shared_ptr region) } } - if (fpos == fstart) { - break; - } else if (fpos > fstart + to_read) { + if (fpos > fstart + blocksize) { fpos -= to_read; - to_read = min (fstart - fpos, blocksize); + to_read = blocksize; } else { - to_read = fpos-fstart; + to_read = fpos - fstart; + cerr << "Last read detected, only " << fpos - fstart << " left; move to start and read " << to_read << endl; fpos = fstart; } }; @@ -114,6 +115,8 @@ Reverse::run (boost::shared_ptr region) out: + delete [] buf; + if (ret) { for (si = nsrcs.begin(); si != nsrcs.end(); ++si) { (*si)->mark_for_remove (); diff --git a/libs/ardour/sndfilesource.cc b/libs/ardour/sndfilesource.cc index 629b3e4158..296f7471ad 100644 --- a/libs/ardour/sndfilesource.cc +++ b/libs/ardour/sndfilesource.cc @@ -388,6 +388,8 @@ SndFileSource::nondestructive_write_unlocked (Sample *data, nframes_t cnt) nframes_t oldlen; int32_t frame_pos = _length; + + cerr << _name << " write " << cnt << " floats to " << frame_pos << endl; if (write_float (data, frame_pos, cnt) != cnt) { return 0; @@ -396,6 +398,8 @@ SndFileSource::nondestructive_write_unlocked (Sample *data, nframes_t cnt) oldlen = _length; update_length (oldlen, cnt); + cerr << "\t length is now " << _length << endl; + if (_build_peakfiles) { PeakBuildRecord *pbr = 0;