From a5c6430991bc2edf9c0572c19705babc231ea3a7 Mon Sep 17 00:00:00 2001 From: Maksym Date: Sun, 13 Oct 2024 21:21:34 +0200 Subject: [PATCH] Log have been disabled Some patches have been applied --- .gitignore | 3 ++- src/Logger.ts | 2 ++ src/VMR/Control.ts | 8 ++++---- src/VMR/Remote.ts | 34 ++++++++++++++++++++-------------- src/VMR/VMObject.ts | 2 +- tsconfig.json | 2 +- 6 files changed, 30 insertions(+), 21 deletions(-) diff --git a/.gitignore b/.gitignore index 79fcef1..271af6b 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,5 @@ node_modules .vscode logs VoicemeeterRemote.h -.hintrc \ No newline at end of file +.hintrc +dist \ No newline at end of file diff --git a/src/Logger.ts b/src/Logger.ts index 55a1521..34ab4f1 100644 --- a/src/Logger.ts +++ b/src/Logger.ts @@ -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); diff --git a/src/VMR/Control.ts b/src/VMR/Control.ts index 97abf8b..972e4ce 100644 --- a/src/VMR/Control.ts +++ b/src/VMR/Control.ts @@ -60,7 +60,7 @@ export class Control extends Remote { })() as Record; 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(); diff --git a/src/VMR/Remote.ts b/src/VMR/Remote.ts index 4b85d44..98c2bab 100644 --- a/src/VMR/Remote.ts +++ b/src/VMR/Remote.ts @@ -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 - >; + + public dllFuncs = {} as Partial>; 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); } } diff --git a/src/VMR/VMObject.ts b/src/VMR/VMObject.ts index f4ec2c9..84fc032 100644 --- a/src/VMR/VMObject.ts +++ b/src/VMR/VMObject.ts @@ -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 ); diff --git a/tsconfig.json b/tsconfig.json index f626743..f53c755 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -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. */