mirror of
https://github.com/onyx-and-iris/vmrcli.git
synced 2025-04-20 04:53:48 +01:00
Compare commits
2 Commits
49604b874b
...
2740c6c82d
Author | SHA1 | Date | |
---|---|---|---|
2740c6c82d | |||
0bda368f59 |
17
README.md
17
README.md
@ -12,10 +12,13 @@
|
||||
|
||||
## `Use`
|
||||
|
||||
`./vmrcli.exe [-i] [-k] [-D] <api commands>`
|
||||
```powershell
|
||||
./vmrcli.exe [-h] [-i] [-k] [-D] <api commands>
|
||||
```
|
||||
|
||||
Where:
|
||||
|
||||
- `h`: Prints the help dialogue.
|
||||
- `i`: Enable interactive mode. If set, any api commands passed on the command line will be ignored.
|
||||
- `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
|
||||
@ -30,17 +33,23 @@ Examples:
|
||||
|
||||
Launch basic GUI, set log level to INFO, Toggle Strip 0 Mute, then print its new value
|
||||
|
||||
`./vmrcli.exe -kbasic -D2 !strip[0].mute strip[0].mute`
|
||||
```powershell
|
||||
./vmrcli.exe -kbasic -D2 !strip[0].mute strip[0].mute
|
||||
```
|
||||
|
||||
Launch banana GUI, set log level to DEBUG, set Strip 0 label to podmic then print Strip 2 label
|
||||
|
||||
`./vmrcli.exe -kbanana -D1 strip[0].label=podmic strip[2].label`
|
||||
```powershell
|
||||
./vmrcli.exe -kbanana -D1 strip[0].label=podmic strip[2].label
|
||||
```
|
||||
|
||||
## `Interactive Mode`
|
||||
|
||||
Running the following command in Powershell:
|
||||
|
||||
`./vmrcli.exe -i`
|
||||
```powershell
|
||||
./vmrcli.exe -i
|
||||
```
|
||||
|
||||
Will open an interactive prompt:
|
||||
|
||||
|
@ -1,6 +1,8 @@
|
||||
#ifndef __UTIL_H__
|
||||
#define __UTIL_H__
|
||||
|
||||
void remove_name_in_path(char *szPath);
|
||||
void replace_multiple_space_with_one(char *s, size_t len);
|
||||
char *version_as_string(char *, long v, int n);
|
||||
|
||||
#endif /* __UTIL_H__ */
|
13
src/cdll.c
13
src/cdll.c
@ -1,6 +1,7 @@
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
#include "cdll.h"
|
||||
#include "util.h"
|
||||
|
||||
/*******************************************************************************/
|
||||
/** GET VOICEMEETER DIRECTORY **/
|
||||
@ -12,18 +13,6 @@
|
||||
#define KEY_WOW64_32KEY 0x0200
|
||||
#endif
|
||||
|
||||
void remove_name_in_path(char *szPath)
|
||||
{
|
||||
char *p = szPath;
|
||||
|
||||
while (*p++)
|
||||
;
|
||||
while (p > szPath && *p != '\\')
|
||||
p--;
|
||||
if (*p == '\\')
|
||||
*p = '\0';
|
||||
}
|
||||
|
||||
bool __cdecl registry_get_voicemeeter_folder(char *szDir)
|
||||
{
|
||||
char szKey[256];
|
||||
|
24
src/util.c
24
src/util.c
@ -1,4 +1,18 @@
|
||||
#include <stddef.h>
|
||||
#include <stdio.h>
|
||||
#include "util.h"
|
||||
|
||||
void remove_name_in_path(char *szPath)
|
||||
{
|
||||
char *p = szPath;
|
||||
|
||||
while (*p++)
|
||||
;
|
||||
while (p > szPath && *p != '\\')
|
||||
p--;
|
||||
if (*p == '\\')
|
||||
*p = '\0';
|
||||
}
|
||||
|
||||
void replace_multiple_space_with_one(char *s, size_t len)
|
||||
{
|
||||
@ -33,3 +47,13 @@ void replace_multiple_space_with_one(char *s, size_t len)
|
||||
}
|
||||
s[j] = '\0';
|
||||
}
|
||||
|
||||
char *version_as_string(char *s, long v, int n)
|
||||
{
|
||||
long v1 = (v & 0xFF000000) >> 24,
|
||||
v2 = (v & 0x00FF0000) >> 16,
|
||||
v3 = (v & 0x0000FF00) >> 8,
|
||||
v4 = (v & 0x000000FF);
|
||||
snprintf(s, n, "%i.%i.%i.%i", (int)v1, (int)v2, (int)v3, (int)v4);
|
||||
return s;
|
||||
}
|
14
src/vmr.c
14
src/vmr.c
@ -3,6 +3,9 @@
|
||||
#include <time.h>
|
||||
#include "vmr.h"
|
||||
#include "log.h"
|
||||
#include "util.h"
|
||||
|
||||
#define VERSION_STR_LEN 128
|
||||
|
||||
long login(T_VBVMR_INTERFACE *vmr, int kind)
|
||||
{
|
||||
@ -43,13 +46,10 @@ long login(T_VBVMR_INTERFACE *vmr, int kind)
|
||||
if (rep == 0)
|
||||
{
|
||||
version(vmr, &v);
|
||||
long v1 = (v & 0xFF000000) >> 24,
|
||||
v2 = (v & 0x00FF0000) >> 16,
|
||||
v3 = (v & 0x0000FF00) >> 8,
|
||||
v4 = (v & 0x000000FF);
|
||||
char version_s[128];
|
||||
sprintf(version_s, "%i.%i.%i.%i", (int)v1, (int)v2, (int)v3, (int)v4);
|
||||
log_info("Successfully logged into the Voicemeeter API v%s", version_s);
|
||||
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));
|
||||
clear_dirty(vmr);
|
||||
}
|
||||
return rep;
|
||||
|
@ -112,8 +112,9 @@ int main(int argc, char *argv[])
|
||||
void help()
|
||||
{
|
||||
puts(
|
||||
"Usage: ./vmrcli.exe [-i] [-k] [-D] <api commands>\n"
|
||||
"Usage: ./vmrcli.exe [-h] [-i] [-k] [-D] <api commands>\n"
|
||||
"Where: \n"
|
||||
"\th: Prints the help dialogue\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");
|
||||
|
Loading…
x
Reference in New Issue
Block a user