mirror of
https://github.com/onyx-and-iris/vmrcli.git
synced 2026-09-16 16:02:29 +00:00
add create_interface() to cdll.c.
Use it to initialize the dll interface and return a pointer to it.
This commit is contained in:
+10
-39
@@ -36,12 +36,11 @@ struct result
|
||||
} val;
|
||||
};
|
||||
|
||||
static T_VBVMR_INTERFACE iVMR;
|
||||
bool vflag = false;
|
||||
static bool vflag = false;
|
||||
|
||||
void help(void);
|
||||
enum kind set_kind(char *kval);
|
||||
int init_voicemeeter(PT_VMR vmr, enum kind kind);
|
||||
int init_voicemeeter(enum kind kind);
|
||||
void interactive(PT_VMR vmr);
|
||||
void parse_input(PT_VMR vmr, char *input, int len);
|
||||
void parse_command(PT_VMR vmr, char *command);
|
||||
@@ -109,11 +108,12 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
}
|
||||
|
||||
PT_VMR vmr = &iVMR;
|
||||
PT_VMR vmr = create_interface();
|
||||
|
||||
int rep = init_voicemeeter(vmr, kind);
|
||||
int rep = login(vmr, kind);
|
||||
if (rep != 0)
|
||||
{
|
||||
log_fatal("Error logging into the Voicemeeter API");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
@@ -144,9 +144,14 @@ int main(int argc, char *argv[])
|
||||
|
||||
rep = logout(vmr);
|
||||
if (rep == 0)
|
||||
{
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
else
|
||||
{
|
||||
log_fatal("Error logging out of the Voicemeeter API");
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -202,40 +207,6 @@ enum kind set_kind(char *kval)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Defines the DLL interface as a struct.
|
||||
* Logs into the API.
|
||||
*
|
||||
* @param vmr The API interface as a struct
|
||||
* @param kind
|
||||
* @return int
|
||||
*/
|
||||
int init_voicemeeter(PT_VMR vmr, enum kind kind)
|
||||
{
|
||||
int rep = initialize_dll_interfaces(vmr);
|
||||
if (rep < 0)
|
||||
{
|
||||
if (rep == -100)
|
||||
{
|
||||
log_fatal("Voicemeeter is not installed");
|
||||
}
|
||||
else
|
||||
{
|
||||
log_fatal("Error loading Voicemeeter dll with code %d\n", rep);
|
||||
}
|
||||
return rep;
|
||||
}
|
||||
|
||||
rep = login(vmr, kind);
|
||||
if (rep != 0)
|
||||
{
|
||||
log_fatal("Error logging into Voicemeeter");
|
||||
return rep;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Continuously read lines from stdin.
|
||||
* Break if 'Q' is entered on the interactive prompt.
|
||||
|
||||
Reference in New Issue
Block a user