Compare commits

..

5 Commits

Author SHA1 Message Date
b95c40265c fix s flag in help message 2024-07-02 17:59:44 +01:00
4b64ae95fd add -m flag for launching macrobuttons app.
add -s flag for launching streamerview app

add -m, -s flags to Use section in README.
2024-07-02 17:49:51 +01:00
f8d2f80cbf remove the extra call to version 2024-07-02 14:49:42 +01:00
4b79b7f849 add -= example to README 2024-07-02 12:00:16 +01:00
3ec98ea391 add note about += and -= to README
add increment/decrement instructions to example_commands
2024-07-02 11:55:34 +01:00
5 changed files with 59 additions and 31 deletions

View File

@ -13,7 +13,7 @@
## `Use`
```powershell
./vmrcli.exe [-h] [-i] [-k] [-D] [-v] <api commands>
./vmrcli.exe [-h] [-i] [-k] [-D] [-v] [-m] [-s] <api commands>
```
Where:
@ -23,19 +23,21 @@ Where:
- `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
- `v`: Enable extra console output (toggle, set messages)
- `m`: Launch the MacroButtons application
- `s`: Launch the StreamerView application
## `API Commands`
- Commands starting with `!` will be toggled, use it with boolean parameters.
- Commands containing `=` will set a value.
- Commands containing `=` will set a value. (use `+=` and `-=` to increment/decrement)
- All other commands with get a value.
Examples:
Launch basic GUI, set log level to INFO, Toggle Strip 0 Mute, then print its new value
Launch basic GUI, set log level to INFO, Toggle Strip 0 Mute, print its new value, then decrease Bus 0 Gain by 3.8
```powershell
./vmrcli.exe -kbasic -D2 !strip[0].mute strip[0].mute
./vmrcli.exe -kbasic -D2 !strip[0].mute strip[0].mute bus[0].gain-=3.8
```
Launch banana GUI, set log level to DEBUG, set Strip 0 label to podmic then print Strip 2 label

View File

@ -1,3 +1,5 @@
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[1].mute=1 strip[1].mute strip[1].limit-=8
strip[2].gain-=5 strip[2].comp+=4.8
bus[0].label
bus[1].gain-=5.8

View File

@ -12,6 +12,8 @@ enum kind
BASICX64,
BANANAX64,
POTATOX64,
MACROBUTTONS = 11,
STREAMERVIEW
};
long login(T_VBVMR_INTERFACE *vmr, int kind);

View File

@ -30,25 +30,25 @@ long login(T_VBVMR_INTERFACE *vmr, int kind)
log_info(
"Launching Voicemeeter %s GUI",
kind_as_string(kind_s, kind, KIND_STR_LEN));
}
time_t endwait;
int timeout = 2;
endwait = time(NULL) + timeout;
time_t start = time(NULL);
do
{
if ((rep = version(vmr, &v)) == 0)
break;
Sleep(50);
} while (time(NULL) < endwait);
}
if (rep == 0)
{
version(vmr, &v);
char version_s[VERSION_STR_LEN];
log_info(
"Successfully logged into the Voicemeeter API v%s",
version_as_string(version_s, v, VERSION_STR_LEN));
break;
}
Sleep(50);
} while (time(NULL) < start + timeout);
if (rep == 0)
{
clear_dirty(vmr);
}
return rep;

View File

@ -47,6 +47,8 @@ bool vflag = false;
int main(int argc, char *argv[])
{
bool iflag = false;
bool mflag = false;
bool sflag = false;
int opt;
char *kvalue = "";
int dvalue;
@ -60,20 +62,26 @@ 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, "hk:msiD:v")) != -1)
{
switch (opt)
{
case 'i':
iflag = true;
break;
case 'h':
help();
exit(EXIT_SUCCESS);
case 'k':
kvalue = optarg;
kind = set_kind(kvalue);
break;
case 'h':
help();
exit(EXIT_SUCCESS);
case 'm':
mflag = true;
break;
case 's':
sflag = true;
break;
case 'i':
iflag = true;
break;
case 'D':
dvalue = atoi(optarg);
if (dvalue >= LOG_TRACE && dvalue <= LOG_FATAL)
@ -104,6 +112,18 @@ int main(int argc, char *argv[])
exit(EXIT_FAILURE);
}
if (mflag)
{
log_info("MacroButtons app launched");
run_voicemeeter(vmr, MACROBUTTONS);
}
if (sflag)
{
log_info("StreamerView app launched");
run_voicemeeter(vmr, STREAMERVIEW);
}
if (iflag)
{
puts("Interactive mode enabled. Enter 'Q' to exit.");
@ -131,13 +151,15 @@ 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] [-v] [-m] [-s] <api commands>\n"
"Where: \n"
"\th: Prints the help message\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\n"
"\tv: Enable extra console output (toggle, set messages)");
"\tv: Enable extra console output (toggle, set messages)\n"
"\tm: Launch the MacroButtons application\n"
"\ts: Launch the StreamerView application");
}
/**