25 #include "ardour/debug.h"
39 , _port_remove_in_progress (false)
76 string::size_type len;
80 len = portname.length();
82 for (n = 0; n < len; ++n) {
83 if (portname[n] ==
':') {
88 if ((n != len) && (portname.substr (0, n) ==
self)) {
89 return portname.substr (n+1);
100 if (portname.find_first_of (
':') != string::npos) {
118 if (0 ==
_backend->get_port_property (ph,
119 "http://jackaudio.org/metadata/pretty-name",
137 if (portname.find_first_of (
':') != string::npos) {
138 if (portname.substr (0,
self.length ()) !=
self) {
158 return _backend->port_is_physical (ph);
167 _backend->get_physical_outputs (type, s);
177 _backend->get_physical_inputs (type, s);
187 return _backend->n_physical_outputs ();
196 return _backend->n_physical_inputs ();
217 Ports::iterator x = pr->find (rel);
219 if (x != pr->end()) {
227 x->second->set_name (check);
240 Ports::iterator x = p->find (old_relative_name);
245 p->insert (make_pair (new_relative_name, port));
253 for (Ports::iterator p = plist->begin(); p != plist->end(); ++p) {
254 if (p->second->type() == type) {
255 pl.push_back (p->second);
270 return _backend->get_ports (port_name_pattern, type, flags, s);
280 string full_portname =
_backend->my_name();
281 full_portname +=
':';
282 full_portname += portname;
289 reason =
string_compose (
_(
"a port with the name \"%1\" already exists: check for duplicated track/bus names"), portname);
291 reason =
string_compose (
_(
"No more ports are available. You will need to stop %1 and restart with more ports if you need this many tracks."), PROGRAM_NAME);
331 }
catch (std::exception& e) {
333 _(
"unable to create port: %1"), e.what()).c_str());
364 if (x != ps->end()) {
389 return _backend->connected (handle);
419 }
else if (ret < 0) {
421 source, s, destination, d)
470 for (i = p->begin(); i != p->end(); ++i) {
471 if (i->second->reestablish ()) {
473 std::cerr <<
string_compose (
_(
"Re-establising port %1 failed"), i->second->name()) << std::endl;
496 for (Ports::iterator i = p->begin(); i != p->end(); ++i) {
497 i->second->reconnect ();
512 if (x != pr->end()) {
517 if (x != pr->end()) {
543 return _backend->can_monitor_input ();
556 _backend->request_input_monitoring (ph, yn);
570 _backend->ensure_input_monitoring (ph, yn);
613 p->second->cycle_start (nframes);
621 p->second->cycle_end (nframes);
625 p->second->flush_buffers (nframes);
637 if (i->second->sends_output()) {
638 i->second->get_buffer(nframes).silence(nframes);
646 std::vector<std::string> port_names;
648 for (std::vector<std::string>::iterator p = port_names.begin(); p != port_names.end(); ++p) {
656 void *buf =
_backend->get_buffer(ph, nframes);
660 memset (buf, 0,
sizeof(
float) * nframes);
665 for (std::vector<std::string>::iterator p = port_names.begin(); p != port_names.end(); ++p) {
673 void *buf =
_backend->get_buffer(ph, nframes);
689 if (i->second->last_monitor() != (x = i->second->monitoring_input ())) {
690 i->second->set_last_monitor (x);
694 i->second->MonitorInputChanged (x);
704 if (i->second->sends_output()) {
711 for (
pframes_t n = 0; n < nframes; ++n) {
void silence_outputs(pframes_t nframes)
SerializedRCUManager< Ports > ports
uint32_t port_name_size() const
std::map< std::string, boost::shared_ptr< Port > > Ports
boost::shared_ptr< Port > register_input_port(DataType, const std::string &portname, bool async=false)
std::string my_name() const
int connect(std::string const &)
LIBARDOUR_API uint64_t Ports
void port_registration_failure(const std::string &portname)
shared_ptr< T > dynamic_pointer_cast(shared_ptr< U > const &r)
void cycle_end(pframes_t nframes)
boost::shared_ptr< Ports > _cycle_ports
void connect_callback(const std::string &, const std::string &, bool connection)
bool port_is_physical(const std::string &) const
LIBPBD_API Transmitter error
ChanCount n_physical_outputs() const
void port_renamed(const std::string &, const std::string &)
std::ostream & endmsg(std::ostream &ostr)
void request_input_monitoring(const std::string &, bool) const
bool connected(const std::string &)
ChanCount n_physical_inputs() const
PortEngine & port_engine()
PBD::Signal0< void > GraphReordered
void get_physical_outputs(DataType type, std::vector< std::string > &)
std::list< boost::shared_ptr< Port > > PortList
PBD::Signal5< void, boost::weak_ptr< Port >, std::string, boost::weak_ptr< Port >, std::string, bool > PortConnectedOrDisconnected
int disconnect(const std::string &source, const std::string &destination)
bool can_request_input_monitoring() const
std::string make_port_name_relative(const std::string &name) const
Sample * engine_get_whole_audio_buffer()
void fade_out(gain_t, gain_t, pframes_t)
bool _port_remove_in_progress
boost::shared_ptr< T > get_copy() const
#define DEBUG_TRACE(bits, str)
int connect(const std::string &source, const std::string &destination)
boost::shared_ptr< Port > register_port(DataType type, const std::string &portname, bool input, bool async=false)
boost::shared_ptr< AudioBackend > _backend
void silence(pframes_t nframes)
boost::shared_ptr< Port > get_port_by_name(const std::string &)
PBD::Signal0< void > PortRegisteredOrUnregistered
void ensure_input_monitoring(const std::string &, bool) const
void registration_callback()
std::string get_pretty_name_by_name(const std::string &portname) const
boost::shared_ptr< Port > register_output_port(DataType, const std::string &portname, bool async=false)
void get_physical_inputs(DataType type, std::vector< std::string > &)
boost::shared_ptr< T > reader() const
static void set_global_port_buffer_offset(pframes_t off)
int unregister_port(boost::shared_ptr< Port >)
void cycle_start(pframes_t nframes)
std::string make_port_name_non_relative(const std::string &name) const
static const ChanCount ZERO
int disconnect(std::string const &)
bool port_is_mine(const std::string &fullname) const
int get_ports(const std::string &port_name_pattern, DataType type, PortFlags flags, std::vector< std::string > &)
int graph_order_callback()
std::string string_compose(const std::string &fmt, const T1 &o1)
static void set_cycle_framecnt(pframes_t n)