Compare commits

..

No commits in common. "35ec276979e62a16ca385a2a0118ddb6fa3eccaa" and "760924def873c0a143be7938071fba3e565eec61" have entirely different histories.

2 changed files with 8 additions and 28 deletions

View File

@ -1,19 +1,17 @@
#include <windows.h> #include <windows.h>
#include <stdio.h> #include <stdio.h>
#include <time.h>
#include "vmr.h" #include "vmr.h"
#include "log.h" #include "log.h"
long login(T_VBVMR_INTERFACE *iVMR, int kind) long login(T_VBVMR_INTERFACE *iVMR, int kind)
{ {
int rep; int rep;
long v;
rep = iVMR->VBVMR_Login(); rep = iVMR->VBVMR_Login();
Sleep(20); Sleep(20);
if (rep == 1) if (rep == 1)
{ {
run_voicemeeter(iVMR, kind); rep = run_voicemeeter(iVMR, kind);
switch (kind) switch (kind)
{ {
case BASIC: case BASIC:
@ -30,27 +28,11 @@ long login(T_VBVMR_INTERFACE *iVMR, int kind)
break; break;
} }
time_t endwait; Sleep(1200);
int timeout = 2;
endwait = time(NULL) + timeout;
while (time(NULL) < endwait)
{
if ((rep = version(iVMR, &v)) == 0)
break;
Sleep(20);
}
} }
if (rep == 0) if (rep == 0)
{ {
version(iVMR, &v); log_info("Successfully logged into the Voicemeeter API");
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);
clear_dirty(iVMR); clear_dirty(iVMR);
} }
return rep; return rep;
@ -80,31 +62,29 @@ long type(T_VBVMR_INTERFACE *iVMR, long *type)
long version(T_VBVMR_INTERFACE *iVMR, long *version) long version(T_VBVMR_INTERFACE *iVMR, long *version)
{ {
log_trace("VBVMR_GetVoicemeeterType(<long> *v)"); return iVMR->VBVMR_GetVoicemeeterType(version);
return iVMR->VBVMR_GetVoicemeeterVersion(version);
} }
bool is_pdirty(T_VBVMR_INTERFACE *iVMR) bool is_pdirty(T_VBVMR_INTERFACE *iVMR)
{ {
log_trace("VBVMR_IsParametersDirty()");
return iVMR->VBVMR_IsParametersDirty() == 1; return iVMR->VBVMR_IsParametersDirty() == 1;
} }
long get_parameter_float(T_VBVMR_INTERFACE *iVMR, char *param, float *f) long get_parameter_float(T_VBVMR_INTERFACE *iVMR, char *param, float *f)
{ {
log_trace("VBVMR_GetParameterFloat(%s, <float> *f)", param, f); log_trace("VBVMR_GetParameterFloat(%s, %f)", param, f);
return iVMR->VBVMR_GetParameterFloat(param, f); return iVMR->VBVMR_GetParameterFloat(param, f);
} }
long get_parameter_string(T_VBVMR_INTERFACE *iVMR, char *param, char *s) long get_parameter_string(T_VBVMR_INTERFACE *iVMR, char *param, char *s)
{ {
log_trace("VBVMR_GetParameterStringA(%s, <char> *s)", param, s); log_trace("VBVMR_GetParameterStringA(%s, %s)", param, s);
return iVMR->VBVMR_GetParameterStringA(param, s); return iVMR->VBVMR_GetParameterStringA(param, s);
} }
long set_parameter_float(T_VBVMR_INTERFACE *iVMR, char *param, float val) long set_parameter_float(T_VBVMR_INTERFACE *iVMR, char *param, float val)
{ {
log_trace("VBVMR_SetParameterFloat(%s, %.2f)", param, val); log_trace("VBVMR_SetParameterFloat(%s, %f)", param, val);
return iVMR->VBVMR_SetParameterFloat(param, val); return iVMR->VBVMR_SetParameterFloat(param, val);
} }

View File

@ -226,7 +226,7 @@ void parse_command(T_VBVMR_INTERFACE *vmr, char *command)
switch (res.type) switch (res.type)
{ {
case FLOAT_T: case FLOAT_T:
printf("%.1f\n", res.val.f); printf("%.2f\n", res.val.f);
break; break;
case STRING_T: case STRING_T:
puts(res.val.s); puts(res.val.s);