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]));
|
Add(jack_port_by_name(client, ports[i]));
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; ports[i] != NULL; ++i) {
|
free(ports);
|
||||||
jack_port_t *port = jack_port_by_name(client, ports[i]);
|
|
||||||
if (jack_port_flags(port) & JackPortIsInput) {
|
RefreshConnections();
|
||||||
const char **connections = jack_port_get_all_connections(client, port);
|
}
|
||||||
|
|
||||||
|
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) {
|
if (connections != NULL) {
|
||||||
for (int j = 0; connections[j] != NULL; ++j) {
|
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(connections);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
free(ports);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void PortManager::Add(jack_port_t *port)
|
void PortManager::Add(jack_port_t *port)
|
||||||
|
@ -207,6 +220,7 @@ void PortManager::Rename(jack_port_t *port)
|
||||||
{
|
{
|
||||||
Delete(port);
|
Delete(port);
|
||||||
Add(port);
|
Add(port);
|
||||||
|
RefreshConnections();
|
||||||
}
|
}
|
||||||
|
|
||||||
Client *PortManager::FindOrMakeClient(std::string name, bool is_input, bool is_midi)
|
Client *PortManager::FindOrMakeClient(std::string name, bool is_input, bool is_midi)
|
||||||
|
|
|
@ -38,6 +38,7 @@ public:
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void Refresh();
|
void Refresh();
|
||||||
|
void RefreshConnections();
|
||||||
void Add(jack_port_t *port);
|
void Add(jack_port_t *port);
|
||||||
void Delete(jack_port_t *port);
|
void Delete(jack_port_t *port);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue