mirror of
https://github.com/onyx-and-iris/vmrcli.git
synced 2025-04-20 04:53:48 +01:00
Compare commits
No commits in common. "a383aaa36ba8199704c9deb4f2b2221677c5baaa" and "12a55a52f221ca572c455991682c1876b294f9d7" have entirely different histories.
a383aaa36b
...
12a55a52f2
13
README.md
13
README.md
@ -68,25 +68,18 @@ Scripts can be loaded from text files, for example in Powershell:
|
||||
./vmrcli.exe -D1 $(Get-Content .\example_commands.txt)
|
||||
```
|
||||
|
||||
Multiple API commands can be in a single line but they should be space separated.
|
||||
|
||||
## `Build`
|
||||
|
||||
Run the included `makefile` with [GNU Make](https://www.gnu.org/software/make/).
|
||||
|
||||
The binary in [Releases][releases] is compiled with coloured logging enabled. To disable this you can override the `LOG_USE_COLOR` variable, for example:
|
||||
By default the log.c module is built with coloured logging enabled. To disable this you can override the `LOG_USE_COLOR` variable, for example:
|
||||
|
||||
`make LOG_USE_COLOR=no`
|
||||
|
||||
## `Official Documentation`
|
||||
|
||||
- [Voicemeeter Remote C API][remoteapi-docs]
|
||||
- [Voicemeeter Remote C API](https://github.com/onyx-and-iris/Voicemeeter-SDK/blob/main/VoicemeeterRemoteAPI.pdf)
|
||||
|
||||
## `Special Thanks`
|
||||
|
||||
- [rxi][rxi-user] for writing the [log.c][log-c] package
|
||||
|
||||
[releases]: https://github.com/onyx-and-iris/vmrcli/releases
|
||||
[remoteapi-docs]: https://github.com/onyx-and-iris/Voicemeeter-SDK/blob/main/VoicemeeterRemoteAPI.pdf
|
||||
[rxi-user]: https://github.com/rxi
|
||||
[log-c]: https://github.com/rxi/log.c
|
||||
- [rxi](https://github.com/rxi) for writing the [log.c](https://github.com/rxi/log.c) package
|
||||
|
@ -1,3 +1,8 @@
|
||||
strip[0].mute !strip[0].mute strip[0].mute strip[0].gain strip[0].label=podmic strip[0].label
|
||||
strip[1].mute=1 strip[1].mute
|
||||
bus[0].label bus[0].gain=-8.3
|
||||
strip[0].mute
|
||||
!strip[0].mute
|
||||
strip[0].mute
|
||||
strip[1].mute=1
|
||||
strip[1].mute
|
||||
strip[0].gain
|
||||
strip[0].label=podmic
|
||||
strip[0].label
|
@ -14,23 +14,23 @@ enum kind
|
||||
POTATOX64,
|
||||
};
|
||||
|
||||
long login(T_VBVMR_INTERFACE *vmr, int kind);
|
||||
long logout(T_VBVMR_INTERFACE *vmr);
|
||||
long run_voicemeeter(T_VBVMR_INTERFACE *vmr, int kind);
|
||||
long type(T_VBVMR_INTERFACE *vmr, long *type);
|
||||
long version(T_VBVMR_INTERFACE *vmr, long *version);
|
||||
long login(T_VBVMR_INTERFACE *iVMR, int kind);
|
||||
long logout(T_VBVMR_INTERFACE *iVMR);
|
||||
long run_voicemeeter(T_VBVMR_INTERFACE *iVMR, int kind);
|
||||
long type(T_VBVMR_INTERFACE *iVMR, long *type);
|
||||
long version(T_VBVMR_INTERFACE *iVMR, long *version);
|
||||
|
||||
bool is_pdirty(T_VBVMR_INTERFACE *vmr);
|
||||
long get_parameter_float(T_VBVMR_INTERFACE *vmr, char *param, float *f);
|
||||
long get_parameter_string(T_VBVMR_INTERFACE *vmr, char *param, unsigned short *s);
|
||||
long set_parameter_float(T_VBVMR_INTERFACE *vmr, char *param, float val);
|
||||
long set_parameter_string(T_VBVMR_INTERFACE *vmr, char *param, char *s);
|
||||
long set_parameters(T_VBVMR_INTERFACE *vmr, char *command);
|
||||
bool is_pdirty(T_VBVMR_INTERFACE *iVMR);
|
||||
long get_parameter_float(T_VBVMR_INTERFACE *iVMR, char *param, float *f);
|
||||
long get_parameter_string(T_VBVMR_INTERFACE *iVMR, char *param, unsigned short *s);
|
||||
long set_parameter_float(T_VBVMR_INTERFACE *iVMR, char *param, float val);
|
||||
long set_parameter_string(T_VBVMR_INTERFACE *iVMR, char *param, char *s);
|
||||
long set_parameters(T_VBVMR_INTERFACE *iVMR, char *command);
|
||||
|
||||
bool is_mdirty(T_VBVMR_INTERFACE *vmr);
|
||||
long macrobutton_getstatus(T_VBVMR_INTERFACE *vmr, long n, float *val, long mode);
|
||||
long macrobutton_setstatus(T_VBVMR_INTERFACE *vmr, long n, float val, long mode);
|
||||
bool is_mdirty(T_VBVMR_INTERFACE *iVMR);
|
||||
long macrobutton_getstatus(T_VBVMR_INTERFACE *iVMR, long n, float *val, long mode);
|
||||
long macrobutton_setstatus(T_VBVMR_INTERFACE *iVMR, long n, float val, long mode);
|
||||
|
||||
void clear_dirty(T_VBVMR_INTERFACE *vmr);
|
||||
void clear_dirty(T_VBVMR_INTERFACE *iVMR);
|
||||
|
||||
#endif /* __VMR_H__ */
|
||||
#endif
|
67
src/vmrcli.c
67
src/vmrcli.c
@ -29,12 +29,9 @@ void help(void);
|
||||
enum kind set_kind(char *kval);
|
||||
int init_voicemeeter(T_VBVMR_INTERFACE *vmr, int kind);
|
||||
void interactive(T_VBVMR_INTERFACE *vmr);
|
||||
void parse_input(T_VBVMR_INTERFACE *vmr, char *input, int len);
|
||||
void parse_command(T_VBVMR_INTERFACE *vmr, char *command);
|
||||
void get(T_VBVMR_INTERFACE *vmr, char *command, struct result *res);
|
||||
|
||||
bool vflag = false;
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
bool iflag = false;
|
||||
@ -51,7 +48,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
log_set_level(LOG_WARN);
|
||||
|
||||
while ((opt = getopt(argc, argv, "k:ihD:v")) != -1)
|
||||
while ((opt = getopt(argc, argv, "k:ihD:")) != -1)
|
||||
{
|
||||
switch (opt)
|
||||
{
|
||||
@ -78,9 +75,6 @@ int main(int argc, char *argv[])
|
||||
"Log level will default to LOG_WARN (3).\n");
|
||||
}
|
||||
break;
|
||||
case 'v':
|
||||
vflag = true;
|
||||
break;
|
||||
default:
|
||||
abort();
|
||||
}
|
||||
@ -104,7 +98,7 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
for (int i = optind; i < argc; i++)
|
||||
{
|
||||
parse_input(vmr, argv[i], strlen(argv[i]));
|
||||
parse_command(vmr, argv[i]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -122,13 +116,12 @@ int main(int argc, char *argv[])
|
||||
void help()
|
||||
{
|
||||
puts(
|
||||
"Usage: ./vmrcli.exe [-h] [-i] [-k] [-D] [-v] <api commands>\n"
|
||||
"Usage: ./vmrcli.exe [-h] [-i] [-k] [-D] <api commands>\n"
|
||||
"Where: \n"
|
||||
"\th: Prints the help dialogue\n"
|
||||
"\ti: Enable interactive mode\n"
|
||||
"\tk: The kind of Voicemeeter (basic, banana, potato)\n"
|
||||
"\tD: Set log level 0=TRACE, 1=DEBUG, 2=INFO, 3=WARN, 4=ERROR, 5=FATAL"
|
||||
"\tv: Enable extra console output (toggle, set messages)\n");
|
||||
"\tD: Set log level 0=TRACE, 1=DEBUG, 2=INFO, 3=WARN, 4=ERROR, 5=FATAL");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -195,7 +188,9 @@ int init_voicemeeter(T_VBVMR_INTERFACE *vmr, int kind)
|
||||
|
||||
void interactive(T_VBVMR_INTERFACE *vmr)
|
||||
{
|
||||
char input[MAX_LINE];
|
||||
char input[MAX_LINE], command[MAX_LINE];
|
||||
char *p = input;
|
||||
int i;
|
||||
size_t len;
|
||||
|
||||
printf(">> ");
|
||||
@ -206,26 +201,32 @@ void interactive(T_VBVMR_INTERFACE *vmr)
|
||||
if (len == 1 && toupper(input[0]) == 'Q')
|
||||
break;
|
||||
|
||||
parse_input(vmr, input, len);
|
||||
replace_multiple_space_with_one(input, len);
|
||||
while (*p)
|
||||
{
|
||||
if (isspace(*p))
|
||||
{
|
||||
p++;
|
||||
continue;
|
||||
}
|
||||
log_trace("commands still in buffer: %s", p);
|
||||
|
||||
i = 0;
|
||||
while (*p && !isspace(*p))
|
||||
command[i++] = *p++;
|
||||
command[i] = '\0';
|
||||
|
||||
if (command[0] != '\0')
|
||||
parse_command(vmr, command);
|
||||
memset(command, '\0', MAX_LINE);
|
||||
}
|
||||
|
||||
p = input; /* reset pointer */
|
||||
memset(input, '\0', MAX_LINE); /* reset input buffer */
|
||||
printf(">> ");
|
||||
}
|
||||
}
|
||||
|
||||
void parse_input(T_VBVMR_INTERFACE *vmr, char *input, int len)
|
||||
{
|
||||
char *token;
|
||||
|
||||
replace_multiple_space_with_one(input, len);
|
||||
token = strtok(input, " ");
|
||||
while (token != NULL)
|
||||
{
|
||||
parse_command(vmr, token);
|
||||
token = strtok(NULL, " ");
|
||||
}
|
||||
}
|
||||
|
||||
void parse_command(T_VBVMR_INTERFACE *vmr, char *command)
|
||||
{
|
||||
log_debug("Parsing %s", command);
|
||||
@ -239,13 +240,7 @@ void parse_command(T_VBVMR_INTERFACE *vmr, char *command)
|
||||
if (res.type == FLOAT_T)
|
||||
{
|
||||
if (res.val.f == 1 || res.val.f == 0)
|
||||
{
|
||||
set_parameter_float(vmr, command, 1 - res.val.f);
|
||||
if (vflag)
|
||||
{
|
||||
printf("Toggling %s\n", command);
|
||||
}
|
||||
}
|
||||
else
|
||||
log_warn("%s does not appear to be a boolean parameter", command);
|
||||
}
|
||||
@ -255,10 +250,6 @@ void parse_command(T_VBVMR_INTERFACE *vmr, char *command)
|
||||
if (strchr(command, '=') != NULL) /* set */
|
||||
{
|
||||
set_parameters(vmr, command);
|
||||
if (vflag)
|
||||
{
|
||||
printf("Setting %s\n", command);
|
||||
}
|
||||
}
|
||||
else /* get */
|
||||
{
|
||||
@ -268,10 +259,10 @@ void parse_command(T_VBVMR_INTERFACE *vmr, char *command)
|
||||
switch (res.type)
|
||||
{
|
||||
case FLOAT_T:
|
||||
printf("%s: %.1f\n", command, res.val.f);
|
||||
printf("%.1f\n", res.val.f);
|
||||
break;
|
||||
case STRING_T:
|
||||
printf("%s: %ls\n", command, res.val.s);
|
||||
printf("%ls\n", res.val.s);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
Loading…
x
Reference in New Issue
Block a user