From 4b64ae95fd44a685fc9e1754c980aa3304b49a1b Mon Sep 17 00:00:00 2001 From: onyx-and-iris Date: Tue, 2 Jul 2024 17:49:51 +0100 Subject: [PATCH] add -m flag for launching macrobuttons app. add -s flag for launching streamerview app add -m, -s flags to Use section in README. --- README.md | 4 +++- include/vmr.h | 2 ++ src/vmrcli.c | 40 +++++++++++++++++++++++++++++++--------- 3 files changed, 36 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index f089972..92216d0 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ ## `Use` ```powershell -./vmrcli.exe [-h] [-i] [-k] [-D] [-v] +./vmrcli.exe [-h] [-i] [-k] [-D] [-v] [-m] [-s] ``` Where: @@ -23,6 +23,8 @@ 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` diff --git a/include/vmr.h b/include/vmr.h index 37959ca..0f1776d 100644 --- a/include/vmr.h +++ b/include/vmr.h @@ -12,6 +12,8 @@ enum kind BASICX64, BANANAX64, POTATOX64, + MACROBUTTONS = 11, + STREAMERVIEW }; long login(T_VBVMR_INTERFACE *vmr, int kind); diff --git a/src/vmrcli.c b/src/vmrcli.c index 249f9ce..c066c94 100644 --- a/src/vmrcli.c +++ b/src/vmrcli.c @@ -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] \n" + "Usage: ./vmrcli.exe [-h] [-i] [-k] [-D] [-v] [-m] [-s] \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" + "\tm: Launch the StreamerView application"); } /**