summaryrefslogtreecommitdiff
path: root/libs/ardour
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2010-02-11 23:10:29 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2010-02-11 23:10:29 +0000
commita1e0dc13df3cdc7033c940f0f3311a2bd47d3b2e (patch)
tree72cf696511c00bb4dfc135f43f8c0ae0498140cf /libs/ardour
parentf938687f8798d094c99cd4308ad6aa1c467e4a97 (diff)
tweak Stateful/StatefulDiffCommand changes so that SessionObject's actually get a name; make StatefulDiffCommand use a weak_ptr, not a raw ptr; use .val() rather than .get() to avoid confusion with boost:: smart ptr method of the same name
git-svn-id: svn://localhost/ardour2/branches/3.0@6678 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour')
-rw-r--r--libs/ardour/ardour/pi_controller.h4
-rw-r--r--libs/ardour/ardour/session_object.h2
-rw-r--r--libs/ardour/audio_diskstream.cc6
-rw-r--r--libs/ardour/crossfade.cc4
-rw-r--r--libs/ardour/io.cc8
-rw-r--r--libs/ardour/midi_diskstream.cc2
-rw-r--r--libs/ardour/midi_region.cc14
-rw-r--r--libs/ardour/midi_source.cc2
-rw-r--r--libs/ardour/mtc_slave.cc2
-rw-r--r--libs/ardour/pi_controller.cc8
-rw-r--r--libs/ardour/region.cc8
-rw-r--r--libs/ardour/route.cc1
-rw-r--r--libs/ardour/session_command.cc2
-rw-r--r--libs/ardour/sndfilesource.cc4
14 files changed, 34 insertions, 33 deletions
diff --git a/libs/ardour/ardour/pi_controller.h b/libs/ardour/ardour/pi_controller.h
index c5b7c154ac..250c943de9 100644
--- a/libs/ardour/ardour/pi_controller.h
+++ b/libs/ardour/ardour/pi_controller.h
@@ -33,7 +33,7 @@ class PIController {
out_of_bounds ();
}
- double get_ratio (int fill_level);
+ double get_ratio (int fill_level, int period_size);
void out_of_bounds();
public:
@@ -60,7 +60,7 @@ class PIChaser {
PIChaser();
~PIChaser();
- double get_ratio( nframes64_t chasetime_measured, nframes64_t chasetime, nframes64_t slavetime_measured, nframes64_t slavetime, bool in_control );
+ double get_ratio( nframes64_t chasetime_measured, nframes64_t chasetime, nframes64_t slavetime_measured, nframes64_t slavetime, bool in_control, int period_size );
void reset();
nframes64_t want_locate() { return want_locate_val; }
diff --git a/libs/ardour/ardour/session_object.h b/libs/ardour/ardour/session_object.h
index cf9ccbb3a7..069badcb6a 100644
--- a/libs/ardour/ardour/session_object.h
+++ b/libs/ardour/ardour/session_object.h
@@ -41,7 +41,7 @@ class SessionObject : public SessionHandleRef, public PBD::StatefulDestructible
public:
SessionObject (Session& session, const std::string& name)
: SessionHandleRef (session)
- , _name (X_("name"), PBD::Change (0), "")
+ , _name (X_("name"), PBD::Change (0), name)
{
add_state (_name);
}
diff --git a/libs/ardour/audio_diskstream.cc b/libs/ardour/audio_diskstream.cc
index ef209fad3a..9a93e45000 100644
--- a/libs/ardour/audio_diskstream.cc
+++ b/libs/ardour/audio_diskstream.cc
@@ -1433,7 +1433,7 @@ AudioDiskstream::transport_stopped (struct tm& when, time_t twhen, bool abort_ca
if (s) {
srcs.push_back (s);
s->update_header (capture_info.front()->start, when, twhen);
- s->set_captured_for (_name.get());
+ s->set_captured_for (_name.val());
s->mark_immutable ();
if (Config->get_auto_analyse_audio()) {
Analyser::queue_source_for_analysis (s, true);
@@ -1970,7 +1970,7 @@ AudioDiskstream::rename_write_sources ()
for (chan = c->begin(), n = 0; chan != c->end(); ++chan, ++n) {
if ((*chan)->write_source != 0) {
- (*chan)->write_source->set_source_name (_name.get(), destructive());
+ (*chan)->write_source->set_source_name (_name.val(), destructive());
/* XXX what to do if one of them fails ? */
}
}
@@ -2178,7 +2178,7 @@ AudioDiskstream::use_pending_capture_data (XMLNode& node)
first_fs = fs;
}
- fs->set_captured_for (_name.get());
+ fs->set_captured_for (_name.val());
}
}
diff --git a/libs/ardour/crossfade.cc b/libs/ardour/crossfade.cc
index a79dae5f07..0ca173570a 100644
--- a/libs/ardour/crossfade.cc
+++ b/libs/ardour/crossfade.cc
@@ -314,7 +314,7 @@ Crossfade::read_at (Sample *buf, Sample *mixdown_buffer,
start = _position;
buf += offset;
- to_write = min (_length.get(), cnt);
+ to_write = min (_length.val(), cnt);
} else {
@@ -679,7 +679,7 @@ Crossfade::get_state ()
node->add_property ("active", (_active ? "yes" : "no"));
node->add_property ("follow-overlap", (_follow_overlap ? "yes" : "no"));
node->add_property ("fixed", (_fixed ? "yes" : "no"));
- snprintf (buf, sizeof(buf), "%" PRIu32, _length.get());
+ snprintf (buf, sizeof(buf), "%" PRIu32, _length.val());
node->add_property ("length", buf);
snprintf (buf, sizeof(buf), "%" PRIu32, (uint32_t) _anchor_point);
node->add_property ("anchor-point", buf);
diff --git a/libs/ardour/io.cc b/libs/ardour/io.cc
index 34f624f2d2..48bab25546 100644
--- a/libs/ardour/io.cc
+++ b/libs/ardour/io.cc
@@ -1098,7 +1098,7 @@ IO::set_name (const string& requested_name)
for (PortSet::iterator i = _ports.begin(); i != _ports.end(); ++i) {
string current_name = i->name();
- current_name.replace (current_name.find (_name), _name.get().length(), name);
+ current_name.replace (current_name.find (_name), _name.val().length(), name);
i->set_name (current_name);
}
@@ -1267,7 +1267,7 @@ IO::build_legal_port_name (DataType type)
char buf1[name_size+1];
char buf2[name_size+1];
- snprintf (buf1, name_size+1, ("%.*s/%s"), limit, _name.get().c_str(), suffix.c_str());
+ snprintf (buf1, name_size+1, ("%.*s/%s"), limit, _name.val().c_str(), suffix.c_str());
int port_number = find_port_hole (buf1);
snprintf (buf2, name_size+1, "%s %d", buf1, port_number);
@@ -1342,9 +1342,9 @@ IO::setup_bundle ()
_bundle->remove_channels ();
if (_direction == Input) {
- snprintf(buf, sizeof (buf), _("%s in"), _name.get().c_str());
+ snprintf(buf, sizeof (buf), _("%s in"), _name.val().c_str());
} else {
- snprintf(buf, sizeof (buf), _("%s out"), _name.get().c_str());
+ snprintf(buf, sizeof (buf), _("%s out"), _name.val().c_str());
}
_bundle->set_name (buf);
uint32_t const ni = _ports.num_ports();
diff --git a/libs/ardour/midi_diskstream.cc b/libs/ardour/midi_diskstream.cc
index 790891a72d..11fec341b2 100644
--- a/libs/ardour/midi_diskstream.cc
+++ b/libs/ardour/midi_diskstream.cc
@@ -1388,7 +1388,7 @@ int
MidiDiskstream::rename_write_sources ()
{
if (_write_source != 0) {
- _write_source->set_source_name (_name.get(), destructive());
+ _write_source->set_source_name (_name.val(), destructive());
/* XXX what to do if this fails ? */
}
return 0;
diff --git a/libs/ardour/midi_region.cc b/libs/ardour/midi_region.cc
index fb7a7e082f..bccc32c9cb 100644
--- a/libs/ardour/midi_region.cc
+++ b/libs/ardour/midi_region.cc
@@ -51,7 +51,7 @@ using namespace PBD;
MidiRegion::MidiRegion (boost::shared_ptr<MidiSource> src, nframes_t start, nframes_t length)
: Region (src, start, length, PBD::basename_nosuffix(src->name()), DataType::MIDI, 0, Region::Flag(Region::DefaultFlags|Region::External))
{
- assert(_name.get().find("/") == string::npos);
+ assert(_name.val().find("/") == string::npos);
midi_source(0)->Switched.connect_same_thread (*this, boost::bind (&MidiRegion::switch_source, this, _1));
}
@@ -59,7 +59,7 @@ MidiRegion::MidiRegion (boost::shared_ptr<MidiSource> src, nframes_t start, nfra
MidiRegion::MidiRegion (boost::shared_ptr<MidiSource> src, nframes_t start, nframes_t length, const string& name, layer_t layer, Flag flags)
: Region (src, start, length, name, DataType::MIDI, layer, flags)
{
- assert(_name.get().find("/") == string::npos);
+ assert(_name.val().find("/") == string::npos);
midi_source(0)->Switched.connect_same_thread (*this, boost::bind (&MidiRegion::switch_source, this, _1));
}
@@ -67,7 +67,7 @@ MidiRegion::MidiRegion (boost::shared_ptr<MidiSource> src, nframes_t start, nfra
MidiRegion::MidiRegion (const SourceList& srcs, nframes_t start, nframes_t length, const string& name, layer_t layer, Flag flags)
: Region (srcs, start, length, name, DataType::MIDI, layer, flags)
{
- assert(_name.get().find("/") == string::npos);
+ assert(_name.val().find("/") == string::npos);
midi_source(0)->Switched.connect_same_thread (*this, boost::bind (&MidiRegion::switch_source, this, _1));
}
@@ -76,14 +76,14 @@ MidiRegion::MidiRegion (const SourceList& srcs, nframes_t start, nframes_t lengt
MidiRegion::MidiRegion (boost::shared_ptr<const MidiRegion> other, nframes_t offset, nframes_t length, const string& name, layer_t layer, Flag flags)
: Region (other, offset, length, name, layer, flags)
{
- assert(_name.get().find("/") == string::npos);
+ assert(_name.val().find("/") == string::npos);
midi_source(0)->Switched.connect_same_thread (*this, boost::bind (&MidiRegion::switch_source, this, _1));
}
MidiRegion::MidiRegion (boost::shared_ptr<const MidiRegion> other)
: Region (other)
{
- assert(_name.get().find("/") == string::npos);
+ assert(_name.val().find("/") == string::npos);
midi_source(0)->Switched.connect_same_thread (*this, boost::bind (&MidiRegion::switch_source, this, _1));
}
@@ -95,7 +95,7 @@ MidiRegion::MidiRegion (boost::shared_ptr<MidiSource> src, const XMLNode& node)
}
midi_source(0)->Switched.connect_same_thread (*this, boost::bind (&MidiRegion::switch_source, this, _1));
- assert(_name.get().find("/") == string::npos);
+ assert(_name.val().find("/") == string::npos);
assert(_type == DataType::MIDI);
}
@@ -107,7 +107,7 @@ MidiRegion::MidiRegion (const SourceList& srcs, const XMLNode& node)
}
midi_source(0)->Switched.connect_same_thread (*this, boost::bind (&MidiRegion::switch_source, this, _1));
- assert(_name.get().find("/") == string::npos);
+ assert(_name.val().find("/") == string::npos);
assert(_type == DataType::MIDI);
}
diff --git a/libs/ardour/midi_source.cc b/libs/ardour/midi_source.cc
index ce58d4f585..2b0efd78e1 100644
--- a/libs/ardour/midi_source.cc
+++ b/libs/ardour/midi_source.cc
@@ -230,7 +230,7 @@ MidiSource::session_saved()
if (_model && _model->edited()) {
string newname;
- const string basename = PBD::basename_nosuffix(_name.get());
+ const string basename = PBD::basename_nosuffix(_name.val());
string::size_type last_dash = basename.find_last_of("-");
if (last_dash == string::npos || last_dash == basename.find_first_of("-")) {
newname = basename + "-1";
diff --git a/libs/ardour/mtc_slave.cc b/libs/ardour/mtc_slave.cc
index 64f67ba746..7c990bd654 100644
--- a/libs/ardour/mtc_slave.cc
+++ b/libs/ardour/mtc_slave.cc
@@ -429,7 +429,7 @@ MTC_Slave::speed_and_position (double& speed, nframes64_t& pos)
static double average_speed = 0;
nframes64_t ref_now = session.engine().frame_time_at_cycle_start();
- average_speed = pic->get_ratio (last.timestamp, last.position, ref_now, slave_pos, in_control );
+ average_speed = pic->get_ratio (last.timestamp, last.position, ref_now, slave_pos, in_control, session.engine().frames_per_cycle());
pic_want_locate = pic->want_locate();
diff --git a/libs/ardour/pi_controller.cc b/libs/ardour/pi_controller.cc
index baee5a972a..bdf9c27cee 100644
--- a/libs/ardour/pi_controller.cc
+++ b/libs/ardour/pi_controller.cc
@@ -56,10 +56,10 @@ PIController::~PIController ()
}
double
-PIController::get_ratio (int fill_level)
+PIController::get_ratio (int fill_level, int period_size)
{
double offset = fill_level;
- double this_catch_factor = catch_factor;
+ double this_catch_factor = catch_factor * 4096.0/(double)period_size;
// Save offset.
@@ -151,7 +151,7 @@ PIChaser::~PIChaser() {
}
double
-PIChaser::get_ratio(nframes64_t chasetime_measured, nframes64_t chasetime, nframes64_t slavetime_measured, nframes64_t slavetime, bool in_control ) {
+PIChaser::get_ratio(nframes64_t chasetime_measured, nframes64_t chasetime, nframes64_t slavetime_measured, nframes64_t slavetime, bool in_control, int period_size ) {
feed_estimator( chasetime_measured, chasetime );
std::cerr << (double)chasetime_measured/48000.0 << " " << chasetime << " " << slavetime << " ";
@@ -159,7 +159,7 @@ PIChaser::get_ratio(nframes64_t chasetime_measured, nframes64_t chasetime, nfram
double fine;
nframes64_t massaged_chasetime = chasetime + (nframes64_t)( (double)(slavetime_measured - chasetime_measured) * crude );
- fine = pic->get_ratio( slavetime - massaged_chasetime );
+ fine = pic->get_ratio( slavetime - massaged_chasetime, period_size );
if (in_control) {
if (fabs(fine-crude) > crude*speed_threshold) {
std::cout << "reset to " << crude << " fine = " << fine << "\n";
diff --git a/libs/ardour/region.cc b/libs/ardour/region.cc
index 03d90bcf09..06437811e7 100644
--- a/libs/ardour/region.cc
+++ b/libs/ardour/region.cc
@@ -1197,12 +1197,12 @@ Region::set_live_state (const XMLNode& node, int /*version*/, Change& what_chang
/* fix problems with old sessions corrupted by impossible
values for _stretch or _shift
*/
- if (_stretch == 0.0) {
- _stretch = 1.0;
+ if (_stretch == 0.0f) {
+ _stretch = 1.0f;
}
- if (_shift == 0.0) {
- _shift = 1.0;
+ if (_shift == 0.0f) {
+ _shift = 1.0f;
}
/* note: derived classes set flags */
diff --git a/libs/ardour/route.cc b/libs/ardour/route.cc
index 02005fc269..0cf62f4cae 100644
--- a/libs/ardour/route.cc
+++ b/libs/ardour/route.cc
@@ -78,6 +78,7 @@ Route::Route (Session& sess, string name, Flag flg, DataType default_type)
, _default_type (default_type)
{
+ cerr << "New route with n=" << name << " has name = " << _name.val() << endl;
init ();
/* add standard processors other than amp (added by ::init()) */
diff --git a/libs/ardour/session_command.cc b/libs/ardour/session_command.cc
index 82ecc60b83..6c2621fdb9 100644
--- a/libs/ardour/session_command.cc
+++ b/libs/ardour/session_command.cc
@@ -144,7 +144,7 @@ Session::stateful_diff_command_factory (XMLNode* n)
if ((obj_T == typeid (AudioRegion).name() || obj_T == typeid (MidiRegion).name())) {
boost::shared_ptr<Region> r = RegionFactory::region_by_id (id);
if (r) {
- return new StatefulDiffCommand (r.get(), *n);
+ return new StatefulDiffCommand (r, *n);
}
}
diff --git a/libs/ardour/sndfilesource.cc b/libs/ardour/sndfilesource.cc
index 8f454d31ce..de8ce330e1 100644
--- a/libs/ardour/sndfilesource.cc
+++ b/libs/ardour/sndfilesource.cc
@@ -306,7 +306,7 @@ SndFileSource::read_unlocked (Sample *dst, sframes_t start, nframes_t cnt) const
if (sf_seek (sf, (sf_count_t) start, SEEK_SET|SFM_READ) != (sf_count_t) start) {
char errbuf[256];
sf_error_str (0, errbuf, sizeof (errbuf) - 1);
- error << string_compose(_("SndFileSource: could not seek to frame %1 within %2 (%3)"), start, _name.get().substr (1), errbuf) << endmsg;
+ error << string_compose(_("SndFileSource: could not seek to frame %1 within %2 (%3)"), start, _name.val().substr (1), errbuf) << endmsg;
return 0;
}
@@ -316,7 +316,7 @@ SndFileSource::read_unlocked (Sample *dst, sframes_t start, nframes_t cnt) const
if (ret != file_cnt) {
char errbuf[256];
sf_error_str (0, errbuf, sizeof (errbuf) - 1);
- cerr << string_compose(_("SndFileSource: @ %1 could not read %2 within %3 (%4) (len = %5)"), start, file_cnt, _name.get().substr (1), errbuf, _length) << endl;
+ cerr << string_compose(_("SndFileSource: @ %1 could not read %2 within %3 (%4) (len = %5)"), start, file_cnt, _name.val().substr (1), errbuf, _length) << endl;
}
return ret;
}