Skip to content

Commit

Permalink
Merge pull request #27 from MatejGolian/Kontakt-multi-switching
Browse files Browse the repository at this point in the history
Add Kontakt multi switching
  • Loading branch information
MatejGolian authored Oct 18, 2024
2 parents b24f80d + e2b6faf commit 886ba39
Show file tree
Hide file tree
Showing 4 changed files with 100 additions and 4 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- Added option to disable the 'window may be covered' warning
- Added Kontakt 8 support
- Added Kontakt instrument switching
- Added Kontakt instrument and multi switching

### Changed

Expand Down
49 changes: 49 additions & 0 deletions Includes/Overlays/Kontakt7.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ Class Kontakt7 {
PluginHeader.AddCustomButton("SHOP (Opens in default web browser)",,, Kontakt7.ActivatePluginHeaderButton).SetHotkey("!S", "Alt+S")
PluginHeader.AddCustomButton("Previous instrument", Kontakt7.MoveToPluginInstrumentButton,,, Kontakt7.ActivatePluginInstrumentButton).SetHotkey("^P", "Ctrl+P")
PluginHeader.AddCustomButton("Next instrument", Kontakt7.MoveToPluginInstrumentButton,,, Kontakt7.ActivatePluginInstrumentButton).SetHotkey("^N", "Ctrl+N")
PluginHeader.AddCustomButton("Previous multi", Kontakt7.MoveToPluginMultiButton,,, Kontakt7.ActivatePluginMultiButton).SetHotkey("^+P", "Ctrl+Shift+P")
PluginHeader.AddCustomButton("Next multi", Kontakt7.MoveToPluginMultiButton,,, Kontakt7.ActivatePluginMultiButton).SetHotkey("^+N", "Ctrl+Shift+N")
PluginHeader.AddCustomButton("Snapshot menu", Kontakt7.MoveToPluginSnapshotButton,,, Kontakt7.ActivatePluginSnapshotButton).SetHotkey("!M", "Alt+M")
PluginHeader.AddCustomButton("Previous snapshot", Kontakt7.MoveToPluginSnapshotButton,,, Kontakt7.ActivatePluginSnapshotButton).SetHotkey("!P", "Alt+P")
PluginHeader.AddCustomButton("Next snapshot", Kontakt7.MoveToPluginSnapshotButton,,, Kontakt7.ActivatePluginSnapshotButton).SetHotkey("!N", "Alt+N")
Expand Down Expand Up @@ -224,6 +226,34 @@ Class Kontakt7 {
}
}

Class ActivatePluginMultiButton {
Static Call(MultiButton) {
Critical
UIAElement := GetUIAElement("15,1,5")
If Not UIAElement = False And UIAElement.Name = "SHOP" {
Try
ControlGetPos &ControlX, &ControlY, &ControlWidth, &ControlHeight, ReaHotkey.GetPluginControl(), "A"
Catch
Return
Kontakt7.MoveToPluginMultiButton("Previous multi")
If CheckColor() {
Kontakt7.MoveToPluginMultiButton(MultiButton)
Click
Return
}
}
AccessibilityOverlay.Speak("Multi switching unavailable. Make sure that a multi is loaded and that you're in rack view.")
CheckColor() {
MouseGetPos &mouseXPosition, &mouseYPosition
Sleep 10
FoundColor := PixelGetColor(MouseXPosition, MouseYPosition, "Slow")
If FoundColor = "0x323232"
Return True
Return False
}
}
}

Class ActivatePluginSnapshotButton {
Static Call(SnapshotButton) {
Critical
Expand Down Expand Up @@ -312,6 +342,25 @@ Class Kontakt7 {
}
}

Class MoveToPluginMultiButton {
Static Call(MultiButton) {
Label := MultiButton
If MultiButton Is Object
Label := MultiButton.Label
UIAElement := GetUIAElement("15,1,5")
If Not UIAElement = False And UIAElement.Name = "SHOP" {
Try
ControlGetPos &ControlX, &ControlY, &ControlWidth, &ControlHeight, ReaHotkey.GetPluginControl(), "A"
Catch
Return
If Label = "Previous multi"
MouseMove ControlX + 712, ControlY + 104
Else
MouseMove ControlX + 730, ControlY + 104
}
}
}

Class MoveToPluginSnapshotButton {
Static Call(SnapshotButton) {
If SnapshotButton Is Object And InStr(SnapshotButton.Label, "Snapshot", True)
Expand Down
49 changes: 49 additions & 0 deletions Includes/Overlays/Kontakt8.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ Class Kontakt8 {
PluginHeader.AddCustomButton("SHOP (Opens in default web browser)",,, Kontakt8.ActivatePluginHeaderButton).SetHotkey("!S", "Alt+S")
PluginHeader.AddCustomButton("Previous instrument", Kontakt8.MoveToPluginInstrumentButton,,, Kontakt8.ActivatePluginInstrumentButton).SetHotkey("^P", "Ctrl+P")
PluginHeader.AddCustomButton("Next instrument", Kontakt8.MoveToPluginInstrumentButton,,, Kontakt8.ActivatePluginInstrumentButton).SetHotkey("^N", "Ctrl+N")
PluginHeader.AddCustomButton("Previous multi", Kontakt8.MoveToPluginMultiButton,,, Kontakt8.ActivatePluginMultiButton).SetHotkey("^+P", "Ctrl+Shift+P")
PluginHeader.AddCustomButton("Next multi", Kontakt8.MoveToPluginMultiButton,,, Kontakt8.ActivatePluginMultiButton).SetHotkey("^+N", "Ctrl+Shift+N")
PluginHeader.AddCustomButton("Snapshot menu", Kontakt8.MoveToPluginSnapshotButton,,, Kontakt8.ActivatePluginSnapshotButton).SetHotkey("!M", "Alt+M")
PluginHeader.AddCustomButton("Previous snapshot", Kontakt8.MoveToPluginSnapshotButton,,, Kontakt8.ActivatePluginSnapshotButton).SetHotkey("!P", "Alt+P")
PluginHeader.AddCustomButton("Next snapshot", Kontakt8.MoveToPluginSnapshotButton,,, Kontakt8.ActivatePluginSnapshotButton).SetHotkey("!N", "Alt+N")
Expand Down Expand Up @@ -224,6 +226,34 @@ Class Kontakt8 {
}
}

Class ActivatePluginMultiButton {
Static Call(MultiButton) {
Critical
UIAElement := GetUIAElement("15,1,5")
If Not UIAElement = False And UIAElement.Name = "SHOP" {
Try
ControlGetPos &ControlX, &ControlY, &ControlWidth, &ControlHeight, ReaHotkey.GetPluginControl(), "A"
Catch
Return
Kontakt8.MoveToPluginMultiButton("Previous multi")
If CheckColor() {
Kontakt8.MoveToPluginMultiButton(MultiButton)
Click
Return
}
}
AccessibilityOverlay.Speak("Multi switching unavailable. Make sure that a multi is loaded and that you're in classic view.")
CheckColor() {
MouseGetPos &mouseXPosition, &mouseYPosition
Sleep 10
FoundColor := PixelGetColor(MouseXPosition, MouseYPosition, "Slow")
If FoundColor = "0x323232"
Return True
Return False
}
}
}

Class ActivatePluginSnapshotButton {
Static Call(SnapshotButton) {
Critical
Expand Down Expand Up @@ -312,6 +342,25 @@ Class Kontakt8 {
}
}

Class MoveToPluginMultiButton {
Static Call(MultiButton) {
Label := MultiButton
If MultiButton Is Object
Label := MultiButton.Label
UIAElement := GetUIAElement("15,1,5")
If Not UIAElement = False And UIAElement.Name = "SHOP" {
Try
ControlGetPos &ControlX, &ControlY, &ControlWidth, &ControlHeight, ReaHotkey.GetPluginControl(), "A"
Catch
Return
If Label = "Previous multi"
MouseMove ControlX + 730, ControlY + 104
Else
MouseMove ControlX + 750, ControlY + 104
}
}
}

Class MoveToPluginSnapshotButton {
Static Call(SnapshotButton) {
If SnapshotButton Is Object And InStr(SnapshotButton.Label, "Snapshot", True)
Expand Down
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,7 @@ Our changelog can be found [in our dedicated changelog file](https://github.com/
- Works both inside REAPER and in the standalone version of Komplete Kontrol.
* Makes it possible to interact with Kontakt menus.
- Works both inside REAPER and in the standalone version of Kontakt, Full and Player. Note that Kontakt version 7.10 or higher is required.
* Makes it possible to switch Between instruments/NKIs in Kontakt.
- Only works inside REAPER.
* Makes it possible to select and cycle through snapshots in Kontakt.
* Makes it possible to switch Between instruments, multis and snapshots in Kontakt.
- Only works inside REAPER.
* Provides support for the 'Browse' button in the Kontakt Content Missing dialog.
- Works both inside REAPER and in the standalone version of Kontakt. This feature may not work with Komplete Kontrol.
Expand Down

0 comments on commit 886ba39

Please sign in to comment.