segment descriptor: save state
This commit is contained in:
@@ -22,6 +22,8 @@
|
||||
#include "temporal/timeline.h"
|
||||
#include "temporal/tempo.h"
|
||||
|
||||
class XMLNode;
|
||||
|
||||
namespace ARDOUR {
|
||||
|
||||
/* An object that describes an extent (duration & position), along with a
|
||||
@@ -58,6 +60,11 @@ public:
|
||||
Temporal::Meter meter() const { return _meter; }
|
||||
void set_meter (Temporal::Meter const&);
|
||||
|
||||
/* Replicate the API of PBD::Stateful without the overhead */
|
||||
|
||||
XMLNode& get_state (void);
|
||||
int set_state (const XMLNode&, int version);
|
||||
|
||||
private:
|
||||
Temporal::TimeDomain _time_domain;
|
||||
|
||||
|
||||
@@ -16,6 +16,12 @@
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#include "pbd/xml++.h"
|
||||
#include "pbd/enumwriter.h"
|
||||
#include "pbd/i18n.h"
|
||||
|
||||
#include "temporal/tempo.h"
|
||||
|
||||
#include "ardour/segment_descriptor.h"
|
||||
|
||||
using namespace ARDOUR;
|
||||
@@ -107,3 +113,30 @@ SegmentDescriptor::set_meter (Meter const & m)
|
||||
{
|
||||
_meter = m;
|
||||
}
|
||||
|
||||
XMLNode&
|
||||
SegmentDescriptor::get_state (void)
|
||||
{
|
||||
XMLNode* root = new XMLNode (X_("SegmentDescriptor"));
|
||||
|
||||
root->set_property (X_("time-domain"), _time_domain);
|
||||
|
||||
if (_time_domain == Temporal::AudioTime) {
|
||||
root->set_property (X_("position"), _position_samples);
|
||||
root->set_property (X_("duration"), _duration_samples);
|
||||
} else {
|
||||
root->set_property (X_("position"), _position_beats);
|
||||
root->set_property (X_("duration"), _duration_beats);
|
||||
}
|
||||
|
||||
root->add_child_nocopy (_tempo.get_state());
|
||||
root->add_child_nocopy (_meter.get_state());
|
||||
|
||||
return *root;
|
||||
}
|
||||
|
||||
int
|
||||
SegmentDescriptor::set_state (const XMLNode&, int version)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user