projects
/
ardour.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Auditioner, silence buffer at end.
[ardour.git]
/
libs
/
ardour
/
auditioner.cc
diff --git
a/libs/ardour/auditioner.cc
b/libs/ardour/auditioner.cc
index c76adb17970ea441a846a2ea19c8ad0b0c5f427b..1dd9022ca99e88150877226bfcc1f09113deb5f1 100644
(file)
--- a/
libs/ardour/auditioner.cc
+++ b/
libs/ardour/auditioner.cc
@@
-47,10
+47,10
@@
using namespace PBD;
Auditioner::Auditioner (Session& s)
: Track (s, "auditioner", PresentationInfo::Auditioner)
Auditioner::Auditioner (Session& s)
: Track (s, "auditioner", PresentationInfo::Auditioner)
- , current_
fram
e (0)
+ , current_
sampl
e (0)
, _auditioning (0)
, length (0)
, _auditioning (0)
, length (0)
- , _seek_
fram
e (-1)
+ , _seek_
sampl
e (-1)
, _seeking (false)
, _seek_complete (false)
, via_monitor (false)
, _seeking (false)
, _seek_complete (false)
, via_monitor (false)
@@
-97,7
+97,7
@@
Auditioner::lookup_synth ()
{
string plugin_id = Config->get_midi_audition_synth_uri();
asynth.reset ();
{
string plugin_id = Config->get_midi_audition_synth_uri();
asynth.reset ();
- if (!plugin_id.empty()) {
+ if (!plugin_id.empty()
|| plugin_id == X_("@default@")
) {
boost::shared_ptr<Plugin> p;
p = find_plugin (_session, plugin_id, ARDOUR::LV2);
if (!p) {
boost::shared_ptr<Plugin> p;
p = find_plugin (_session, plugin_id, ARDOUR::LV2);
if (!p) {
@@
-113,6
+113,9
@@
Auditioner::lookup_synth ()
}
}
if (p) {
}
}
if (p) {
+ if (plugin_id == X_("@default@")) {
+ Config->set_midi_audition_synth_uri (p->get_info()->unique_id);
+ }
asynth = boost::shared_ptr<Processor> (new PluginInsert (_session, p));
}
}
asynth = boost::shared_ptr<Processor> (new PluginInsert (_session, p));
}
}
@@
-217,7
+220,7
@@
Auditioner::data_type () const {
}
int
}
int
-Auditioner::roll (pframes_t nframes,
framepos_t start_frame, framepos_t end_fram
e, int declick, bool& need_butler)
+Auditioner::roll (pframes_t nframes,
samplepos_t start_sample, samplepos_t end_sampl
e, int declick, bool& need_butler)
{
Glib::Threads::RWLock::ReaderLock lm (_processor_lock, Glib::Threads::TRY_LOCK);
if (!lm.locked()) {
{
Glib::Threads::RWLock::ReaderLock lm (_processor_lock, Glib::Threads::TRY_LOCK);
if (!lm.locked()) {
@@
-228,9
+231,6
@@
Auditioner::roll (pframes_t nframes, framepos_t start_frame, framepos_t end_fram
BufferSet& bufs = _session.get_route_buffers (n_process_buffers());
BufferSet& bufs = _session.get_route_buffers (n_process_buffers());
- _silent = false;
- _amp->apply_gain_automation(false);
-
if (_queue_panic) {
MidiBuffer& mbuf (bufs.get_midi (0));
_queue_panic = false;
if (_queue_panic) {
MidiBuffer& mbuf (bufs.get_midi (0));
_queue_panic = false;
@@
-244,7
+244,7
@@
Auditioner::roll (pframes_t nframes, framepos_t start_frame, framepos_t end_fram
}
}
}
}
- process_output_buffers (bufs, start_
frame, end_frame, nframes, declick, !_session.transport_stopped()
);
+ process_output_buffers (bufs, start_
sample, end_sample, nframes, declick, !_session.transport_stopped(), true
);
/* note: auditioner never writes to disk, so we don't care about the
* disk writer status (it's buffers will always have no data in them).
/* note: auditioner never writes to disk, so we don't care about the
* disk writer status (it's buffers will always have no data in them).
@@
-363,11
+363,11
@@
Auditioner::audition_region (boost::shared_ptr<Region> region)
/* force a panner reset now that we have all channels */
_main_outs->reset_panner();
/* force a panner reset now that we have all channels */
_main_outs->reset_panner();
- _seek_
fram
e = -1;
+ _seek_
sampl
e = -1;
_seeking = false;
int dir;
_seeking = false;
int dir;
-
fram
ecnt_t offset;
+
sampl
ecnt_t offset;
if (_midi_audition) {
length = midi_region->length();
if (_midi_audition) {
length = midi_region->length();
@@
-377,6
+377,11
@@
Auditioner::audition_region (boost::shared_ptr<Region> region)
offset = the_region->sync_offset (dir);
}
offset = the_region->sync_offset (dir);
}
+ if (length == 0) {
+ error << _("Cannot audition empty file.") << endmsg;
+ return;
+ }
+
/* can't audition from a negative sync point */
if (dir < 0) {
/* can't audition from a negative sync point */
if (dir < 0) {
@@
-384,16
+389,16
@@
Auditioner::audition_region (boost::shared_ptr<Region> region)
}
_disk_reader->seek (offset, true);
}
_disk_reader->seek (offset, true);
- current_
fram
e = offset;
+ current_
sampl
e = offset;
g_atomic_int_set (&_auditioning, 1);
}
int
g_atomic_int_set (&_auditioning, 1);
}
int
-Auditioner::play_audition (
fram
ecnt_t nframes)
+Auditioner::play_audition (
sampl
ecnt_t nframes)
{
bool need_butler = false;
{
bool need_butler = false;
-
fram
ecnt_t this_nframes;
+
sampl
ecnt_t this_nframes;
int ret;
if (g_atomic_int_get (&_auditioning) == 0) {
int ret;
if (g_atomic_int_get (&_auditioning) == 0) {
@@
-404,7
+409,7
@@
Auditioner::play_audition (framecnt_t nframes)
#if 0 // TODO
if (_seeking && _seek_complete) {
// set FADE-IN
#if 0 // TODO
if (_seeking && _seek_complete) {
// set FADE-IN
- } else if (_seek_
frame >= 0 && _seek_fram
e < length && !_seeking) {
+ } else if (_seek_
sample >= 0 && _seek_sampl
e < length && !_seeking) {
// set FADE-OUT -- use/override amp? || use region-gain ?
}
#endif
// set FADE-OUT -- use/override amp? || use region-gain ?
}
#endif
@@
-412,26
+417,33
@@
Auditioner::play_audition (framecnt_t nframes)
if (_seeking && _seek_complete) {
_seek_complete = false;
_seeking = false;
if (_seeking && _seek_complete) {
_seek_complete = false;
_seeking = false;
- _seek_
fram
e = -1;
+ _seek_
sampl
e = -1;
_disk_reader->reset_tracker();
}
if(!_seeking) {
/* process audio */
_disk_reader->reset_tracker();
}
if(!_seeking) {
/* process audio */
- this_nframes = min (nframes, length - current_
fram
e + _import_position);
+ this_nframes = min (nframes, length - current_
sampl
e + _import_position);
- if (
(ret = roll (this_nframes, current_frame, current_frame + nframes, false, need_butler)) != 0
) {
+ if (
this_nframes > 0 && 0 != (ret = roll (this_nframes, current_sample, current_sample + this_nframes, false, need_butler))
) {
silence (nframes);
return ret;
}
silence (nframes);
return ret;
}
- current_frame += this_nframes;
+ current_sample += this_nframes;
+
+ if (this_nframes < nframes) {
+ if (this_nframes > 0) {
+ _session.engine().split_cycle (this_nframes);
+ }
+ silence (nframes - this_nframes);
+ }
} else {
silence (nframes);
}
} else {
silence (nframes);
}
- if (_seek_
frame >= 0 && _seek_fram
e < length && !_seeking) {
+ if (_seek_
sample >= 0 && _seek_sampl
e < length && !_seeking) {
_queue_panic = true;
_seek_complete = false;
_seeking = true;
_queue_panic = true;
_seek_complete = false;
_seeking = true;
@@
-439,10
+451,10
@@
Auditioner::play_audition (framecnt_t nframes)
}
if (!_seeking) {
}
if (!_seeking) {
- AuditionProgress(current_
fram
e - _import_position, length); /* emit */
+ AuditionProgress(current_
sampl
e - _import_position, length); /* emit */
}
}
- if (current_
fram
e >= length + _import_position) {
+ if (current_
sampl
e >= length + _import_position) {
_session.cancel_audition ();
return 0;
} else {
_session.cancel_audition ();
return 0;
} else {
@@
-503,8
+515,12
@@
Auditioner::input_streams () const
depends solely on the region we are auditioning.
*/
depends solely on the region we are auditioning.
*/
- if (_disk_reader) {
- return _disk_reader->input_streams ();
+ if (_midi_audition) {
+ return ChanCount (DataType::MIDI, 1);
+ } else {
+ if (the_region) {
+ return ChanCount (DataType::AUDIO, the_region->n_channels ());
+ }
}
return ChanCount (DataType::AUDIO, 1);
}
return ChanCount (DataType::AUDIO, 1);