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