summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2011-07-22 15:44:13 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2011-07-22 15:44:13 +0000
commit862972eaaa2232c399bb819eb1092379689d747e (patch)
treee0c1e80f9585f58df763d06b8604e8ffccc26b8b
parent1d7190b18671bf6ff33136cd157de9e6435176c6 (diff)
use std::vector::assign() in BufferSet::attach_buffers() rather than an explicit loop; minor formatting touchups
git-svn-id: svn://localhost/ardour2/branches/3.0@9912 d708f5d6-7413-0410-9779-e7cbd77b26cf
-rw-r--r--libs/ardour/ardour/chan_count.h2
-rw-r--r--libs/ardour/buffer_set.cc18
-rw-r--r--libs/ardour/delivery.cc2
-rw-r--r--libs/ardour/io.cc8
-rw-r--r--libs/ardour/port_set.cc3
-rw-r--r--libs/ardour/route.cc3
-rw-r--r--libs/ardour/session.cc1
7 files changed, 20 insertions, 17 deletions
diff --git a/libs/ardour/ardour/chan_count.h b/libs/ardour/ardour/chan_count.h
index 5903a2f2d5..c4f3caef6b 100644
--- a/libs/ardour/ardour/chan_count.h
+++ b/libs/ardour/ardour/chan_count.h
@@ -54,6 +54,8 @@ public:
void set(DataType t, uint32_t count) { assert(t != DataType::NIL); _counts[t] = count; }
uint32_t get(DataType t) const { assert(t != DataType::NIL); return _counts[t]; }
+ inline uint32_t n (DataType t) const { return _counts[t]; }
+
inline uint32_t n_audio() const { return _counts[DataType::AUDIO]; }
inline void set_audio(uint32_t a) { _counts[DataType::AUDIO] = a; }
diff --git a/libs/ardour/buffer_set.cc b/libs/ardour/buffer_set.cc
index 3c66bddbb7..56245882d6 100644
--- a/libs/ardour/buffer_set.cc
+++ b/libs/ardour/buffer_set.cc
@@ -23,7 +23,9 @@
#include <iostream>
#include <algorithm>
+
#include "pbd/compose.h"
+
#include "ardour/buffer.h"
#include "ardour/buffer_set.h"
#include "ardour/debug.h"
@@ -93,27 +95,27 @@ BufferSet::clear()
void
BufferSet::attach_buffers (PortSet& ports)
{
- clear();
+ const ChanCount& count (ports.count());
+
+ clear ();
for (DataType::iterator t = DataType::begin(); t != DataType::end(); ++t) {
- _buffers.push_back(BufferVec());
+ _buffers.push_back (BufferVec());
BufferVec& v = _buffers[*t];
-
- for (PortSet::iterator p = ports.begin(*t); p != ports.end(*t); ++p) {
- assert(p->type() == *t);
- v.push_back (0);
- }
+ v.assign (count.n (*t), (Buffer*) 0);
}
_count = ports.count();
_available = ports.count();
+
_is_mirror = true;
}
/** Write the JACK port addresses from a PortSet into our data structures. This
* call assumes that attach_buffers() has already been called for the same PortSet.
- * Does not allocate, so RT-safe.
+ * Does not allocate, so RT-safe BUT you can only call Port::get_buffer() from
+ * the process() callback tree anyway, so this has to be called in RT context.
*/
void
BufferSet::get_jack_port_addresses (PortSet& ports, framecnt_t nframes)
diff --git a/libs/ardour/delivery.cc b/libs/ardour/delivery.cc
index 8e2119c0d2..967e01187e 100644
--- a/libs/ardour/delivery.cc
+++ b/libs/ardour/delivery.cc
@@ -568,6 +568,8 @@ Delivery::set_name (const std::string& name)
return ret;
}
+bool ignore_output_change = false;
+
void
Delivery::output_changed (IOChange change, void* /*src*/)
{
diff --git a/libs/ardour/io.cc b/libs/ardour/io.cc
index b8e92d3472..0d9933cb0c 100644
--- a/libs/ardour/io.cc
+++ b/libs/ardour/io.cc
@@ -311,7 +311,7 @@ IO::add_port (string destination, void* src, DataType type)
/* Create a new port */
string portname = build_legal_port_name (type);
-
+
if (_direction == Input) {
if ((our_port = _session.engine().register_input_port (type, portname)) == 0) {
error << string_compose(_("IO: cannot register input port %1"), portname) << endmsg;
@@ -327,17 +327,15 @@ IO::add_port (string destination, void* src, DataType type)
change.before = _ports.count ();
_ports.add (our_port);
}
-
+
PortCountChanged (n_ports()); /* EMIT SIGNAL */
-
- // pan_changed (src); /* EMIT SIGNAL */
change.type = IOChange::ConfigurationChanged;
change.after = _ports.count ();
changed (change, src); /* EMIT SIGNAL */
_buffers.attach_buffers (_ports);
}
- if (destination.length()) {
+ if (!destination.empty()) {
if (our_port->connect (destination)) {
return -1;
}
diff --git a/libs/ardour/port_set.cc b/libs/ardour/port_set.cc
index 2105d184fb..44a5f436a9 100644
--- a/libs/ardour/port_set.cc
+++ b/libs/ardour/port_set.cc
@@ -77,10 +77,9 @@ PortSet::add(Port* port)
PortVec& v = _ports[port->type()];
v.push_back(port);
- sort(v.begin(), v.end(), sort_ports_by_name);
+ sort(v.begin(), v.end(), sort_ports_by_name);
_count.set(port->type(), _count.get(port->type()) + 1);
-
assert(_count.get(port->type()) == _ports[port->type()].size());
}
diff --git a/libs/ardour/route.cc b/libs/ardour/route.cc
index d4924d038d..6ae86aa016 100644
--- a/libs/ardour/route.cc
+++ b/libs/ardour/route.cc
@@ -1583,7 +1583,8 @@ Route::configure_processors_unlocked (ProcessorStreams* err)
}
/* make sure we have sufficient scratch buffers to cope with the new processor
- configuration */
+ configuration
+ */
_session.ensure_buffers (n_process_buffers ());
DEBUG_TRACE (DEBUG::Processors, string_compose ("%1: configuration complete\n", _name));
diff --git a/libs/ardour/session.cc b/libs/ardour/session.cc
index d4af9b6766..af24b737fa 100644
--- a/libs/ardour/session.cc
+++ b/libs/ardour/session.cc
@@ -1986,7 +1986,6 @@ Session::add_routes (RouteList& new_routes, bool auto_connect, bool save)
boost::shared_ptr<RouteList> r = writer.get_copy ();
r->insert (r->end(), new_routes.begin(), new_routes.end());
-
/* if there is no control out and we're not in the middle of loading,
resort the graph here. if there is a control out, we will resort
toward the end of this method. if we are in the middle of loading,