mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-17 12:16:30 +01:00
make Stateful::_id private and provide appropriate methods to set it, and use them throughout ardour
git-svn-id: svn://localhost/ardour2/branches/3.0@10222 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
9ec965a54e
commit
4085309cdb
27 changed files with 82 additions and 96 deletions
|
|
@ -3701,12 +3701,6 @@ ARDOUR_UI::TransportControllable::get_value (void) const
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
ARDOUR_UI::TransportControllable::set_id (const string& str)
|
|
||||||
{
|
|
||||||
_id = str;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ARDOUR_UI::setup_profile ()
|
ARDOUR_UI::setup_profile ()
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -401,8 +401,6 @@ class ARDOUR_UI : public Gtkmm2ext::UI, public ARDOUR::SessionHandlePtr
|
||||||
void set_value (double);
|
void set_value (double);
|
||||||
double get_value (void) const;
|
double get_value (void) const;
|
||||||
|
|
||||||
void set_id (const std::string&);
|
|
||||||
|
|
||||||
ARDOUR_UI& ui;
|
ARDOUR_UI& ui;
|
||||||
ToggleType type;
|
ToggleType type;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -1244,7 +1244,7 @@ Editor::set_session (Session *t)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* register for undo history */
|
/* register for undo history */
|
||||||
_session->register_with_memento_command_factory(_id, this);
|
_session->register_with_memento_command_factory(id(), this);
|
||||||
|
|
||||||
ActionManager::ui_manager->signal_pre_activate().connect (sigc::mem_fun (*this, &Editor::action_pre_activated));
|
ActionManager::ui_manager->signal_pre_activate().connect (sigc::mem_fun (*this, &Editor::action_pre_activated));
|
||||||
|
|
||||||
|
|
@ -2160,9 +2160,7 @@ Editor::set_state (const XMLNode& node, int /*version*/)
|
||||||
int x, y;
|
int x, y;
|
||||||
Gdk::Geometry g;
|
Gdk::Geometry g;
|
||||||
|
|
||||||
if ((prop = node.property ("id")) != 0) {
|
set_id (node);
|
||||||
_id = prop->value ();
|
|
||||||
}
|
|
||||||
|
|
||||||
g.base_width = default_width;
|
g.base_width = default_width;
|
||||||
g.base_height = default_height;
|
g.base_height = default_height;
|
||||||
|
|
@ -2374,7 +2372,7 @@ Editor::get_state ()
|
||||||
XMLNode* node = new XMLNode ("Editor");
|
XMLNode* node = new XMLNode ("Editor");
|
||||||
char buf[32];
|
char buf[32];
|
||||||
|
|
||||||
_id.print (buf, sizeof (buf));
|
id().print (buf, sizeof (buf));
|
||||||
node->add_property ("id", buf);
|
node->add_property ("id", buf);
|
||||||
|
|
||||||
if (is_realized()) {
|
if (is_realized()) {
|
||||||
|
|
|
||||||
|
|
@ -611,12 +611,6 @@ ShuttleControl::ShuttleControllable::ShuttleControllable (ShuttleControl& s)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
ShuttleControl::ShuttleControllable::set_id (const std::string& str)
|
|
||||||
{
|
|
||||||
_id = str;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ShuttleControl::ShuttleControllable::set_value (double val)
|
ShuttleControl::ShuttleControllable::set_value (double val)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -49,8 +49,6 @@ class ShuttleControl : public Gtk::DrawingArea, public ARDOUR::SessionHandlePtr
|
||||||
void set_value (double);
|
void set_value (double);
|
||||||
double get_value (void) const;
|
double get_value (void) const;
|
||||||
|
|
||||||
void set_id (const std::string&);
|
|
||||||
|
|
||||||
ShuttleControl& sc;
|
ShuttleControl& sc;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -109,7 +109,8 @@ TimeAxisViewItem::TimeAxisViewItem(
|
||||||
}
|
}
|
||||||
|
|
||||||
TimeAxisViewItem::TimeAxisViewItem (const TimeAxisViewItem& other)
|
TimeAxisViewItem::TimeAxisViewItem (const TimeAxisViewItem& other)
|
||||||
: Selectable (other)
|
: trackable (other)
|
||||||
|
, Selectable (other)
|
||||||
, PBD::ScopedConnectionList()
|
, PBD::ScopedConnectionList()
|
||||||
, trackview (other.trackview)
|
, trackview (other.trackview)
|
||||||
, _recregion (other._recregion)
|
, _recregion (other._recregion)
|
||||||
|
|
|
||||||
|
|
@ -773,7 +773,7 @@ AudioDiskstream::overwrite_existing_buffers ()
|
||||||
|
|
||||||
if (read ((*chan)->playback_buf->buffer() + overwrite_offset, mixdown_buffer, gain_buffer, start, to_read, *chan, n, reversed)) {
|
if (read ((*chan)->playback_buf->buffer() + overwrite_offset, mixdown_buffer, gain_buffer, start, to_read, *chan, n, reversed)) {
|
||||||
error << string_compose(_("AudioDiskstream %1: when refilling, cannot read %2 from playlist at frame %3"),
|
error << string_compose(_("AudioDiskstream %1: when refilling, cannot read %2 from playlist at frame %3"),
|
||||||
_id, size, playback_sample) << endmsg;
|
id(), size, playback_sample) << endmsg;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -784,7 +784,7 @@ AudioDiskstream::overwrite_existing_buffers ()
|
||||||
if (read ((*chan)->playback_buf->buffer(), mixdown_buffer, gain_buffer,
|
if (read ((*chan)->playback_buf->buffer(), mixdown_buffer, gain_buffer,
|
||||||
start, cnt, *chan, n, reversed)) {
|
start, cnt, *chan, n, reversed)) {
|
||||||
error << string_compose(_("AudioDiskstream %1: when refilling, cannot read %2 from playlist at frame %3"),
|
error << string_compose(_("AudioDiskstream %1: when refilling, cannot read %2 from playlist at frame %3"),
|
||||||
_id, size, playback_sample) << endmsg;
|
id(), size, playback_sample) << endmsg;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -933,7 +933,7 @@ AudioDiskstream::read (Sample* buf, Sample* mixdown_buffer, float* gain_buffer,
|
||||||
this_read = min(cnt,this_read);
|
this_read = min(cnt,this_read);
|
||||||
|
|
||||||
if (audio_playlist()->read (buf+offset, mixdown_buffer, gain_buffer, start, this_read, channel) != this_read) {
|
if (audio_playlist()->read (buf+offset, mixdown_buffer, gain_buffer, start, this_read, channel) != this_read) {
|
||||||
error << string_compose(_("AudioDiskstream %1: cannot read %2 from playlist at frame %3"), _id, this_read,
|
error << string_compose(_("AudioDiskstream %1: cannot read %2 from playlist at frame %3"), id(), this_read,
|
||||||
start) << endmsg;
|
start) << endmsg;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
@ -1302,7 +1302,7 @@ AudioDiskstream::do_flush (RunContext /*context*/, bool force_flush)
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((!(*chan)->write_source) || (*chan)->write_source->write (vector.buf[0], to_write) != to_write) {
|
if ((!(*chan)->write_source) || (*chan)->write_source->write (vector.buf[0], to_write) != to_write) {
|
||||||
error << string_compose(_("AudioDiskstream %1: cannot write to disk"), _id) << endmsg;
|
error << string_compose(_("AudioDiskstream %1: cannot write to disk"), id()) << endmsg;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1319,7 +1319,7 @@ AudioDiskstream::do_flush (RunContext /*context*/, bool force_flush)
|
||||||
to_write = min ((framecnt_t)(disk_io_chunk_frames - to_write), (framecnt_t) vector.len[1]);
|
to_write = min ((framecnt_t)(disk_io_chunk_frames - to_write), (framecnt_t) vector.len[1]);
|
||||||
|
|
||||||
if ((*chan)->write_source->write (vector.buf[1], to_write) != to_write) {
|
if ((*chan)->write_source->write (vector.buf[1], to_write) != to_write) {
|
||||||
error << string_compose(_("AudioDiskstream %1: cannot write to disk"), _id) << endmsg;
|
error << string_compose(_("AudioDiskstream %1: cannot write to disk"), id()) << endmsg;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -270,7 +270,7 @@ AutomationList::state (bool full)
|
||||||
|
|
||||||
root->add_property ("automation-id", EventTypeMap::instance().to_symbol(_parameter));
|
root->add_property ("automation-id", EventTypeMap::instance().to_symbol(_parameter));
|
||||||
|
|
||||||
root->add_property ("id", _id.to_s());
|
root->add_property ("id", id().to_s());
|
||||||
|
|
||||||
snprintf (buf, sizeof (buf), "%.12g", _default_value);
|
snprintf (buf, sizeof (buf), "%.12g", _default_value);
|
||||||
root->add_property ("default", buf);
|
root->add_property ("default", buf);
|
||||||
|
|
@ -437,8 +437,7 @@ AutomationList::set_state (const XMLNode& node, int version)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((prop = node.property ("id")) != 0) {
|
if (set_id (node)) {
|
||||||
_id = prop->value ();
|
|
||||||
/* update session AL list */
|
/* update session AL list */
|
||||||
AutomationListCreated(this);
|
AutomationListCreated(this);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -778,9 +778,7 @@ Crossfade::set_state (const XMLNode& node, int /*version*/)
|
||||||
PropertyChange what_changed;
|
PropertyChange what_changed;
|
||||||
framepos_t val;
|
framepos_t val;
|
||||||
|
|
||||||
if ((prop = node.property (X_("id")))) {
|
set_id (node);
|
||||||
_id = prop->value();
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((prop = node.property ("position")) != 0) {
|
if ((prop = node.property ("position")) != 0) {
|
||||||
sscanf (prop->value().c_str(), "%" PRId64, &val);
|
sscanf (prop->value().c_str(), "%" PRId64, &val);
|
||||||
|
|
|
||||||
|
|
@ -495,13 +495,9 @@ Diskstream::set_state (const XMLNode& node, int /*version*/)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (deprecated_io_node) {
|
if (deprecated_io_node) {
|
||||||
if ((prop = deprecated_io_node->property ("id")) != 0) {
|
set_id (*deprecated_io_node);
|
||||||
_id = prop->value ();
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
if ((prop = node.property ("id")) != 0) {
|
set_id (node);
|
||||||
_id = prop->value ();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((prop = node.property ("flags")) != 0) {
|
if ((prop = node.property ("flags")) != 0) {
|
||||||
|
|
|
||||||
|
|
@ -575,9 +575,7 @@ IO::set_state (const XMLNode& node, int version)
|
||||||
assert(_default_type != DataType::NIL);
|
assert(_default_type != DataType::NIL);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((prop = node.property ("id")) != 0) {
|
set_id (node);
|
||||||
_id = prop->value ();
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((prop = node.property ("direction")) != 0) {
|
if ((prop = node.property ("direction")) != 0) {
|
||||||
_direction = (Direction) string_2_enum (prop->value(), _direction);
|
_direction = (Direction) string_2_enum (prop->value(), _direction);
|
||||||
|
|
@ -633,9 +631,7 @@ IO::set_state_2X (const XMLNode& node, int version, bool in)
|
||||||
assert(_default_type != DataType::NIL);
|
assert(_default_type != DataType::NIL);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((prop = node.property ("id")) != 0) {
|
set_id (node);
|
||||||
_id = prop->value ();
|
|
||||||
}
|
|
||||||
|
|
||||||
_direction = in ? Input : Output;
|
_direction = in ? Input : Output;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -419,10 +419,8 @@ Location::set_state (const XMLNode& node, int /*version*/)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((prop = node.property ("id")) == 0) {
|
if (!set_id (node)) {
|
||||||
warning << _("XML node for Location has no ID information") << endmsg;
|
warning << _("XML node for Location has no ID information") << endmsg;
|
||||||
} else {
|
|
||||||
_id = prop->value ();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((prop = node.property ("name")) == 0) {
|
if ((prop = node.property ("name")) == 0) {
|
||||||
|
|
|
||||||
|
|
@ -366,10 +366,8 @@ LXVSTPlugin::load_user_preset (PresetRecord r)
|
||||||
XMLNode* root = t->root ();
|
XMLNode* root = t->root ();
|
||||||
|
|
||||||
for (XMLNodeList::const_iterator i = root->children().begin(); i != root->children().end(); ++i) {
|
for (XMLNodeList::const_iterator i = root->children().begin(); i != root->children().end(); ++i) {
|
||||||
XMLProperty* uri = (*i)->property (X_("uri"));
|
|
||||||
XMLProperty* label = (*i)->property (X_("label"));
|
XMLProperty* label = (*i)->property (X_("label"));
|
||||||
|
|
||||||
assert (uri);
|
|
||||||
assert (label);
|
assert (label);
|
||||||
|
|
||||||
if (label->value() != r.label) {
|
if (label->value() != r.label) {
|
||||||
|
|
|
||||||
|
|
@ -761,7 +761,7 @@ MidiDiskstream::read (framepos_t& start, framecnt_t dur, bool reversed)
|
||||||
if (midi_playlist()->read (*_playback_buf, start, this_read) != this_read) {
|
if (midi_playlist()->read (*_playback_buf, start, this_read) != this_read) {
|
||||||
error << string_compose(
|
error << string_compose(
|
||||||
_("MidiDiskstream %1: cannot read %2 from playlist at frame %3"),
|
_("MidiDiskstream %1: cannot read %2 from playlist at frame %3"),
|
||||||
_id, this_read, start) << endmsg;
|
id(), this_read, start) << endmsg;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -905,7 +905,7 @@ MidiDiskstream::do_flush (RunContext /*context*/, bool force_flush)
|
||||||
|
|
||||||
if (record_enabled() && ((total > disk_io_chunk_frames) || force_flush)) {
|
if (record_enabled() && ((total > disk_io_chunk_frames) || force_flush)) {
|
||||||
if (_write_source->midi_write (*_capture_buf, get_capture_start_frame (0), to_write) != to_write) {
|
if (_write_source->midi_write (*_capture_buf, get_capture_start_frame (0), to_write) != to_write) {
|
||||||
error << string_compose(_("MidiDiskstream %1: cannot write to disk"), _id) << endmsg;
|
error << string_compose(_("MidiDiskstream %1: cannot write to disk"), id()) << endmsg;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2213,6 +2213,8 @@ Playlist::flush_notifications (bool from_undo)
|
||||||
|
|
||||||
plist = node.properties();
|
plist = node.properties();
|
||||||
|
|
||||||
|
set_id (node);
|
||||||
|
|
||||||
for (piter = plist.begin(); piter != plist.end(); ++piter) {
|
for (piter = plist.begin(); piter != plist.end(); ++piter) {
|
||||||
|
|
||||||
prop = *piter;
|
prop = *piter;
|
||||||
|
|
@ -2220,8 +2222,6 @@ Playlist::flush_notifications (bool from_undo)
|
||||||
if (prop->name() == X_("name")) {
|
if (prop->name() == X_("name")) {
|
||||||
_name = prop->value();
|
_name = prop->value();
|
||||||
_set_sort_id ();
|
_set_sort_id ();
|
||||||
} else if (prop->name() == X_("id")) {
|
|
||||||
_id = prop->value();
|
|
||||||
} else if (prop->name() == X_("orig-diskstream-id")) {
|
} else if (prop->name() == X_("orig-diskstream-id")) {
|
||||||
_orig_diskstream_id = prop->value ();
|
_orig_diskstream_id = prop->value ();
|
||||||
} else if (prop->name() == X_("frozen")) {
|
} else if (prop->name() == X_("frozen")) {
|
||||||
|
|
|
||||||
|
|
@ -86,7 +86,7 @@ PlaylistSource::add_state (XMLNode& node)
|
||||||
node.add_property ("offset", buf);
|
node.add_property ("offset", buf);
|
||||||
snprintf (buf, sizeof (buf), "%" PRIu64, _playlist_length);
|
snprintf (buf, sizeof (buf), "%" PRIu64, _playlist_length);
|
||||||
node.add_property ("length", buf);
|
node.add_property ("length", buf);
|
||||||
node.add_property ("original", _id.to_s());
|
node.add_property ("original", id().to_s());
|
||||||
|
|
||||||
node.add_child_nocopy (_playlist->get_state());
|
node.add_child_nocopy (_playlist->get_state());
|
||||||
}
|
}
|
||||||
|
|
@ -141,11 +141,15 @@ PlaylistSource::set_state (const XMLNode& node, int /*version*/)
|
||||||
|
|
||||||
sscanf (prop->value().c_str(), "%" PRIu64, &_playlist_length);
|
sscanf (prop->value().c_str(), "%" PRIu64, &_playlist_length);
|
||||||
|
|
||||||
|
/* XXX not quite sure why we set our ID back to the "original" one
|
||||||
|
here. october 2011, paul
|
||||||
|
*/
|
||||||
|
|
||||||
if ((prop = node.property (X_("original"))) == 0) {
|
if ((prop = node.property (X_("original"))) == 0) {
|
||||||
throw failed_constructor ();
|
throw failed_constructor ();
|
||||||
}
|
}
|
||||||
|
|
||||||
_id = prop->value();
|
set_id (prop->value());
|
||||||
|
|
||||||
_level = _playlist->max_source_level () + 1;
|
_level = _playlist->max_source_level () + 1;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -75,9 +75,6 @@ PluginInsert::PluginInsert (Session& s, boost::shared_ptr<Plugin> plug)
|
||||||
if (plug) {
|
if (plug) {
|
||||||
add_plugin (plug);
|
add_plugin (plug);
|
||||||
create_automatable_parameters ();
|
create_automatable_parameters ();
|
||||||
|
|
||||||
Glib::Mutex::Lock em (_session.engine().process_lock());
|
|
||||||
IO::PortCountChanged (max(input_streams(), output_streams()));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -950,9 +947,7 @@ PluginInsert::set_state(const XMLNode& node, int version)
|
||||||
// state. We can't call Processor::set_state() until
|
// state. We can't call Processor::set_state() until
|
||||||
// the plugins themselves are created and added.
|
// the plugins themselves are created and added.
|
||||||
|
|
||||||
if ((prop = node.property ("id")) != 0) {
|
set_id (node);
|
||||||
_id = prop->value();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_plugins.empty()) {
|
if (_plugins.empty()) {
|
||||||
/* if we are adding the first plugin, we will need to set
|
/* if we are adding the first plugin, we will need to set
|
||||||
|
|
|
||||||
|
|
@ -150,9 +150,7 @@ Processor::set_state_2X (const XMLNode & node, int /*version*/)
|
||||||
set_name (prop->value ());
|
set_name (prop->value ());
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((prop = (*i)->property ("id")) != 0) {
|
set_id (**i);
|
||||||
_id = prop->value ();
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((prop = (*i)->property ("active")) != 0) {
|
if ((prop = (*i)->property ("active")) != 0) {
|
||||||
bool const a = string_is_affirmative (prop->value ());
|
bool const a = string_is_affirmative (prop->value ());
|
||||||
|
|
@ -188,10 +186,7 @@ Processor::set_state (const XMLNode& node, int version)
|
||||||
Processor::set_name (prop->value());
|
Processor::set_name (prop->value());
|
||||||
}
|
}
|
||||||
|
|
||||||
// may not exist for legacy 3.0 sessions
|
set_id (node);
|
||||||
if ((prop = node.property ("id")) != 0) {
|
|
||||||
_id = prop->value();
|
|
||||||
}
|
|
||||||
|
|
||||||
XMLNodeList nlist = node.children();
|
XMLNodeList nlist = node.children();
|
||||||
XMLNodeIterator niter;
|
XMLNodeIterator niter;
|
||||||
|
|
|
||||||
|
|
@ -1167,7 +1167,7 @@ Region::state ()
|
||||||
|
|
||||||
add_properties (*node);
|
add_properties (*node);
|
||||||
|
|
||||||
_id.print (buf, sizeof (buf));
|
id().print (buf, sizeof (buf));
|
||||||
node->add_property ("id", buf);
|
node->add_property ("id", buf);
|
||||||
node->add_property ("type", _type.to_string());
|
node->add_property ("type", _type.to_string());
|
||||||
|
|
||||||
|
|
@ -1259,9 +1259,7 @@ Region::_set_state (const XMLNode& node, int /*version*/, PropertyChange& what_c
|
||||||
|
|
||||||
what_changed = set_values (node);
|
what_changed = set_values (node);
|
||||||
|
|
||||||
if ((prop = node.property (X_("id")))) {
|
set_id (node);
|
||||||
_id = prop->value();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_position_lock_style == MusicTime) {
|
if (_position_lock_style == MusicTime) {
|
||||||
if ((prop = node.property ("bbt-position")) == 0) {
|
if ((prop = node.property ("bbt-position")) == 0) {
|
||||||
|
|
|
||||||
|
|
@ -1886,9 +1886,7 @@ Route::_set_state (const XMLNode& node, int version, bool /*call_base*/)
|
||||||
Route::set_name (prop->value());
|
Route::set_name (prop->value());
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((prop = node.property ("id")) != 0) {
|
set_id (node);
|
||||||
_id = prop->value ();
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((prop = node.property (X_("flags"))) != 0) {
|
if ((prop = node.property (X_("flags"))) != 0) {
|
||||||
_flags = Flag (string_2_enum (prop->value(), _flags));
|
_flags = Flag (string_2_enum (prop->value(), _flags));
|
||||||
|
|
@ -2216,9 +2214,7 @@ Route::_set_state_2X (const XMLNode& node, int version)
|
||||||
Route::set_name (prop->value ());
|
Route::set_name (prop->value ());
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((prop = child->property (X_("id"))) != 0) {
|
set_id (*child);
|
||||||
_id = prop->value ();
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((prop = child->property (X_("active"))) != 0) {
|
if ((prop = child->property (X_("active"))) != 0) {
|
||||||
bool yn = string_is_affirmative (prop->value());
|
bool yn = string_is_affirmative (prop->value());
|
||||||
|
|
|
||||||
|
|
@ -251,10 +251,7 @@ RouteGroup::set_state (const XMLNode& node, int version)
|
||||||
|
|
||||||
const XMLProperty *prop;
|
const XMLProperty *prop;
|
||||||
|
|
||||||
if ((prop = node.property ("id")) != 0) {
|
set_id (node);
|
||||||
_id = prop->value();
|
|
||||||
}
|
|
||||||
|
|
||||||
set_values (node);
|
set_values (node);
|
||||||
|
|
||||||
if ((prop = node.property ("routes")) != 0) {
|
if ((prop = node.property ("routes")) != 0) {
|
||||||
|
|
|
||||||
|
|
@ -100,7 +100,7 @@ Source::get_state ()
|
||||||
node->add_property ("name", name());
|
node->add_property ("name", name());
|
||||||
node->add_property ("type", _type.to_string());
|
node->add_property ("type", _type.to_string());
|
||||||
node->add_property (X_("flags"), enum_2_string (_flags));
|
node->add_property (X_("flags"), enum_2_string (_flags));
|
||||||
_id.print (buf, sizeof (buf));
|
id().print (buf, sizeof (buf));
|
||||||
node->add_property ("id", buf);
|
node->add_property ("id", buf);
|
||||||
|
|
||||||
if (_timestamp != 0) {
|
if (_timestamp != 0) {
|
||||||
|
|
@ -122,9 +122,7 @@ Source::set_state (const XMLNode& node, int version)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((prop = node.property ("id")) != 0) {
|
if (!set_id (node)) {
|
||||||
_id = prop->value ();
|
|
||||||
} else {
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -221,7 +219,7 @@ Source::get_transients_path () const
|
||||||
s = _session.analysis_dir ();
|
s = _session.analysis_dir ();
|
||||||
parts.push_back (s);
|
parts.push_back (s);
|
||||||
|
|
||||||
s = _id.to_s();
|
s = id().to_s();
|
||||||
s += '.';
|
s += '.';
|
||||||
s += TransientDetector::operational_identifier();
|
s += TransientDetector::operational_identifier();
|
||||||
parts.push_back (s);
|
parts.push_back (s);
|
||||||
|
|
|
||||||
|
|
@ -107,7 +107,7 @@ Controllable::get_state ()
|
||||||
char buf[64];
|
char buf[64];
|
||||||
|
|
||||||
node->add_property (X_("name"), _name); // not reloaded from XML state, just there to look at
|
node->add_property (X_("name"), _name); // not reloaded from XML state, just there to look at
|
||||||
_id.print (buf, sizeof (buf));
|
id().print (buf, sizeof (buf));
|
||||||
node->add_property (X_("id"), buf);
|
node->add_property (X_("id"), buf);
|
||||||
node->add_property (X_("flags"), enum_2_string (_flags));
|
node->add_property (X_("flags"), enum_2_string (_flags));
|
||||||
snprintf (buf, sizeof (buf), "%2.12f", get_value());
|
snprintf (buf, sizeof (buf), "%2.12f", get_value());
|
||||||
|
|
@ -129,9 +129,7 @@ Controllable::set_state (const XMLNode& node, int /*version*/)
|
||||||
|
|
||||||
Stateful::save_extra_xml (node);
|
Stateful::save_extra_xml (node);
|
||||||
|
|
||||||
if ((prop = node.property (X_("id"))) != 0) {
|
if (!set_id (node)) {
|
||||||
_id = prop->value();
|
|
||||||
} else {
|
|
||||||
error << _("Controllable state node has no ID property") << endmsg;
|
error << _("Controllable state node has no ID property") << endmsg;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -44,8 +44,7 @@ ID::init ()
|
||||||
|
|
||||||
ID::ID ()
|
ID::ID ()
|
||||||
{
|
{
|
||||||
Glib::Mutex::Lock lm (*counter_lock);
|
reset ();
|
||||||
_id = _counter++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ID::ID (const ID& other)
|
ID::ID (const ID& other)
|
||||||
|
|
@ -58,6 +57,13 @@ ID::ID (string str)
|
||||||
string_assign (str);
|
string_assign (str);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
ID::reset ()
|
||||||
|
{
|
||||||
|
Glib::Mutex::Lock lm (*counter_lock);
|
||||||
|
_id = _counter++;
|
||||||
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
ID::string_assign (string str)
|
ID::string_assign (string str)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,8 @@ class ID {
|
||||||
ID (std::string);
|
ID (std::string);
|
||||||
ID (const ID&);
|
ID (const ID&);
|
||||||
|
|
||||||
|
void reset ();
|
||||||
|
|
||||||
bool operator== (const ID& other) const {
|
bool operator== (const ID& other) const {
|
||||||
return _id == other._id;
|
return _id == other._id;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -65,6 +65,9 @@ class Stateful {
|
||||||
void save_extra_xml (const XMLNode&);
|
void save_extra_xml (const XMLNode&);
|
||||||
|
|
||||||
const PBD::ID& id() const { return _id; }
|
const PBD::ID& id() const { return _id; }
|
||||||
|
bool set_id (const XMLNode&);
|
||||||
|
void set_id (const std::string&);
|
||||||
|
void reset_id ();
|
||||||
|
|
||||||
/* history management */
|
/* history management */
|
||||||
|
|
||||||
|
|
@ -106,7 +109,6 @@ class Stateful {
|
||||||
|
|
||||||
XMLNode *_extra_xml;
|
XMLNode *_extra_xml;
|
||||||
XMLNode *_instant_xml;
|
XMLNode *_instant_xml;
|
||||||
PBD::ID _id;
|
|
||||||
int32_t _frozen;
|
int32_t _frozen;
|
||||||
PBD::PropertyChange _pending_changed;
|
PBD::PropertyChange _pending_changed;
|
||||||
Glib::Mutex _lock;
|
Glib::Mutex _lock;
|
||||||
|
|
@ -120,6 +122,9 @@ class Stateful {
|
||||||
*/
|
*/
|
||||||
virtual void mid_thaw (const PropertyChange&) { }
|
virtual void mid_thaw (const PropertyChange&) { }
|
||||||
bool property_changes_suspended() const { return g_atomic_int_get (&_frozen) > 0; }
|
bool property_changes_suspended() const { return g_atomic_int_get (&_frozen) > 0; }
|
||||||
|
|
||||||
|
private:
|
||||||
|
PBD::ID _id;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace PBD
|
} // namespace PBD
|
||||||
|
|
|
||||||
|
|
@ -369,5 +369,29 @@ Stateful::clear_owned_changes ()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
Stateful::set_id (const XMLNode& node)
|
||||||
|
{
|
||||||
|
const XMLProperty* prop;
|
||||||
|
|
||||||
|
if ((prop = node.property ("id")) != 0) {
|
||||||
|
_id = prop->value ();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
Stateful::reset_id ()
|
||||||
|
{
|
||||||
|
_id = ID ();
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
Stateful::set_id (const string& str)
|
||||||
|
{
|
||||||
|
_id = str;
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace PBD
|
} // namespace PBD
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue