Skip to content

Commit e8941b8

Browse files
committed
Add wait_audio_cycle command
Signed-off-by: falkTX <falktx@falktx.com>
1 parent b0701a2 commit e8941b8

3 files changed

Lines changed: 12 additions & 0 deletions

File tree

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -356,6 +356,9 @@ The commands supported by mod-host are:
356356
* all instances must be in deactivated state
357357
e.g.: multi_pre_run 1 2 0 1 2 "gain" 0.0 "distortion" 0.5
358358

359+
wait_audio_cycle
360+
* wait for at least 1 audio cycle to pass
361+
359362
help
360363
* show a help message
361364

src/mod-host.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@
7474
#include "protocol.h"
7575
#include "completer.h"
7676
#include "monitor.h"
77+
#include "monitor/monitor-client.h"
7778
#include "zix/thread.h"
7879
#include "info.h"
7980

@@ -1011,6 +1012,12 @@ static void multi_pre_run(proto_t *proto)
10111012
free(params);
10121013
}
10131014

1015+
static void wait_audio_cycle(proto_t *proto)
1016+
{
1017+
int resp = monitor_client_wait_proc() ? 0 : ERR_INVALID_OPERATION;
1018+
protocol_response_int(resp, proto);
1019+
}
1020+
10141021
static void help_cb(proto_t *proto)
10151022
{
10161023
proto->response = 0;
@@ -1186,6 +1193,7 @@ static int mod_host_init(jack_client_t* client, int socket_port, int feedback_po
11861193
protocol_add_command(MULTI_PARAM_SET, multi_param_set);
11871194
protocol_add_command(MULTI_PARAMS_FLUSH, multi_params_flush);
11881195
protocol_add_command(MULTI_PRE_RUN, multi_pre_run);
1196+
protocol_add_command(WAIT_AUDIO_CYCLE, wait_audio_cycle);
11891197

11901198
/* skip help and quit for internal client */
11911199
if (client == NULL)

src/mod-host.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@
113113
#define MULTI_PARAM_SET "multi_param_set %s %f %i ..."
114114
#define MULTI_PARAMS_FLUSH "multi_params_flush %i %i ... %i ..."
115115
#define MULTI_PRE_RUN "multi_pre_run %i %i ... %i ..."
116+
#define WAIT_AUDIO_CYCLE "wait_audio_cycle"
116117
#define HELP "help"
117118
#define QUIT "quit"
118119

0 commit comments

Comments
 (0)