#include "ardour/audioengine.h"
#include "ardour/buffer.h"
+#include "ardour/debug.h"
#include "ardour/io.h"
#include "ardour/route.h"
#include "ardour/port.h"
}
}
+void
+IO::increment_port_buffer_offset (pframes_t offset)
+{
+ /* io_lock, not taken: function must be called from Session::process() calltree */
+
+ if (_direction == Output) {
+ for (PortSet::iterator i = _ports.begin(); i != _ports.end(); ++i) {
+ i->increment_port_buffer_offset (offset);
+ }
+ }
+}
+
void
IO::silence (framecnt_t nframes)
{
if (other_port.length() == 0 || our_port == 0) {
return 0;
}
-
+
{
Glib::Mutex::Lock lm (io_lock);
return 0;
}
-/** Caller must hold process lock */
int
IO::connect (Port* our_port, string other_port, void* src)
{
return -1;
}
}
-
changed (IOChange (IOChange::ConnectionsChanged), src); /* EMIT SIGNAL */
_session.set_dirty ();
return 0;
change.after = _ports.count ();
change.type = IOChange::ConfigurationChanged;
this->changed (change, src); /* EMIT SIGNAL */
+ _buffers.attach_buffers (_ports);
setup_bundle ();
_session.set_dirty ();
}
}
if (prop) {
- p->connect (prop->value());
+ connect (p, prop->value(), this);
}
}
}
return r;
}
-void
-IO::set_port_latency (framecnt_t nframes)
-{
- Glib::Mutex::Lock lm (io_lock);
-
- for (PortSet::iterator i = _ports.begin(); i != _ports.end(); ++i) {
- i->set_latency (nframes);
- }
-}
-
framecnt_t
IO::latency () const
{
/* io lock not taken - must be protected by other means */
for (PortSet::const_iterator i = _ports.begin(); i != _ports.end(); ++i) {
- if ((latency = i->total_latency ()) > max_latency) {
+ if ((latency = i->private_latency_range (_direction == Output).max) > max_latency) {
max_latency = latency;
}
}
+ DEBUG_TRACE (DEBUG::Latency, string_compose ("%1: max %4 latency from %2 ports = %3\n",
+ name(), _ports.num_ports(), max_latency,
+ ((_direction == Output) ? "PLAYBACK" : "CAPTURE")));
return max_latency;
}
-void
-IO::update_port_total_latencies ()
-{
- /* io_lock, not taken: function must be called from Session::process() calltree */
-
- for (PortSet::iterator i = _ports.begin(); i != _ports.end(); ++i) {
- _session.engine().update_total_latency (*i);
- }
-}
-
int
IO::connect_ports_to_bundle (boost::shared_ptr<Bundle> c, void* src)
{
void
IO::process_input (boost::shared_ptr<Processor> proc, framepos_t start_frame, framepos_t end_frame, pframes_t nframes)
{
- BufferSet bufs;
-
/* don't read the data into new buffers - just use the port buffers directly */
- bufs.attach_buffers (_ports, nframes, 0);
- proc->run (bufs, start_frame, end_frame, nframes, true);
+ _buffers.get_jack_port_addresses (_ports, nframes);
+ proc->run (_buffers, start_frame, end_frame, nframes, true);
}
void
return false;
}
+
+bool
+IO::has_port (Port* p) const
+{
+ Glib::Mutex::Lock lm (io_lock);
+ return _ports.contains (p);
+}