use std::vector::assign() in BufferSet::attach_buffers() rather than an explicit...
authorPaul Davis <paul@linuxaudiosystems.com>
Fri, 22 Jul 2011 15:44:13 +0000 (15:44 +0000)
committerPaul Davis <paul@linuxaudiosystems.com>
Fri, 22 Jul 2011 15:44:13 +0000 (15:44 +0000)
git-svn-id: svn://localhost/ardour2/branches/3.0@9912 d708f5d6-7413-0410-9779-e7cbd77b26cf

libs/ardour/ardour/chan_count.h
libs/ardour/buffer_set.cc
libs/ardour/delivery.cc
libs/ardour/io.cc
libs/ardour/port_set.cc
libs/ardour/route.cc
libs/ardour/session.cc

index 5903a2f2d56f335337d07c2df2623ed187f03b60..c4f3caef6b3fbeb256ebc79dd3211bbda28b4617 100644 (file)
@@ -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; }
 
index 3c66bddbb792ce21b1a326394653fd349222fcd1..56245882d66c0123ad249a7f83ee3fd0e08fe1cb 100644 (file)
@@ -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)
index 8e2119c0d2968a8ac1dd9f4494b64b6939b5f5ad..967e01187e762a3e5c8a87ea2f92bcee243fac57 100644 (file)
@@ -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*/)
 {
index b8e92d3472a252fc28f69bfb942ce5c27fac397c..0d9933cb0c369e5eebeb63b9b0c3606843c138df 100644 (file)
@@ -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;
                }
index 2105d184fb9e3921b27f3d6b0b082ae96675f08f..44a5f436a98742e0ea92bff03f096173a3486f3b 100644 (file)
@@ -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());
 }
 
index d4924d038d6abf91362870a83015cd44f44c0ef3..6ae86aa016a1790d6fe1ed116837e48a77511d6c 100644 (file)
@@ -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));
index d4af9b6766d9771accf9f430a633308a8a4053ec..af24b737fa67e1706c20810b926e3127930da595 100644 (file)
@@ -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,