X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=libs%2Fardour%2Fsource.cc;h=a11e82f1e81b245e912ca9f3e2a1439ee2fbd71c;hb=8ab17e96312f1a61c014c50687e15430d5ae786b;hp=7f680e7100f6e934725d7737e07f5a49cd0145b8;hpb=45d3ec1437cf661533bc7750c623865def4424df;p=ardour.git diff --git a/libs/ardour/source.cc b/libs/ardour/source.cc index 7f680e7100..a11e82f1e8 100644 --- a/libs/ardour/source.cc +++ b/libs/ardour/source.cc @@ -42,21 +42,27 @@ using std::max; using namespace ARDOUR; -Source::Source (Session& s, string name) - : _session (s) +Source::Source (Session& s, const string& name, DataType type) + : SessionObject(s, name) + , _type(type) { - _name = name; + // not true.. is this supposed to be an assertion? + //assert(_name.find("/") == string::npos); + _timestamp = 0; + _length = 0; _in_use = 0; } Source::Source (Session& s, const XMLNode& node) - : _session (s) + : SessionObject(s, "unnamed source") + , _type(DataType::AUDIO) { _timestamp = 0; + _length = 0; _in_use = 0; - if (set_state (node)) { + if (set_state (node) || _type == DataType::NIL) { throw failed_constructor(); } } @@ -73,6 +79,7 @@ Source::get_state () char buf[64]; node->add_property ("name", _name); + node->add_property ("type", _type.to_string()); _id.print (buf, sizeof (buf)); node->add_property ("id", buf); @@ -101,13 +108,28 @@ Source::set_state (const XMLNode& node) return -1; } + if ((prop = node.property ("type")) != 0) { + _type = DataType(prop->value()); + } + if ((prop = node.property ("timestamp")) != 0) { sscanf (prop->value().c_str(), "%ld", &_timestamp); } + + // Don't think this is valid, absolute paths fail + //assert(_name.find("/") == string::npos); return 0; } +void +Source::update_length (nframes_t pos, nframes_t cnt) +{ + if (pos + cnt > _length) { + _length = pos+cnt; + } +} + void Source::add_playlist (boost::shared_ptr pl) {