mirror of
https://github.com/onyx-and-iris/vmrcli.git
synced 2025-08-09 13:01:49 +00:00
Compare commits
No commits in common. "41bf1322ac019f1ec19dbdcaec2263d15ea36b2a" and "9191a3874522cd951f8274fcb95abac0cd61b60b" have entirely different histories.
41bf1322ac
...
9191a38745
17
README.md
17
README.md
@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
Where:
|
Where:
|
||||||
|
|
||||||
- `i`: Enable interactive mode. If set, any api commands passed on the command line will be ignored.
|
- `i`: Enable interactive mode. If set any api commands passed will be ignored.
|
||||||
- `k`: The kind of Voicemeeter (basic, banana or potato). Use this to launch the GUI.
|
- `k`: The kind of Voicemeeter (basic, banana or potato). Use this to launch the GUI.
|
||||||
- `D`: Set log level 0=TRACE, 1=DEBUG, 2=INFO, 3=WARN, 4=ERROR, 5=FATAL
|
- `D`: Set log level 0=TRACE, 1=DEBUG, 2=INFO, 3=WARN, 4=ERROR, 5=FATAL
|
||||||
|
|
||||||
@ -36,21 +36,6 @@ Launch banana GUI, set log level to DEBUG, set Strip 0 label to podmic then prin
|
|||||||
|
|
||||||
`./vmrcli.exe -kbanana -D1 strip[0].label=podmic strip[2].label`
|
`./vmrcli.exe -kbanana -D1 strip[0].label=podmic strip[2].label`
|
||||||
|
|
||||||
## `Interactive Mode`
|
|
||||||
|
|
||||||
Running the following command in Powershell:
|
|
||||||
|
|
||||||
`./vmrcli.exe -i`
|
|
||||||
|
|
||||||
Will open an interactive prompt:
|
|
||||||
|
|
||||||
```powershell
|
|
||||||
Interactive mode enabled. Enter 'Q' to exit.
|
|
||||||
>>
|
|
||||||
```
|
|
||||||
|
|
||||||
API commands follow the same rules as listed above. Entering `Q` or `q` will exit the program.
|
|
||||||
|
|
||||||
## `Script files`
|
## `Script files`
|
||||||
|
|
||||||
Scripts can be loaded from text files, for example in Powershell:
|
Scripts can be loaded from text files, for example in Powershell:
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#ifndef __UTIL_H__
|
#ifndef __UTIL_H__
|
||||||
#define __UTIL_H__
|
#define __UTIL_H__
|
||||||
|
|
||||||
void replace_multiple_space_with_one(char *s, size_t len);
|
void replace_multiple_space_with_one(char *s);
|
||||||
|
|
||||||
#endif /* __UTIL_H__ */
|
#endif /* __UTIL_H__ */
|
@ -1,9 +1,10 @@
|
|||||||
#include <stddef.h>
|
#include <string.h>
|
||||||
|
|
||||||
void replace_multiple_space_with_one(char *s, size_t len)
|
void replace_multiple_space_with_one(char *s)
|
||||||
{
|
{
|
||||||
int j = 0;
|
int j = 0;
|
||||||
int count = 0;
|
int count = 0;
|
||||||
|
int len = strlen(s);
|
||||||
|
|
||||||
if (len == 1 && (s[0] == ' ' || s[0] == '\t'))
|
if (len == 1 && (s[0] == ' ' || s[0] == '\t'))
|
||||||
{
|
{
|
||||||
@ -32,4 +33,6 @@ void replace_multiple_space_with_one(char *s, size_t len)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
s[j] = '\0';
|
s[j] = '\0';
|
||||||
|
|
||||||
|
return;
|
||||||
}
|
}
|
20
src/vmrcli.c
20
src/vmrcli.c
@ -175,24 +175,17 @@ void interactive(T_VBVMR_INTERFACE *vmr)
|
|||||||
char *p = input;
|
char *p = input;
|
||||||
char command[MAX_LINE];
|
char command[MAX_LINE];
|
||||||
int i;
|
int i;
|
||||||
size_t len;
|
|
||||||
|
|
||||||
printf(">> ");
|
|
||||||
while (fgets(input, MAX_LINE, stdin) != NULL)
|
while (fgets(input, MAX_LINE, stdin) != NULL)
|
||||||
{
|
{
|
||||||
input[strcspn(input, "\n")] = 0;
|
input[strcspn(input, "\n")] = 0;
|
||||||
len = strlen(input);
|
if (strlen(input) == 1 && (strncmp(input, "Q", 1) == 0 || strncmp(input, "q", 1) == 0))
|
||||||
if (len == 1 && toupper(input[0]) == 'Q')
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
replace_multiple_space_with_one(input, len);
|
replace_multiple_space_with_one(input);
|
||||||
while (*p)
|
while (*p)
|
||||||
{
|
{
|
||||||
if (isspace(*p))
|
memset(command, '\0', sizeof(command));
|
||||||
{
|
|
||||||
p++;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
i = 0;
|
i = 0;
|
||||||
|
|
||||||
while (!isspace(*p))
|
while (!isspace(*p))
|
||||||
@ -201,11 +194,11 @@ void interactive(T_VBVMR_INTERFACE *vmr)
|
|||||||
|
|
||||||
if (command[0] != '\0')
|
if (command[0] != '\0')
|
||||||
parse_command(vmr, command);
|
parse_command(vmr, command);
|
||||||
memset(command, '\0', sizeof(command));
|
|
||||||
|
p++; /* shift to next input char */
|
||||||
}
|
}
|
||||||
|
|
||||||
p = input; /* reset pointer */
|
p = input; /* reset pointer */
|
||||||
printf(">> ");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -244,6 +237,7 @@ void parse_command(T_VBVMR_INTERFACE *vmr, char *command)
|
|||||||
puts(res.val.s);
|
puts(res.val.s);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
log_error("Unexpected result type");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -258,7 +252,7 @@ void get(T_VBVMR_INTERFACE *vmr, char *command, struct result *res)
|
|||||||
if (get_parameter_string(vmr, command, res->val.s) != 0)
|
if (get_parameter_string(vmr, command, res->val.s) != 0)
|
||||||
{
|
{
|
||||||
res->val.s[0] = 0;
|
res->val.s[0] = 0;
|
||||||
log_error("Unknown parameter '%s'", command);
|
log_error("Unknown parameter");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user