Handle port connections properly on port rename
git-svn-id: file:///home/vcs/svn/jsweeper/trunk@24 6611ac79-6612-48ef-a1e9-b906f853523emaster
parent
8fc3ab0c14
commit
0b7782d5b2
|
@ -46,20 +46,33 @@ void PortManager::Refresh()
|
|||
Add(jack_port_by_name(client, ports[i]));
|
||||
}
|
||||
|
||||
for (int i = 0; ports[i] != NULL; ++i) {
|
||||
jack_port_t *port = jack_port_by_name(client, ports[i]);
|
||||
if (jack_port_flags(port) & JackPortIsInput) {
|
||||
const char **connections = jack_port_get_all_connections(client, port);
|
||||
free(ports);
|
||||
|
||||
RefreshConnections();
|
||||
}
|
||||
|
||||
void PortManager::RefreshConnections()
|
||||
{
|
||||
jack_client_t *client = jack.GetClient();
|
||||
|
||||
PortList::iterator it;
|
||||
for (it = m_ports.begin(); it != m_ports.end(); ++it) {
|
||||
Port *p = *it;
|
||||
p->m_connections.clear();
|
||||
}
|
||||
|
||||
for (it = m_ports.begin(); it != m_ports.end(); ++it) {
|
||||
Port *p = *it;
|
||||
if (p->m_is_input) {
|
||||
const char **connections = jack_port_get_all_connections(client, p->m_port);
|
||||
if (connections != NULL) {
|
||||
for (int j = 0; connections[j] != NULL; ++j) {
|
||||
Connect(port, jack_port_by_name(client, connections[j]));
|
||||
Connect(p->m_port, jack_port_by_name(client, connections[j]));
|
||||
}
|
||||
free(connections);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
free(ports);
|
||||
}
|
||||
|
||||
void PortManager::Add(jack_port_t *port)
|
||||
|
@ -207,6 +220,7 @@ void PortManager::Rename(jack_port_t *port)
|
|||
{
|
||||
Delete(port);
|
||||
Add(port);
|
||||
RefreshConnections();
|
||||
}
|
||||
|
||||
Client *PortManager::FindOrMakeClient(std::string name, bool is_input, bool is_midi)
|
||||
|
|
|
@ -38,6 +38,7 @@ public:
|
|||
|
||||
public:
|
||||
void Refresh();
|
||||
void RefreshConnections();
|
||||
void Add(jack_port_t *port);
|
||||
void Delete(jack_port_t *port);
|
||||
|
||||
|
|
Loading…
Reference in New Issue