diff options
author | Robin Gareus <robin@gareus.org> | 2014-01-17 00:20:58 +0100 |
---|---|---|
committer | Robin Gareus <robin@gareus.org> | 2014-01-17 00:20:58 +0100 |
commit | b4462b3d22f57f3fe7f4e933b2df0e2c89148e78 (patch) | |
tree | 114d4c04b6206b199c1c627900a2cbfe1d31007d /libs/ardour/auditioner.cc | |
parent | 10933e200369ecceb2c8b3a52be41b930955d269 (diff) |
add seeking to sfdb auditioner
Diffstat (limited to 'libs/ardour/auditioner.cc')
-rw-r--r-- | libs/ardour/auditioner.cc | 43 |
1 files changed, 39 insertions, 4 deletions
diff --git a/libs/ardour/auditioner.cc b/libs/ardour/auditioner.cc index 73670798d8..75a40f142d 100644 --- a/libs/ardour/auditioner.cc +++ b/libs/ardour/auditioner.cc @@ -44,6 +44,9 @@ Auditioner::Auditioner (Session& s) , current_frame (0) , _auditioning (0) , length (0) + , _seek_frame (-1) + , _seeking (false) + , _seek_complete (false) , via_monitor (false) { } @@ -203,6 +206,8 @@ Auditioner::audition_region (boost::shared_ptr<Region> region) _main_outs->reset_panner(); + _seek_frame = -1; + _seeking = false; length = the_region->length(); int dir; @@ -232,14 +237,44 @@ Auditioner::play_audition (framecnt_t nframes) return 0; } - this_nframes = min (nframes, length - current_frame); +#if 0 // TODO + if (_seeking && _seek_complete) { + // set FADE-IN + } else if (_seek_frame >= 0 && _seek_frame < length && !_seeking) { + // set FADE-OUT -- use/override amp? || use region-gain ? + } +#endif + + if (_seeking && _seek_complete) { + _seek_complete = false; + _seeking = false; + _seek_frame = -1; + } + + if(!_seeking) { + /* process audio */ + this_nframes = min (nframes, length - current_frame); + + if ((ret = roll (this_nframes, current_frame, current_frame + nframes, false, need_butler)) != 0) { + silence (nframes); + return ret; + } - if ((ret = roll (this_nframes, current_frame, current_frame + nframes, false, need_butler)) != 0) { + current_frame += this_nframes; + + } else { silence (nframes); - return ret; } - current_frame += this_nframes; + if (_seek_frame >= 0 && _seek_frame < length && !_seeking) { + _seek_complete = false; + _seeking = true; + need_butler = true; + } + + if (!_seeking) { + AuditionProgress(current_frame, length); /* emit */ + } if (current_frame >= length) { _session.cancel_audition (); |