Log have been disabled
Some patches have been applied
This commit is contained in:
parent
d1fea9d837
commit
a5c6430991
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -3,3 +3,4 @@ node_modules
|
|||
logs
|
||||
VoicemeeterRemote.h
|
||||
.hintrc
|
||||
dist
|
|
@ -23,6 +23,7 @@ export class Logger {
|
|||
}
|
||||
|
||||
private createNewLogFile() {
|
||||
return "";
|
||||
const date = new Date().toISOString().split("T");
|
||||
date[1] = date[1].split(".")[0].replaceAll(":", "-");
|
||||
const fileName = `${date.join("-")}.log`;
|
||||
|
@ -52,6 +53,7 @@ export class Logger {
|
|||
},
|
||||
...args: any
|
||||
) {
|
||||
return;
|
||||
const strings: string[] = [];
|
||||
for (const argument of args) {
|
||||
const string = this.toString(argument);
|
||||
|
|
|
@ -60,7 +60,7 @@ export class Control extends Remote {
|
|||
})() as Record<keyof (typeof Control)["strips"], number>;
|
||||
|
||||
public loggedIn: boolean = false;
|
||||
public parametersUpdated: boolean = false;
|
||||
public isParametersUpdated: boolean = false;
|
||||
private interval: NodeJS.Timeout | undefined;
|
||||
|
||||
@validation()
|
||||
|
@ -146,9 +146,9 @@ export class Control extends Remote {
|
|||
`An error occurred while checking for updated parameters. DLL result code: ${result}`
|
||||
);
|
||||
const isUpdated = result === 1 ? true : false;
|
||||
if (this.parametersUpdated !== isUpdated && isUpdated)
|
||||
console.log(`Updated state`);
|
||||
this.parametersUpdated = isUpdated;
|
||||
// if (this.isParametersUpdated !== isUpdated && isUpdated)
|
||||
// console.log(`Updated state`);
|
||||
this.isParametersUpdated = isUpdated;
|
||||
}, 20);
|
||||
};
|
||||
if (this.interval === undefined) createTimer();
|
||||
|
|
|
@ -20,37 +20,43 @@ export class Remote {
|
|||
"VBVMR_Input_GetDeviceNumber",
|
||||
"VBVMR_GetVoicemeeterVersion",
|
||||
"VBVMR_Input_GetDeviceDescA",
|
||||
"VBVMR_Output_GetDeviceDescA"
|
||||
"VBVMR_Output_GetDeviceDescA",
|
||||
] as const;
|
||||
|
||||
public dllFuncs = {} as Partial<
|
||||
Record<RemoteFuncs, KoffiFunction>
|
||||
>;
|
||||
public dllFuncs = {} as Partial<Record<RemoteFuncs, KoffiFunction>>;
|
||||
public dll: IKoffiLib;
|
||||
|
||||
constructor(dllPath: string) {
|
||||
constructor(dllPath: string, private headerPath: string) {
|
||||
this.dll = load(dllPath);
|
||||
if (typeof headerPath !== "string") {
|
||||
throwError("headerPath isn't a string");
|
||||
return;
|
||||
}
|
||||
if (typeof dllPath !== "string") {
|
||||
throwError("dllPath isn't a string");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
public async initialize() {
|
||||
const parser = new Parser(path.join(__dirname,"../", "VoicemeeterRemote.h"));
|
||||
const parser = new Parser(this.headerPath);
|
||||
const results = await parser.parse();
|
||||
for (const func of Remote.allowedFuncs) {
|
||||
const funcHeader = results.find((r) => r.name === func);
|
||||
if (funcHeader === undefined)
|
||||
return throwError(`Allowed function not found in header file. Caused by function: ${func}`);
|
||||
return throwError(
|
||||
`Allowed function not found in header file. Caused by function: ${func}`
|
||||
);
|
||||
this.dllFuncs[func] = this.dll.func(funcHeader.rawString);
|
||||
}
|
||||
}
|
||||
|
||||
public run(
|
||||
command: RemoteFuncs,
|
||||
...args: any
|
||||
) {
|
||||
public run(command: RemoteFuncs, ...args: any) {
|
||||
if (!Remote.allowedFuncs.includes(command))
|
||||
throwError("Used function isn't listed in allowed");
|
||||
const func = this.dllFuncs[command];
|
||||
if(func === undefined)return throwError("Executed function wasn't initialized");
|
||||
return func(...args)
|
||||
if (func === undefined)
|
||||
return throwError("Executed function wasn't initialized");
|
||||
return func(...args);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -78,7 +78,7 @@ export abstract class VMObject {
|
|||
}
|
||||
protected setParamValueNumber(parameter: string, value: number): number {
|
||||
const result = this.control.run(
|
||||
"VBVMR_GetParameterFloat",
|
||||
"VBVMR_SetParameterFloat",
|
||||
parameter,
|
||||
value
|
||||
);
|
||||
|
|
|
@ -50,7 +50,7 @@
|
|||
// "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */
|
||||
|
||||
/* Emit */
|
||||
// "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */
|
||||
"declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */
|
||||
// "declarationMap": true, /* Create sourcemaps for d.ts files. */
|
||||
// "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
|
||||
// "sourceMap": true, /* Create source map files for emitted JavaScript files. */
|
||||
|
|
Loading…
Reference in New Issue
Block a user