#include "pbd/memento_command.h"
#include "pbd/xml++.h"
#include "pbd/stacktrace.h"
+#include "pbd/enum_convert.h"
+#include "pbd/types_convert.h"
#include "ardour/debug.h"
#include "ardour/diskstream.h"
#include "ardour/playlist.h"
#include "ardour/session.h"
#include "ardour/track.h"
+#include "ardour/types_convert.h"
-#include "i18n.h"
+#include "pbd/i18n.h"
#include <locale.h>
using namespace std;
using namespace ARDOUR;
using namespace PBD;
+namespace PBD {
+ DEFINE_ENUM_CONVERT(Diskstream::Flag);
+}
+
ARDOUR::framecnt_t Diskstream::disk_read_chunk_frames = default_disk_read_chunk_frames ();
ARDOUR::framecnt_t Diskstream::disk_write_chunk_frames = default_disk_write_chunk_frames ();
delete deprecated_io_node;
}
+bool
+Diskstream::non_layered () const
+{
+ return _session.config.get_layered_record_mode();
+}
+
void
Diskstream::set_track (Track* t)
{
_capture_offset = 0;
break;
}
+#ifdef MIXBUS
+ framecnt_t port_offset;
+ if (_track->mixbus_internal_bounce (port_offset)) {
+ /* _capture_offset may become negative, but the sum
+ * _capture_offset + existing_material_offset
+ * will be postive.
+ */
+ _capture_offset -= port_offset;
+ }
+#endif
DEBUG_TRACE (DEBUG::CaptureAlignment, string_compose ("%1: using IO latency, capture offset set to %2 with style = %3\n", name(), _capture_offset, enum_2_string (_alignment_style)));
}
_playlist = playlist;
_playlist->use();
- if (!in_set_state && recordable()) {
+ if (!in_set_state && destructive() && recordable()) {
reset_write_sources (false);
}
Diskstream::get_state ()
{
XMLNode* node = new XMLNode ("Diskstream");
- char buf[64];
- LocaleGuard lg (X_("C"));
-
- node->add_property ("flags", enum_2_string (_flags));
- node->add_property ("playlist", _playlist->name());
- node->add_property("name", _name);
- id().print (buf, sizeof (buf));
- node->add_property("id", buf);
- snprintf (buf, sizeof(buf), "%f", _visible_speed);
- node->add_property ("speed", buf);
- node->add_property ("capture-alignment", enum_2_string (_alignment_choice));
- node->add_property ("record-safe", _record_safe ? "yes" : "no");
+ LocaleGuard lg;
+
+ node->set_property ("flags", _flags);
+ node->set_property ("playlist", _playlist->name());
+ node->set_property ("name", name());
+ node->set_property ("id", id ());
+ node->set_property ("speed", _visible_speed);
+ node->set_property ("capture-alignment", _alignment_choice);
+ node->set_property ("record-safe", _record_safe);
if (_extra_xml) {
node->add_child_copy (*_extra_xml);
}
-
- return *node;
+ return *node;
}
int
Diskstream::set_state (const XMLNode& node, int /*version*/)
{
- XMLProperty const * prop;
-
- if ((prop = node.property ("name")) != 0) {
- _name = prop->value();
+ std::string name;
+ if (node.get_property ("name", name)) {
+ _name = name;
}
if (deprecated_io_node) {
set_id (node);
}
- if ((prop = node.property ("flags")) != 0) {
- _flags = Flag (string_2_enum (prop->value(), _flags));
- }
+ node.get_property ("flags", _flags);
if (Profile->get_trx() && (_flags & Destructive)) {
error << string_compose (_("%1: this session uses destructive tracks, which are not supported"), PROGRAM_NAME) << endmsg;
return -1;
}
- if ((prop = node.property (X_("capture-alignment"))) != 0) {
- set_align_choice (AlignChoice (string_2_enum (prop->value(), _alignment_choice)), true);
- } else {
- set_align_choice (Automatic, true);
- }
+ AlignChoice achoice = Automatic;
+ node.get_property (X_("capture-alignment"), achoice);
+ set_align_choice (achoice, true);
+
+ XMLProperty const * prop;
if ((prop = node.property ("playlist")) == 0) {
return -1;
return -1;
}
- if ((prop = node.property ("speed")) != 0) {
- double sp = atof (prop->value().c_str());
-
+ double sp;
+ if (node.get_property ("speed", sp)) {
if (realtime_set_speed (sp, false)) {
non_realtime_set_speed ();
}
}
- if ((prop = node.property ("record-safe")) != 0) {
- _record_safe = PBD::string_is_affirmative (prop->value()) ? 1 : 0;
+ bool record_safe;
+ if (node.get_property ("record-safe", record_safe)) {
+ _record_safe = record_safe ? 1 : 0;
}
return 0;
continue;
}
boost::shared_ptr<AutomationList> alist = ac->alist();
-
+ if (!alist->size()) {
+ continue;
+ }
XMLNode & before = alist->get_state ();
bool const things_moved = alist->move_ranges (movements);
if (things_moved) {
for (set<Evoral::Parameter>::const_iterator i = a.begin (); i != a.end (); ++i) {
boost::shared_ptr<AutomationList> al = processor->automation_control(*i)->alist();
+ if (!al->size()) {
+ continue;
+ }
XMLNode & before = al->get_state ();
bool const things_moved = al->move_ranges (movements);
if (things_moved) {