#include "ardour/session.h"
#include "ardour/utils.h"
#include "ardour/session_playlists.h"
+#include "ardour/delivery.h"
+#include "ardour/meter.h"
#include "i18n.h"
using namespace std;
AudioDiskstream* dsp (new AudioDiskstream (_session, name(), dflags));
boost::shared_ptr<AudioDiskstream> ds (dsp);
- _session.add_diskstream (ds);
+ ds->do_refill_with_alloc ();
+ ds->set_block_size (_session.get_block_size ());
set_diskstream (ds);
}
void
AudioTrack::set_diskstream (boost::shared_ptr<Diskstream> ds)
{
- _diskstream = ds;
- _diskstream->set_route (*this);
+ Track::set_diskstream (ds);
+
+ _diskstream->set_track (this);
_diskstream->set_destructive (_mode == Destructive);
_diskstream->set_non_layered (_mode == NonLayered);
}
}
+ 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);
+ }
+ }
+
pending_state = const_cast<XMLNode*> (&node);
if (_session.state_of_the_state() & Session::Loading) {
}
XMLNode&
-AudioTrack::state(bool full_state)
+AudioTrack::state (bool full_state)
{
XMLNode& root (Route::state(full_state));
XMLNode* freeze_node;
root.add_child_nocopy (*freeze_node);
}
- /* Alignment: act as a proxy for the diskstream */
-
- XMLNode* align_node = new XMLNode (X_("Alignment"));
- AlignStyle as = _diskstream->alignment_style ();
- align_node->add_property (X_("style"), enum_2_string (as));
- root.add_child_nocopy (*align_node);
-
root.add_property (X_("mode"), enum_2_string (_mode));
-
- /* we don't return diskstream state because we don't
- own the diskstream exclusively. control of the diskstream
- state is ceded to the Session, even if we create the
- diskstream.
- */
-
- _diskstream->id().print (buf, sizeof (buf));
- root.add_property ("diskstream-id", buf);
-
root.add_child_nocopy (_rec_enable_control->get_state());
+ root.add_child_nocopy (_diskstream->get_state ());
return root;
}
_freeze_record.processor_info.push_back (frii);
}
}
-
- /* Alignment: act as a proxy for the diskstream */
-
- if ((fnode = find_named_node (*pending_state, X_("Alignment"))) != 0) {
-
- if ((prop = fnode->property (X_("style"))) != 0) {
-
- /* fix for older sessions from before EnumWriter */
-
- string pstr;
-
- if (prop->value() == "capture") {
- pstr = "CaptureTime";
- } else if (prop->value() == "existing") {
- pstr = "ExistingMaterial";
- } else {
- pstr = prop->value();
- }
-
- AlignStyle as = AlignStyle (string_2_enum (pstr, as));
- _diskstream->set_persistent_align_style (as);
- }
- }
- return;
}
int
AudioTrack::export_stuff (BufferSet& buffers, sframes_t start, nframes_t nframes, bool enable_processing)
{
boost::scoped_array<gain_t> gain_buffer (new gain_t[nframes]);
- boost::scoped_array<float> mix_buffer (new float[nframes]);
- ProcessorList::iterator i;
+ boost::scoped_array<Sample> mix_buffer (new Sample[nframes]);
boost::shared_ptr<AudioDiskstream> diskstream = audio_diskstream();
Glib::RWLock::ReaderLock rlock (_processor_lock);
/* note: only run processors during export. other layers in the machinery
will already have checked that there are no external port processors.
+ Also, don't run deliveries that write to real output ports, and don't
+ run meters.
*/
- for (i = _processors.begin(); i != _processors.end(); ++i) {
- boost::shared_ptr<Processor> processor;
- if ((processor = boost::dynamic_pointer_cast<Processor>(*i)) != 0) {
+ for (ProcessorList::iterator i = _processors.begin(); i != _processors.end(); ++i) {
+ 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);
}
}
new_playlist = PlaylistFactory::create (DataType::AUDIO, _session, new_playlist_name, false);
- _freeze_record.gain = _amp->gain();
- _freeze_record.gain_automation_state = _amp->gain_control()->automation_state();
/* XXX need main outs automation state _freeze_record.pan_automation_state = _mainpanner->automation_state(); */
region_name = new_playlist_name;
boost::shared_ptr<Region> region (RegionFactory::create (srcs, plist, false));
- new_playlist->set_orig_diskstream_id (diskstream->id());
+ new_playlist->set_orig_diskstream_id (_diskstream->id());
new_playlist->add_region (region, _session.current_start_frame());
new_playlist->set_frozen (true);
region->set_locked (true);
}
_freeze_record.playlist.reset ();
- set_gain (_freeze_record.gain, this);
- _amp->gain_control()->set_automation_state (_freeze_record.gain_automation_state);
/* XXX need to use _main_outs _panner->set_automation_state (_freeze_record.pan_automation_state); */
}
FreezeChange (); /* EMIT SIGNAL */
}
+boost::shared_ptr<AudioFileSource>
+AudioTrack::write_source (uint32_t n)
+{
+ boost::shared_ptr<AudioDiskstream> ds = boost::dynamic_pointer_cast<AudioDiskstream> (_diskstream);
+ assert (ds);
+ return ds->write_source (n);
+}