mirror of
https://github.com/onyx-and-iris/vmrcli.git
synced 2026-09-20 01:42:25 +00:00
add -k flag
use it to set kind use kind to launch GUI
This commit is contained in:
+41
-6
@@ -7,21 +7,28 @@
|
||||
|
||||
#define MAX_LINE 1024
|
||||
|
||||
int init_voicemeeter(T_VBVMR_INTERFACE *vmr);
|
||||
int set_kind(char *kval);
|
||||
int init_voicemeeter(T_VBVMR_INTERFACE *vmr, int kind);
|
||||
void interactive(T_VBVMR_INTERFACE *vmr);
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
bool iflag = false;
|
||||
int c;
|
||||
char *kvalue;
|
||||
int kind = BANANA;
|
||||
|
||||
while ((c = getopt(argc, argv, "i")) != -1)
|
||||
while ((c = getopt(argc, argv, "k:i")) != -1)
|
||||
{
|
||||
switch (c)
|
||||
{
|
||||
case 'i':
|
||||
iflag = true;
|
||||
break;
|
||||
case 'k':
|
||||
kvalue = optarg;
|
||||
kind = set_kind(kvalue);
|
||||
break;
|
||||
default:
|
||||
abort();
|
||||
}
|
||||
@@ -30,7 +37,7 @@ int main(int argc, char *argv[])
|
||||
static T_VBVMR_INTERFACE iVMR;
|
||||
T_VBVMR_INTERFACE *vmr = &iVMR;
|
||||
|
||||
int rep = init_voicemeeter(vmr);
|
||||
int rep = init_voicemeeter(vmr, kind);
|
||||
if (rep)
|
||||
{
|
||||
exit(EXIT_FAILURE);
|
||||
@@ -51,12 +58,41 @@ int main(int argc, char *argv[])
|
||||
|
||||
rep = logout(vmr);
|
||||
if (!rep)
|
||||
{
|
||||
puts("Successfully logged out of Voicemeeter API");
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
else
|
||||
{
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
}
|
||||
|
||||
int init_voicemeeter(T_VBVMR_INTERFACE *vmr)
|
||||
int set_kind(char *kval)
|
||||
{
|
||||
if (strcmp(kval, "basic") == 0)
|
||||
{
|
||||
return BASIC;
|
||||
}
|
||||
else if (strcmp(kval, "banana") == 0)
|
||||
{
|
||||
return BANANA;
|
||||
}
|
||||
else if (strcmp(kval, "potato") == 0)
|
||||
{
|
||||
if (sizeof(void *) == 8)
|
||||
return POTATOX64;
|
||||
else
|
||||
return POTATO;
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf(stderr, "Unknown Voicemeeter kind '%s'\n", kval);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
|
||||
int init_voicemeeter(T_VBVMR_INTERFACE *vmr, int kind)
|
||||
{
|
||||
int rep = initialize_dll_interfaces(vmr);
|
||||
if (rep < 0)
|
||||
@@ -72,13 +108,12 @@ int init_voicemeeter(T_VBVMR_INTERFACE *vmr)
|
||||
return rep;
|
||||
}
|
||||
|
||||
rep = login(vmr);
|
||||
rep = login(vmr, kind);
|
||||
if (rep != 0)
|
||||
{
|
||||
fputs("Error logging into Voicemeeter", stderr);
|
||||
return rep;
|
||||
}
|
||||
clear_dirty(vmr);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user