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
This commit is contained in:
parent
1d7190b186
commit
862972eaaa
@ -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; }
|
||||
|
||||
|
@ -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)
|
||||
|
@ -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*/)
|
||||
{
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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);
|
||||
|
||||
_count.set(port->type(), _count.get(port->type()) + 1);
|
||||
|
||||
assert(_count.get(port->type()) == _ports[port->type()].size());
|
||||
}
|
||||
|
||||
|
@ -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));
|
||||
|
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user