{
Track::set_diskstream (ds);
- _diskstream->set_track (this);
+ _diskstream->set_track (this);
_diskstream->set_destructive (_mode == Destructive);
_diskstream->set_non_layered (_mode == NonLayered);
{
const XMLProperty *prop;
XMLNodeConstIterator iter;
+ XMLNode *child;
if (call_base) {
if (Route::_set_state (node, version, call_base)) {
_mode = Normal;
}
+ if (version >= 3000) {
+ if ((child = find_named_node (node, X_("Diskstream"))) != 0) {
+ boost::shared_ptr<AudioDiskstream> ds (new AudioDiskstream (_session, *child));
+ ds->do_refill_with_alloc ();
+ set_diskstream (ds);
+ }
+ }
+
+ /* set rec-enable control *AFTER* setting up diskstream, because it may want to operate
+ on the diskstream as it sets its own state
+ */
+
XMLNodeList nlist;
XMLNodeConstIterator niter;
- XMLNode *child;
nlist = node.children();
for (niter = nlist.begin(); niter != nlist.end(); ++niter){
child = *niter;
- if (child->name() == X_("recenable")) {
- _rec_enable_control->set_state (*child, version);
- _session.add_controllable (_rec_enable_control);
- }
- }
-
- if (version >= 3000) {
- if ((child = find_named_node (node, X_("Diskstream"))) != 0) {
- boost::shared_ptr<AudioDiskstream> ds (new AudioDiskstream (_session, *child));
- ds->do_refill_with_alloc ();
- set_diskstream (ds);
+ if (child->name() == Controllable::xml_node_name && (prop = child->property ("name")) != 0) {
+ if (prop->value() == X_("recenable")) {
+ _rec_enable_control->set_state (*child, version);
+ }
}
}
}
int
-AudioTrack::roll (nframes_t nframes, framepos_t start_frame, framepos_t end_frame, int declick,
- bool can_record, bool rec_monitors_input, bool& need_butler)
+AudioTrack::roll (pframes_t nframes, framepos_t start_frame, framepos_t end_frame, int declick,
+ bool can_record, bool& need_butler)
{
Glib::RWLock::ReaderLock lm (_processor_lock, Glib::TRY_LOCK);
if (!lm.locked()) {
int dret;
Sample* b;
Sample* tmpb;
- nframes_t transport_frame;
+ framepos_t transport_frame;
boost::shared_ptr<AudioDiskstream> diskstream = audio_diskstream();
-
+
automation_snapshot (start_frame, false);
if (n_outputs().n_total() == 0 && _processors.empty()) {
}
if (!_active) {
- silence (nframes);
+ silence (nframes);
return 0;
}
playback distance to zero, thus causing diskstream::commit
to do nothing.
*/
- return diskstream->process (transport_frame, 0, can_record, rec_monitors_input, need_butler);
+ return diskstream->process (transport_frame, 0, can_record, need_butler);
}
_silent = false;
_amp->apply_gain_automation(false);
- if ((dret = diskstream->process (transport_frame, nframes, can_record, rec_monitors_input, need_butler)) != 0) {
+ if ((dret = diskstream->process (transport_frame, nframes, can_record, need_butler)) != 0) {
silence (nframes);
return dret;
}
Sample* bb = bufs.get_audio (i).data();
- for (nframes_t xx = 0; xx < nframes; ++xx) {
+ for (pframes_t xx = 0; xx < nframes; ++xx) {
bb[xx] = b[xx] * scaling;
}
bufs.set_count (chn);
}
- /* don't waste time with automation if we're recording or we've just stopped (yes it can happen) */
-
- if (!diskstream->record_enabled() && _session.transport_rolling()) {
-#ifdef XXX_MOVE_THIS_TO_AMP
- Glib::Mutex::Lock am (data().control_lock(), Glib::TRY_LOCK);
+ /* final argument: don't waste time with automation if we're recording or we've just stopped (yes it can happen) */
- if (am.locked() && gain_control()->automation_playback()) {
- _amp->apply_gain_automation(
- gain_control()->list()->curve().rt_safe_get_vector (
- start_frame, end_frame, _session.gain_automation_buffer(), nframes));
- }
-#endif
- }
-
- process_output_buffers (bufs, start_frame, end_frame, nframes, (!_session.get_record_enabled() || !Config->get_do_not_record_plugins()), declick);
+ process_output_buffers (
+ bufs, start_frame, end_frame, nframes,
+ (!_session.get_record_enabled() || !Config->get_do_not_record_plugins()),
+ declick,
+ (!diskstream->record_enabled() && _session.transport_rolling()));
} else {
/* problem with the diskstream; just be quiet for a bit */
Glib::RWLock::ReaderLock rlock (_processor_lock);
boost::shared_ptr<AudioPlaylist> apl = boost::dynamic_pointer_cast<AudioPlaylist>(diskstream->playlist());
- assert(apl);
+ assert(apl);
+ assert(buffers.count().n_audio() >= 1);
assert ((framecnt_t) buffers.get_audio(0).capacity() >= nframes);
if (apl->read (buffers.get_audio(0).data(), mix_buffer.get(), gain_buffer.get(), start, nframes) != nframes) {
return -1;
}
- assert(buffers.count().n_audio() >= 1);
uint32_t n=1;
Sample* b = buffers.get_audio(0).data();
BufferSet::audio_iterator bi = buffers.audio_begin();
return -1;
}
b = bi->data();
- }
- else {
+ } else {
/* duplicate last across remaining buffers */
memcpy (bi->data(), b, sizeof (Sample) * nframes);
}
boost::shared_ptr<Processor> processor = boost::dynamic_pointer_cast<Processor> (*i);
boost::shared_ptr<Delivery> delivery = boost::dynamic_pointer_cast<Delivery> (*i);
boost::shared_ptr<PeakMeter> meter = boost::dynamic_pointer_cast<PeakMeter> (*i);
-
+
if (processor && (!delivery || !Delivery::role_requires_output_ports (delivery->role())) && !meter) {
processor->run (buffers, start, start+nframes, nframes, true);
}
}
boost::shared_ptr<Region>
-AudioTrack::bounce_range (nframes_t start, nframes_t end, InterThreadInfo& itt, bool enable_processing)
+AudioTrack::bounce_range (framepos_t start, framepos_t end, InterThreadInfo& itt, bool enable_processing)
{
vector<boost::shared_ptr<Source> > srcs;
return _session.write_one_track (*this, start, end, false, srcs, itt, enable_processing);
/* create a new region from all filesources, keep it private */
PropertyList plist;
-
+
plist.add (Properties::start, 0);
plist.add (Properties::length, srcs[0]->length(srcs[0]->timeline_position()));
plist.add (Properties::name, region_name);
return ds->write_source (n);
}
+bool
+AudioTrack::bounceable () const
+{
+ return n_inputs().n_audio() >= n_outputs().n_audio();
+}