summaryrefslogtreecommitdiff
path: root/libs/ardour
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2011-10-18 13:18:47 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2011-10-18 13:18:47 +0000
commit4085309cdb07f011756a9ab90047037ef9ad8f20 (patch)
tree22fb3764a0b8120a06397b3605c59589be5f78d8 /libs/ardour
parent9ec965a54eb9bafa6fa0cf4837809189affac49f (diff)
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
Diffstat (limited to 'libs/ardour')
-rw-r--r--libs/ardour/audio_diskstream.cc10
-rw-r--r--libs/ardour/automation_list.cc5
-rw-r--r--libs/ardour/crossfade.cc4
-rw-r--r--libs/ardour/diskstream.cc8
-rw-r--r--libs/ardour/io.cc8
-rw-r--r--libs/ardour/location.cc4
-rwxr-xr-xlibs/ardour/lxvst_plugin.cc2
-rw-r--r--libs/ardour/midi_diskstream.cc4
-rw-r--r--libs/ardour/playlist.cc4
-rw-r--r--libs/ardour/playlist_source.cc8
-rw-r--r--libs/ardour/plugin_insert.cc7
-rw-r--r--libs/ardour/processor.cc9
-rw-r--r--libs/ardour/region.cc6
-rw-r--r--libs/ardour/route.cc8
-rw-r--r--libs/ardour/route_group.cc5
-rw-r--r--libs/ardour/source.cc8
16 files changed, 34 insertions, 66 deletions
diff --git a/libs/ardour/audio_diskstream.cc b/libs/ardour/audio_diskstream.cc
index 243ccdb9d1..436506c857 100644
--- a/libs/ardour/audio_diskstream.cc
+++ b/libs/ardour/audio_diskstream.cc
@@ -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)) {
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;
}
@@ -784,7 +784,7 @@ AudioDiskstream::overwrite_existing_buffers ()
if (read ((*chan)->playback_buf->buffer(), mixdown_buffer, gain_buffer,
start, cnt, *chan, n, reversed)) {
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;
}
}
@@ -933,7 +933,7 @@ AudioDiskstream::read (Sample* buf, Sample* mixdown_buffer, float* gain_buffer,
this_read = min(cnt,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;
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) {
- error << string_compose(_("AudioDiskstream %1: cannot write to disk"), _id) << endmsg;
+ error << string_compose(_("AudioDiskstream %1: cannot write to disk"), id()) << endmsg;
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]);
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;
}
diff --git a/libs/ardour/automation_list.cc b/libs/ardour/automation_list.cc
index b2bda4a203..2e28bb8bb1 100644
--- a/libs/ardour/automation_list.cc
+++ b/libs/ardour/automation_list.cc
@@ -270,7 +270,7 @@ AutomationList::state (bool full)
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);
root->add_property ("default", buf);
@@ -437,8 +437,7 @@ AutomationList::set_state (const XMLNode& node, int version)
return -1;
}
- if ((prop = node.property ("id")) != 0) {
- _id = prop->value ();
+ if (set_id (node)) {
/* update session AL list */
AutomationListCreated(this);
}
diff --git a/libs/ardour/crossfade.cc b/libs/ardour/crossfade.cc
index dc8d3e3c52..f06fcfb280 100644
--- a/libs/ardour/crossfade.cc
+++ b/libs/ardour/crossfade.cc
@@ -778,9 +778,7 @@ Crossfade::set_state (const XMLNode& node, int /*version*/)
PropertyChange what_changed;
framepos_t val;
- if ((prop = node.property (X_("id")))) {
- _id = prop->value();
- }
+ set_id (node);
if ((prop = node.property ("position")) != 0) {
sscanf (prop->value().c_str(), "%" PRId64, &val);
diff --git a/libs/ardour/diskstream.cc b/libs/ardour/diskstream.cc
index 6501998171..21bbbbd849 100644
--- a/libs/ardour/diskstream.cc
+++ b/libs/ardour/diskstream.cc
@@ -495,13 +495,9 @@ Diskstream::set_state (const XMLNode& node, int /*version*/)
}
if (deprecated_io_node) {
- if ((prop = deprecated_io_node->property ("id")) != 0) {
- _id = prop->value ();
- }
+ set_id (*deprecated_io_node);
} else {
- if ((prop = node.property ("id")) != 0) {
- _id = prop->value ();
- }
+ set_id (node);
}
if ((prop = node.property ("flags")) != 0) {
diff --git a/libs/ardour/io.cc b/libs/ardour/io.cc
index 6aaca08c90..ca34b7db61 100644
--- a/libs/ardour/io.cc
+++ b/libs/ardour/io.cc
@@ -575,9 +575,7 @@ IO::set_state (const XMLNode& node, int version)
assert(_default_type != DataType::NIL);
}
- if ((prop = node.property ("id")) != 0) {
- _id = prop->value ();
- }
+ set_id (node);
if ((prop = node.property ("direction")) != 0) {
_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);
}
- if ((prop = node.property ("id")) != 0) {
- _id = prop->value ();
- }
+ set_id (node);
_direction = in ? Input : Output;
diff --git a/libs/ardour/location.cc b/libs/ardour/location.cc
index b6a09d863a..ed9f34ff8b 100644
--- a/libs/ardour/location.cc
+++ b/libs/ardour/location.cc
@@ -419,10 +419,8 @@ Location::set_state (const XMLNode& node, int /*version*/)
return -1;
}
- if ((prop = node.property ("id")) == 0) {
+ if (!set_id (node)) {
warning << _("XML node for Location has no ID information") << endmsg;
- } else {
- _id = prop->value ();
}
if ((prop = node.property ("name")) == 0) {
diff --git a/libs/ardour/lxvst_plugin.cc b/libs/ardour/lxvst_plugin.cc
index 26136b4589..21bfdb42f5 100755
--- a/libs/ardour/lxvst_plugin.cc
+++ b/libs/ardour/lxvst_plugin.cc
@@ -366,10 +366,8 @@ LXVSTPlugin::load_user_preset (PresetRecord r)
XMLNode* root = t->root ();
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"));
- assert (uri);
assert (label);
if (label->value() != r.label) {
diff --git a/libs/ardour/midi_diskstream.cc b/libs/ardour/midi_diskstream.cc
index 28ee12cc5a..3dc54fe862 100644
--- a/libs/ardour/midi_diskstream.cc
+++ b/libs/ardour/midi_diskstream.cc
@@ -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) {
error << string_compose(
_("MidiDiskstream %1: cannot read %2 from playlist at frame %3"),
- _id, this_read, start) << endmsg;
+ id(), this_read, start) << endmsg;
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 (_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;
}
}
diff --git a/libs/ardour/playlist.cc b/libs/ardour/playlist.cc
index 6fad2084e4..0e86d72bb1 100644
--- a/libs/ardour/playlist.cc
+++ b/libs/ardour/playlist.cc
@@ -2213,6 +2213,8 @@ Playlist::flush_notifications (bool from_undo)
plist = node.properties();
+ set_id (node);
+
for (piter = plist.begin(); piter != plist.end(); ++piter) {
prop = *piter;
@@ -2220,8 +2222,6 @@ Playlist::flush_notifications (bool from_undo)
if (prop->name() == X_("name")) {
_name = prop->value();
_set_sort_id ();
- } else if (prop->name() == X_("id")) {
- _id = prop->value();
} else if (prop->name() == X_("orig-diskstream-id")) {
_orig_diskstream_id = prop->value ();
} else if (prop->name() == X_("frozen")) {
diff --git a/libs/ardour/playlist_source.cc b/libs/ardour/playlist_source.cc
index 4c01831b02..7583a4e6ea 100644
--- a/libs/ardour/playlist_source.cc
+++ b/libs/ardour/playlist_source.cc
@@ -86,7 +86,7 @@ PlaylistSource::add_state (XMLNode& node)
node.add_property ("offset", buf);
snprintf (buf, sizeof (buf), "%" PRIu64, _playlist_length);
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());
}
@@ -141,11 +141,15 @@ PlaylistSource::set_state (const XMLNode& node, int /*version*/)
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) {
throw failed_constructor ();
}
- _id = prop->value();
+ set_id (prop->value());
_level = _playlist->max_source_level () + 1;
diff --git a/libs/ardour/plugin_insert.cc b/libs/ardour/plugin_insert.cc
index b44f1d01fc..ea95ed09e5 100644
--- a/libs/ardour/plugin_insert.cc
+++ b/libs/ardour/plugin_insert.cc
@@ -75,9 +75,6 @@ PluginInsert::PluginInsert (Session& s, boost::shared_ptr<Plugin> plug)
if (plug) {
add_plugin (plug);
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
// the plugins themselves are created and added.
- if ((prop = node.property ("id")) != 0) {
- _id = prop->value();
- }
+ set_id (node);
if (_plugins.empty()) {
/* if we are adding the first plugin, we will need to set
diff --git a/libs/ardour/processor.cc b/libs/ardour/processor.cc
index 8b54bd4f55..cf641fd7cf 100644
--- a/libs/ardour/processor.cc
+++ b/libs/ardour/processor.cc
@@ -150,9 +150,7 @@ Processor::set_state_2X (const XMLNode & node, int /*version*/)
set_name (prop->value ());
}
- if ((prop = (*i)->property ("id")) != 0) {
- _id = prop->value ();
- }
+ set_id (**i);
if ((prop = (*i)->property ("active")) != 0) {
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());
}
- // may not exist for legacy 3.0 sessions
- if ((prop = node.property ("id")) != 0) {
- _id = prop->value();
- }
+ set_id (node);
XMLNodeList nlist = node.children();
XMLNodeIterator niter;
diff --git a/libs/ardour/region.cc b/libs/ardour/region.cc
index 2ce823777b..c0156903b3 100644
--- a/libs/ardour/region.cc
+++ b/libs/ardour/region.cc
@@ -1167,7 +1167,7 @@ Region::state ()
add_properties (*node);
- _id.print (buf, sizeof (buf));
+ id().print (buf, sizeof (buf));
node->add_property ("id", buf);
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);
- if ((prop = node.property (X_("id")))) {
- _id = prop->value();
- }
+ set_id (node);
if (_position_lock_style == MusicTime) {
if ((prop = node.property ("bbt-position")) == 0) {
diff --git a/libs/ardour/route.cc b/libs/ardour/route.cc
index cee897b119..a051cdb3d3 100644
--- a/libs/ardour/route.cc
+++ b/libs/ardour/route.cc
@@ -1886,9 +1886,7 @@ Route::_set_state (const XMLNode& node, int version, bool /*call_base*/)
Route::set_name (prop->value());
}
- if ((prop = node.property ("id")) != 0) {
- _id = prop->value ();
- }
+ set_id (node);
if ((prop = node.property (X_("flags"))) != 0) {
_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 ());
}
- if ((prop = child->property (X_("id"))) != 0) {
- _id = prop->value ();
- }
+ set_id (*child);
if ((prop = child->property (X_("active"))) != 0) {
bool yn = string_is_affirmative (prop->value());
diff --git a/libs/ardour/route_group.cc b/libs/ardour/route_group.cc
index 42aa30c0f1..fadd436169 100644
--- a/libs/ardour/route_group.cc
+++ b/libs/ardour/route_group.cc
@@ -251,10 +251,7 @@ RouteGroup::set_state (const XMLNode& node, int version)
const XMLProperty *prop;
- if ((prop = node.property ("id")) != 0) {
- _id = prop->value();
- }
-
+ set_id (node);
set_values (node);
if ((prop = node.property ("routes")) != 0) {
diff --git a/libs/ardour/source.cc b/libs/ardour/source.cc
index 35e1417fb4..4c582f3ad7 100644
--- a/libs/ardour/source.cc
+++ b/libs/ardour/source.cc
@@ -100,7 +100,7 @@ Source::get_state ()
node->add_property ("name", name());
node->add_property ("type", _type.to_string());
node->add_property (X_("flags"), enum_2_string (_flags));
- _id.print (buf, sizeof (buf));
+ id().print (buf, sizeof (buf));
node->add_property ("id", buf);
if (_timestamp != 0) {
@@ -122,9 +122,7 @@ Source::set_state (const XMLNode& node, int version)
return -1;
}
- if ((prop = node.property ("id")) != 0) {
- _id = prop->value ();
- } else {
+ if (!set_id (node)) {
return -1;
}
@@ -221,7 +219,7 @@ Source::get_transients_path () const
s = _session.analysis_dir ();
parts.push_back (s);
- s = _id.to_s();
+ s = id().to_s();
s += '.';
s += TransientDetector::operational_identifier();
parts.push_back (s);