55 lines
1.2 KiB
C++
55 lines
1.2 KiB
C++
#ifndef PORTMANAGER_H
|
|
#define PORTMANAGER_H
|
|
|
|
#include <jack/jack.h>
|
|
#include "port.h"
|
|
|
|
struct Alias
|
|
{
|
|
std::string match;
|
|
std::string replace;
|
|
|
|
bool Match(std::string name);
|
|
std::string Replace(std::string name);
|
|
};
|
|
|
|
typedef std::list<Alias> AliasList;
|
|
|
|
class PortManager
|
|
{
|
|
public:
|
|
ClientList m_clients;
|
|
PortList m_ports;
|
|
AliasList m_aliases;
|
|
|
|
public:
|
|
void Refresh();
|
|
void Add(jack_port_t *port);
|
|
void Delete(jack_port_t *port);
|
|
|
|
void Connect(jack_port_t *port_a, jack_port_t *port_b);
|
|
void Disconnect(jack_port_t *port_a, jack_port_t *port_b);
|
|
|
|
Client *FindOrMakeClient(std::string name, bool is_input, bool is_midi);
|
|
PortGroup *FindOrMakeGroup(Client *client, JackPortFlags flags, std::string name);
|
|
Port *FindPort(jack_port_t *port);
|
|
|
|
void Sort();
|
|
|
|
void ToggleConnect(Port *a, Port *b);
|
|
void ToggleConnect(Port *a, PortGroup *b);
|
|
void ToggleConnect(PortGroup *a, Port *b);
|
|
void ToggleConnect(PortGroup *a, PortGroup *b);
|
|
|
|
std::string GetAlias(std::string port_name);
|
|
void AliasBay(jack_port_t *port, int num_aliases, char *aliases[2]);
|
|
void AliasClear();
|
|
void AliasAdd(std::string source, std::string target);
|
|
|
|
const AliasList &AliasGetList() const { return m_aliases; }
|
|
};
|
|
|
|
extern PortManager pm;
|
|
|
|
#endif // PORTMANAGER_H
|