Skip to content

Commit 09264f9

Browse files
committed
Implement disconnect_all command
Signed-off-by: falkTX <falktx@falktx.com>
1 parent fae0c49 commit 09264f9

File tree

5 files changed

+24
-0
lines changed

5 files changed

+24
-0
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,10 @@ The commands supported by mod-host are:
147147
* disconnect two jack ports
148148
e.g.: disconnect "system:capture_1" "effect_0:in"
149149

150+
disconnect_all <origin_port>
151+
* disconnect all connections of a jack port
152+
e.g.: disconnect_all "effect_0:in"
153+
150154
bypass <instance_number> <bypass_value>
151155
* toggle effect processing
152156
e.g.: bypass 0 1

src/effects.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6130,6 +6130,16 @@ int effects_disconnect(const char *portA, const char *portB)
61306130
return ret;
61316131
}
61326132

6133+
int effects_disconnect_all(const char *port)
6134+
{
6135+
int ret;
6136+
6137+
ret = jack_port_disconnect(g_jack_global_client, jack_port_by_name(g_jack_global_client, port));
6138+
if (ret != 0) return ERR_JACK_PORT_DISCONNECTION;
6139+
6140+
return ret;
6141+
}
6142+
61336143
int effects_set_parameter(int effect_id, const char *control_symbol, float value)
61346144
{
61356145
port_t *port;

src/effects.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ int effects_preset_save(int effect_id, const char *dir, const char *file_name, c
143143
int effects_preset_show(const char *uri, char **state_str);
144144
int effects_connect(const char *portA, const char *portB);
145145
int effects_disconnect(const char *portA, const char *portB);
146+
int effects_disconnect_all(const char *port);
146147
int effects_set_parameter(int effect_id, const char *control_symbol, float value);
147148
int effects_get_parameter(int effect_id, const char *control_symbol, float *value);
148149
int effects_set_property(int effect_id, const char *uri, const char *value);

src/mod-host.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,13 @@ static void effects_disconnect_cb(proto_t *proto)
199199
protocol_response_int(resp, proto);
200200
}
201201

202+
static void effects_disconnect_all_cb(proto_t *proto)
203+
{
204+
int resp;
205+
resp = effects_disconnect_all(proto->list[1]);
206+
protocol_response_int(resp, proto);
207+
}
208+
202209
static void effects_bypass_cb(proto_t *proto)
203210
{
204211
int resp;
@@ -695,6 +702,7 @@ static int mod_host_init(jack_client_t* client, int socket_port, int feedback_po
695702
protocol_add_command(EFFECT_PRESET_SHOW, effects_preset_show_cb);
696703
protocol_add_command(EFFECT_CONNECT, effects_connect_cb);
697704
protocol_add_command(EFFECT_DISCONNECT, effects_disconnect_cb);
705+
protocol_add_command(EFFECT_DISCONNECT_ALL, effects_disconnect_all_cb);
698706
protocol_add_command(EFFECT_BYPASS, effects_bypass_cb);
699707
protocol_add_command(EFFECT_PARAM_SET, effects_set_param_cb);
700708
protocol_add_command(EFFECT_PARAM_GET, effects_get_param_cb);

src/mod-host.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@
6060
#define EFFECT_PRESET_SHOW "preset_show %s"
6161
#define EFFECT_CONNECT "connect %s %s"
6262
#define EFFECT_DISCONNECT "disconnect %s %s"
63+
#define EFFECT_DISCONNECT_ALL "disconnect_all %s"
6364
#define EFFECT_BYPASS "bypass %i %i"
6465
#define EFFECT_PARAM_SET "param_set %i %s %s"
6566
#define EFFECT_PARAM_GET "param_get %i %s"

0 commit comments

Comments
 (0)