Skip to content

Commit

Permalink
Fix jsdoc comments
Browse files Browse the repository at this point in the history
  • Loading branch information
SaifAqqad committed Mar 9, 2024
1 parent 44f6168 commit 071a1e4
Show file tree
Hide file tree
Showing 4 changed files with 81 additions and 12 deletions.
46 changes: 39 additions & 7 deletions dist/VMR.ahk
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* VMR.ahk - A wrapper for Voicemeeter's Remote API
* - Version 2.0.0-rc
* - Build timestamp 2024-02-12 17:11:08 UTC
* - Version 2.0.0
* - Build timestamp 2024-03-09 06:00:02 UTC
* - Repository: {@link https://github.com/SaifAqqad/VMR.ahk GitHub}
* - Documentation: {@link https://saifaqqad.github.io/VMR.ahk VMR Docs}
*/
Expand Down Expand Up @@ -96,16 +96,40 @@ class VMRUtils {
}
}
class VMRError extends Error {
/**.
* The return code of the Voicemeeter function that failed
* @type {Number}
*/
ReturnCode := ""
/**
* The name of the function that threw the error
* @type {String}
*/
What := ""
/**
* An error message
* @type {String}
*/
Message := ""
/**
* Extra information about the error
* @type {String}
*/
Extra := ""
/**
* @param {Any} p_errorValue - The error value
* @param {String} p_funcName - The name of the function that threw the error
* @param {Array} p_funcParams The parameters of the function that threw the error
*/
__New(p_errorValue, p_funcName, p_funcParams*) {
this.returnCode := ""
this.What := p_funcName
this.Extra := p_errorValue
this.Message := "VMR failure in " p_funcName "(" VMRUtils.Join(p_funcParams, ", ") ")"
if (p_errorValue is Error) {
this.Extra := "Inner error message (" p_errorValue.Message ")"
}
else if (IsNumber(p_errorValue)) {
this.returnCode := p_errorValue
this.ReturnCode := p_errorValue
this.Extra := "VMR Return Code (" p_errorValue ")"
}
}
Expand Down Expand Up @@ -1495,6 +1519,7 @@ class VMRMacroButton {
Run() => Run(VBVMR.DLL_PATH "\" VMRMacroButton.EXECUTABLE, VBVMR.DLL_PATH)
/**
* Shows/Hides the Voicemeeter Macro Buttons application.
* @param {Boolean} p_show - Whether to show or hide the application
*/
Show(p_show := true) {
if (p_show) {
Expand All @@ -1508,7 +1533,7 @@ class VMRMacroButton {
}
/**
* Sets the status of a given button.
* @param {Number} p_logicalButton - The one-based index of the button
* @param {Number} p_index - The one-based index of the button
* @param {Number} p_value - The value to set
* - `0`: Off
* - `1`: On
Expand All @@ -1522,10 +1547,10 @@ class VMRMacroButton {
* - `1`: On
* @throws {VMRError} - If an internal error occurs
*/
SetStatus(p_index, p_status, p_bitMode := 0) => VBVMR.MacroButton_SetStatus(p_index - 1, p_status, p_bitMode)
SetStatus(p_index, p_value, p_bitMode := 0) => VBVMR.MacroButton_SetStatus(p_index - 1, p_value, p_bitMode)
/**
* Gets the status of a given button.
* @param {Number} p_logicalButton - The one-based index of the button
* @param {Number} p_index - The one-based index of the button
* @param {Number} p_bitMode - The type of the returned value
* - `0`: button-state
* - `2`: displayed-state
Expand Down Expand Up @@ -1595,6 +1620,13 @@ class VMRRecorder extends VMRControllerBase {
for i in p_strips
this.ArmStrip[i] := true
}
/**
* Loads the specified file into the recorder.
* @param {String} p_path - The file's path.
* __________
* @returns {VMRAsyncOp} - An async operation that resolves to `true` if the parameter was set successfully.
* @throws {VMRError} - If invalid parameters are passed or if an internal error occurs.
*/
Load(p_path) => this.SetParameter("load", p_path)
}
class VMRVBAN extends VMRControllerBase {
Expand Down
33 changes: 31 additions & 2 deletions src/VMRError.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,37 @@
#Include VMRUtils.ahk

class VMRError extends Error {

/**.
* The return code of the Voicemeeter function that failed
* @type {Number}
*/
ReturnCode := ""

/**
* The name of the function that threw the error
* @type {String}
*/
What := ""

/**
* An error message
* @type {String}
*/
Message := ""

/**
* Extra information about the error
* @type {String}
*/
Extra := ""

/**
* @param {Any} p_errorValue - The error value
* @param {String} p_funcName - The name of the function that threw the error
* @param {Array} p_funcParams The parameters of the function that threw the error
*/
__New(p_errorValue, p_funcName, p_funcParams*) {
this.returnCode := ""
this.What := p_funcName
this.Extra := p_errorValue
this.Message := "VMR failure in " p_funcName "(" VMRUtils.Join(p_funcParams, ", ") ")"
Expand All @@ -12,7 +41,7 @@ class VMRError extends Error {
this.Extra := "Inner error message (" p_errorValue.Message ")"
}
else if (IsNumber(p_errorValue)) {
this.returnCode := p_errorValue
this.ReturnCode := p_errorValue
this.Extra := "VMR Return Code (" p_errorValue ")"
}
}
Expand Down
7 changes: 4 additions & 3 deletions src/VMRMacroButton.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ class VMRMacroButton {

/**
* Shows/Hides the Voicemeeter Macro Buttons application.
* @param {Boolean} p_show - Whether to show or hide the application
*/
Show(p_show := true) {
if (p_show) {
Expand All @@ -28,7 +29,7 @@ class VMRMacroButton {

/**
* Sets the status of a given button.
* @param {Number} p_logicalButton - The one-based index of the button
* @param {Number} p_index - The one-based index of the button
* @param {Number} p_value - The value to set
* - `0`: Off
* - `1`: On
Expand All @@ -42,11 +43,11 @@ class VMRMacroButton {
* - `1`: On
* @throws {VMRError} - If an internal error occurs
*/
SetStatus(p_index, p_status, p_bitMode := 0) => VBVMR.MacroButton_SetStatus(p_index - 1, p_status, p_bitMode)
SetStatus(p_index, p_value, p_bitMode := 0) => VBVMR.MacroButton_SetStatus(p_index - 1, p_value, p_bitMode)

/**
* Gets the status of a given button.
* @param {Number} p_logicalButton - The one-based index of the button
* @param {Number} p_index - The one-based index of the button
* @param {Number} p_bitMode - The type of the returned value
* - `0`: button-state
* - `2`: displayed-state
Expand Down
7 changes: 7 additions & 0 deletions src/VMRRecorder.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -66,5 +66,12 @@ class VMRRecorder extends VMRControllerBase {
this.ArmStrip[i] := true
}

/**
* Loads the specified file into the recorder.
* @param {String} p_path - The file's path.
* __________
* @returns {VMRAsyncOp} - An async operation that resolves to `true` if the parameter was set successfully.
* @throws {VMRError} - If invalid parameters are passed or if an internal error occurs.
*/
Load(p_path) => this.SetParameter("load", p_path)
}

0 comments on commit 071a1e4

Please sign in to comment.