Skip to content

Commit

Permalink
Add properties for string bus/strip parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
SaifAqqad committed Nov 25, 2023
1 parent 2c57017 commit 6fa770a
Show file tree
Hide file tree
Showing 2 changed files with 72 additions and 0 deletions.
44 changes: 44 additions & 0 deletions src/VMRAudioIO.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,50 @@ class VMRAudioIO {
return VBVMR.SetParameters(script) == 0
}

/**
* Sets the gain to a specific value with a progressive fade.
*
* @param {Number} p_db - The gain value in dBs.
* @param {Number} p_duration - The duration of the fade in milliseconds.
* __________
* @returns {Boolean} - `true` if the gain was set successfully.
* @throws {VMRError} - If invalid parameters are passed or if an internal error occurs.
*/
FadeTo(p_db, p_duration) {
if (!VMRAudioIO.IS_CLASS_INIT)
return false

if (!IsNumber(p_db))
throw VMRError("p_db must be a number", this.FadeTo.Name, p_db, p_duration)

if (!IsNumber(p_duration))
throw VMRError("p_duration must be a number", this.FadeTo.Name, p_db, p_duration)

return this.SetParameter("FadeTo", "(" p_db ", " p_duration ")")
}

/**
* Fades the gain by a specific amount.
*
* @param {Number} p_dbAmount - The amount to fade the gain by in dBs.
* @param {Number} p_duration - The duration of the fade in milliseconds.
* _________
* @returns {Boolean} - `true` if the gain was set successfully.
* @throws {VMRError} - If invalid parameters are passed or if an internal error occurs.
*/
FadeBy(p_dbAmount, p_duration) {
if (!VMRAudioIO.IS_CLASS_INIT)
return false

if (!IsNumber(p_dbAmount))
throw VMRError("p_dbAmount must be a number", this.FadeBy.Name, p_dbAmount, p_duration)

if (!IsNumber(p_duration))
throw VMRError("p_duration must be a number", this.FadeBy.Name, p_dbAmount, p_duration)

return this.SetParameter("FadeBy", "(" p_dbAmount ", " p_duration ")")
}

/**
* Returns `true` if the bus/strip is a physical (hardware) one.
* __________
Expand Down
28 changes: 28 additions & 0 deletions src/VMRStrip.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,34 @@ class VMRStrip extends VMRAudioIO {
*/
Name := ""

/**
* Sets an application's gain on the strip.
*
* @param {String} p_name - The name of the application.
* @type {Number} - The application's gain (`0.0` to `1.0`).
* __________
* @throws {VMRError} - If invalid parameters are passed or if an internal error occurs.
*/
AppGain[p_name] {
set {
VBVMR.SetParameter("AppGain", "(" p_name ", " Value ")")
}
}

/**
* Sets an application's mute state on the strip.
*
* @param {String} p_name - The name of the application.
* @type {Boolean} - The application's mute state.
* __________
* @throws {VMRError} - If invalid parameters are passed or if an internal error occurs.
*/
AppMute[p_name] {
set {
VBVMR.SetParameter("AppGain", "(" p_name ", " Value ")")
}
}

/**
* Creates a new VMRStrip object.
* @param {Number} p_index - The zero-based index of the strip.
Expand Down

0 comments on commit 6fa770a

Please sign in to comment.