mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-10 08:36:32 +01:00
segment descriptor: save state
This commit is contained in:
parent
cf10808640
commit
bb75b03724
2 changed files with 40 additions and 0 deletions
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue