Skip to content

Commit

Permalink
Add support for string RecallPreset command + Update README
Browse files Browse the repository at this point in the history
  • Loading branch information
SaifAqqad committed Feb 12, 2024
1 parent 7c73182 commit 64d6c2e
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 14 deletions.
20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,32 +9,32 @@ VMR.ahk

To use `VMR.ahk` in your script, follow one of the following methods:

### A - ahkpm installation
### A. ahkpm installation

1. Install and set up [ahkpm](https://github.com/joshuacc/ahkpm), then run `ahkpm install gh:SaifAqqad/VMR.ahk`
2. Run `ahkpm include gh:SaifAqqad/VMR.ahk -f my-script.ahk` to add an include directive in your script
###### Replace *my-script.ahk* with your script's path
1. Install and set up [ahkpm](https://github.com/joshuacc/ahkpm)
2. Run `ahkpm install gh:SaifAqqad/VMR.ahk`
3. Include VMR in your script by running `ahkpm include gh:SaifAqqad/VMR.ahk -f myScript.ahk`
###### Replace *myScript.ahk* with your script's path

### B - Manual Installation
### B. Manual Installation

1. Download the latest pre-built version from the [`dist` folder](https://raw.githubusercontent.com/SaifAqqad/VMR.ahk/master/dist/VMR.ahk) or follow the build instructions below
2. Include it using `#Include VMR.ahk` or copy it to a [library folder](https://www.autohotkey.com/docs/v2/Scripts.htm#lib) and use `#Include <VMR>`

**Note: The current version of VMR only works with AHK v2, The AHK v1 version is available on the [v1 branch](https://github.com/SaifAqqad/VMR.ahk/tree/v1)**
> [!IMPORTANT]
> The current version of VMR ***only*** supports AHK v2, The AHK v1 version is still available on the [v1 branch](https://github.com/SaifAqqad/VMR.ahk/tree/v1) but will not receive any updates.
## Usage

- Create an instance of the VMR class and log in to the API:
```ahk
voicemeeter := VMR().login()
```
- The `VMR` object will have two arrays (`Bus` and `Strip`), as well as other objects, that will allow you to control voicemeeter in AHK.
- The `VMR` object will have two arrays (`Bus` and `Strip`), as well as other properties/methods that will allow you to control voicemeeter in AHK
```ahk
voicemeeter.Bus[1].mute := true
voicemeeter.Strip[4].gain++
```

##### For more info, check out the [documentation](https://saifaqqad.github.io/VMR.ahk/)
##### For more info, check out the [documentation](https://saifaqqad.github.io/VMR.ahk/) and the [examples](./examples/)

## Build instructions

Expand Down
1 change: 0 additions & 1 deletion examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
* ### [Hotkey example](./hotkey_example.ahk): create hotkeys to control VoiceMeeter.

* ### [UI example](./ui_example.ahk): a simple GUI that controls VoiceMeeter's buses
###### Not converted to v2 yet
![UI example](https://user-images.githubusercontent.com/47293197/118356850-d7be9e80-b57f-11eb-843a-db7f8dd996d1.gif)

* ### [Level stabilizer](./level_stabilizer_example.ahk): stabilizes the audio level by adjusting the gain.
Expand Down
9 changes: 6 additions & 3 deletions src/VMRCommands.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -147,11 +147,14 @@ class VMRCommands {
/**
* Recalls a Preset Scene
*
* @param {Number} p_presetIndex - The one-based index of the preset
* @param {String | Number} p_preset - The name of the preset to recall or its one-based index
* __________
* @returns {Boolean} - true if the command was successful
*/
RecallPreset(p_presetIndex) {
return VBVMR.SetParameterFloat("Command", "Preset[" p_presetIndex - 1 "].Recall", 1) == 0
RecallPreset(p_preset) {
if(IsNumber(p_preset))
return VBVMR.SetParameterFloat("Command", "Preset[" p_preset - 1 "].Recall", 1) == 0
else
return VBVMR.SetParameterString("Command", "RecallPreset", p_preset) == 0
}
}

0 comments on commit 64d6c2e

Please sign in to comment.