NO-OP: indent & whitespace
This commit is contained in:
parent
3d98d13760
commit
80f3b54be4
@ -17,8 +17,8 @@
|
|||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __libardour_port_engine_shared_h__
|
#ifndef _libardour_port_engine_shared_h_
|
||||||
#define __libardour_port_engine_shared_h__
|
#define _libardour_port_engine_shared_h_
|
||||||
|
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <set>
|
#include <set>
|
||||||
@ -39,36 +39,48 @@ namespace ARDOUR {
|
|||||||
class PortEngineSharedImpl;
|
class PortEngineSharedImpl;
|
||||||
class PortManager;
|
class PortManager;
|
||||||
|
|
||||||
|
|
||||||
class LIBARDOUR_API BackendPort
|
class LIBARDOUR_API BackendPort
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
BackendPort (PortEngineSharedImpl &b, const std::string&, PortFlags);
|
BackendPort (PortEngineSharedImpl& b, const std::string&, PortFlags);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
virtual ~BackendPort ();
|
virtual ~BackendPort ();
|
||||||
|
|
||||||
const std::string& name () const { return _name; }
|
const std::string& name () const { return _name; }
|
||||||
const std::string& pretty_name () const { return _pretty_name; }
|
const std::string& pretty_name () const { return _pretty_name; }
|
||||||
PortFlags flags () const { return _flags; }
|
|
||||||
|
|
||||||
int set_name (const std::string &name) { _name = name; return 0; }
|
int set_name (const std::string& name)
|
||||||
int set_pretty_name (const std::string &name) { _pretty_name = name; return 0; }
|
{
|
||||||
|
_name = name;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int set_pretty_name (const std::string& name)
|
||||||
|
{
|
||||||
|
_pretty_name = name;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
virtual DataType type () const = 0;
|
virtual DataType type () const = 0;
|
||||||
|
|
||||||
|
PortFlags flags () const { return _flags; }
|
||||||
bool is_input () const { return flags () & IsInput; }
|
bool is_input () const { return flags () & IsInput; }
|
||||||
bool is_output () const { return flags () & IsOutput; }
|
bool is_output () const { return flags () & IsOutput; }
|
||||||
bool is_physical () const { return flags () & IsPhysical; }
|
bool is_physical () const { return flags () & IsPhysical; }
|
||||||
bool is_terminal () const { return flags () & IsTerminal; }
|
bool is_terminal () const { return flags () & IsTerminal; }
|
||||||
bool is_connected () const { return _connections.size () != 0; }
|
bool is_connected () const { return _connections.size () != 0; }
|
||||||
bool is_connected (const BackendPort *port) const;
|
|
||||||
|
bool is_connected (const BackendPort* port) const;
|
||||||
bool is_physically_connected () const;
|
bool is_physically_connected () const;
|
||||||
|
|
||||||
const std::set<BackendPort *>& get_connections () const { return _connections; }
|
const std::set<BackendPort*>& get_connections () const
|
||||||
|
{
|
||||||
|
return _connections;
|
||||||
|
}
|
||||||
|
|
||||||
int connect (BackendPort *port);
|
int connect (BackendPort* port);
|
||||||
int disconnect (BackendPort *port);
|
int disconnect (BackendPort* port);
|
||||||
void disconnect_all ();
|
void disconnect_all ();
|
||||||
|
|
||||||
virtual void* get_buffer (pframes_t nframes) = 0;
|
virtual void* get_buffer (pframes_t nframes) = 0;
|
||||||
@ -78,14 +90,14 @@ class LIBARDOUR_API BackendPort
|
|||||||
return for_playback ? _playback_latency_range : _capture_latency_range;
|
return for_playback ? _playback_latency_range : _capture_latency_range;
|
||||||
}
|
}
|
||||||
|
|
||||||
void set_latency_range (const LatencyRange &latency_range, bool for_playback);
|
void set_latency_range (const LatencyRange& latency_range, bool for_playback);
|
||||||
|
|
||||||
void update_connected_latency (bool for_playback);
|
void update_connected_latency (bool for_playback);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
PortEngineSharedImpl &_backend;
|
PortEngineSharedImpl& _backend;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::string _name;
|
std::string _name;
|
||||||
std::string _pretty_name;
|
std::string _pretty_name;
|
||||||
const PortFlags _flags;
|
const PortFlags _flags;
|
||||||
@ -93,16 +105,16 @@ class LIBARDOUR_API BackendPort
|
|||||||
LatencyRange _playback_latency_range;
|
LatencyRange _playback_latency_range;
|
||||||
std::set<BackendPort*> _connections;
|
std::set<BackendPort*> _connections;
|
||||||
|
|
||||||
void _connect (BackendPort* , bool);
|
void _connect (BackendPort*, bool);
|
||||||
void _disconnect (BackendPort* , bool);
|
void _disconnect (BackendPort*, bool);
|
||||||
|
|
||||||
}; // class BackendPort
|
}; // class BackendPort
|
||||||
|
|
||||||
class LIBARDOUR_API PortEngineSharedImpl
|
class LIBARDOUR_API PortEngineSharedImpl
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
PortEngineSharedImpl (PortManager& mgr, std::string const & instance_name);
|
PortEngineSharedImpl (PortManager& mgr, std::string const& instance_name);
|
||||||
virtual ~PortEngineSharedImpl();
|
virtual ~PortEngineSharedImpl ();
|
||||||
|
|
||||||
/* Discovering physical ports */
|
/* Discovering physical ports */
|
||||||
|
|
||||||
@ -143,49 +155,50 @@ class LIBARDOUR_API PortEngineSharedImpl
|
|||||||
virtual void port_connect_callback (const std::string& a, const std::string& b, bool conn) = 0;
|
virtual void port_connect_callback (const std::string& a, const std::string& b, bool conn) = 0;
|
||||||
virtual void port_connect_add_remove_callback () = 0;
|
virtual void port_connect_add_remove_callback () = 0;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
std::string _instance_name;
|
std::string _instance_name;
|
||||||
|
|
||||||
std::vector<BackendPort *> _system_inputs;
|
std::vector<BackendPort*> _system_inputs;
|
||||||
std::vector<BackendPort *> _system_outputs;
|
std::vector<BackendPort*> _system_outputs;
|
||||||
std::vector<BackendPort *> _system_midi_in;
|
std::vector<BackendPort*> _system_midi_in;
|
||||||
std::vector<BackendPort *> _system_midi_out;
|
std::vector<BackendPort*> _system_midi_out;
|
||||||
|
|
||||||
void clear_ports ();
|
void clear_ports ();
|
||||||
|
|
||||||
PortEngine::PortHandle add_port (const std::string& shortname, ARDOUR::DataType, ARDOUR::PortFlags);
|
PortEngine::PortHandle add_port (const std::string& shortname, ARDOUR::DataType, ARDOUR::PortFlags);
|
||||||
void unregister_ports (bool system_only = false);
|
void unregister_ports (bool system_only = false);
|
||||||
|
|
||||||
struct SortByPortName
|
struct SortByPortName {
|
||||||
{
|
bool operator() (const BackendPort* lhs, const BackendPort* rhs) const
|
||||||
bool operator ()(const BackendPort* lhs, const BackendPort* rhs) const
|
|
||||||
{
|
{
|
||||||
return PBD::naturally_less (lhs->name ().c_str (), rhs->name ().c_str ());
|
return PBD::naturally_less (lhs->name ().c_str (), rhs->name ().c_str ());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef std::map<std::string, BackendPort *> PortMap; // fast lookup in _ports
|
typedef std::map<std::string, BackendPort*> PortMap; // fast lookup in _ports
|
||||||
typedef std::set<BackendPort *, SortByPortName> PortIndex; // fast lookup in _ports
|
typedef std::set<BackendPort*, SortByPortName> PortIndex; // fast lookup in _ports
|
||||||
SerializedRCUManager<PortMap> _portmap;
|
SerializedRCUManager<PortMap> _portmap;
|
||||||
SerializedRCUManager<PortIndex> _ports;
|
SerializedRCUManager<PortIndex> _ports;
|
||||||
|
|
||||||
bool valid_port (PortEngine::PortHandle port) const {
|
bool valid_port (PortEngine::PortHandle port) const
|
||||||
boost::shared_ptr<PortIndex> p = _ports.reader();
|
{
|
||||||
return std::find (p->begin(), p->end(), static_cast<BackendPort*>(port)) != p->end ();
|
boost::shared_ptr<PortIndex> p = _ports.reader ();
|
||||||
|
return std::find (p->begin (), p->end (), static_cast<BackendPort*> (port)) != p->end ();
|
||||||
}
|
}
|
||||||
|
|
||||||
BackendPort* find_port (const std::string& port_name) const {
|
BackendPort* find_port (const std::string& port_name) const
|
||||||
boost::shared_ptr<PortMap> p = _portmap.reader();
|
{
|
||||||
|
boost::shared_ptr<PortMap> p = _portmap.reader ();
|
||||||
PortMap::const_iterator it = p->find (port_name);
|
PortMap::const_iterator it = p->find (port_name);
|
||||||
if (it == p->end()) {
|
if (it == p->end ()) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
return (*it).second;
|
return (*it).second;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual BackendPort* port_factory (std::string const & name, ARDOUR::DataType dt, ARDOUR::PortFlags flags) = 0;
|
virtual BackendPort* port_factory (std::string const& name, ARDOUR::DataType dt, ARDOUR::PortFlags flags) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
} /* namespace ARDOUR */
|
} /* namespace ARDOUR */
|
||||||
|
|
||||||
#endif /* __libardour_port_engine_shared_h__ */
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user