Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Kontakt instrument switching #26

Merged
merged 2 commits into from
Oct 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +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

### Changed

Expand Down
53 changes: 52 additions & 1 deletion Includes/Overlays/Kontakt7.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ Class Kontakt7 {
PluginHeader.AddCustomButton("LIBRARY On/Off",,, Kontakt7.ActivatePluginHeaderButton).SetHotkey("!L", "Alt+L")
PluginHeader.AddCustomButton("VIEW menu",,, Kontakt7.ActivatePluginHeaderButton).SetHotkey("!V", "Alt+V")
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("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 @@ -194,6 +196,34 @@ Class Kontakt7 {
}
}

Class ActivatePluginInstrumentButton {
Static Call(InstrumentButton) {
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.MoveToPluginInstrumentButton("Previous instrument")
If CheckColor() {
Kontakt7.MoveToPluginInstrumentButton(InstrumentButton)
Click
Return
}
}
AccessibilityOverlay.Speak("Instrument switching unavailable. Make sure that an instrument is loaded and that you're in rack view.")
CheckColor() {
MouseGetPos &mouseXPosition, &mouseYPosition
Sleep 10
FoundColor := PixelGetColor(MouseXPosition, MouseYPosition, "Slow")
If FoundColor = "0x545355" Or FoundColor = "0x656465"
Return True
Return False
}
}
}

Class ActivatePluginSnapshotButton {
Static Call(SnapshotButton) {
Critical
Expand All @@ -220,7 +250,9 @@ Class Kontakt7 {
AccessibilityOverlay.Speak("Snapshot switching unavailable. Make sure that an instrument is loaded and that you're in rack view.")
CheckColor() {
MouseGetPos &mouseXPosition, &mouseYPosition
If PixelGetColor(MouseXPosition, MouseYPosition, "Slow") = "0x424142" Or PixelGetColor(MouseXPosition, MouseYPosition, "Slow") = "0x545454"
Sleep 10
FoundColor := PixelGetColor(MouseXPosition, MouseYPosition, "Slow")
If FoundColor = "0x424142" Or FoundColor = "0x545454"
Return True
Return False
}
Expand Down Expand Up @@ -261,6 +293,25 @@ Class Kontakt7 {
}
}

Class MoveToPluginInstrumentButton {
Static Call(InstrumentButton) {
Label := InstrumentButton
If InstrumentButton Is Object
Label := InstrumentButton.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 instrument"
MouseMove ControlX + ControlWidth - 344, ControlY + 138
Else
MouseMove ControlX + ControlWidth - 324, ControlY + 138
}
}
}

Class MoveToPluginSnapshotButton {
Static Call(SnapshotButton) {
If SnapshotButton Is Object And InStr(SnapshotButton.Label, "Snapshot", True)
Expand Down
53 changes: 52 additions & 1 deletion Includes/Overlays/Kontakt8.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ Class Kontakt8 {
PluginHeader.AddCustomButton("LIBRARY On/Off",,, Kontakt8.ActivatePluginHeaderButton).SetHotkey("!L", "Alt+L")
PluginHeader.AddCustomButton("VIEW menu",,, Kontakt8.ActivatePluginHeaderButton).SetHotkey("!V", "Alt+V")
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("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 @@ -194,6 +196,34 @@ Class Kontakt8 {
}
}

Class ActivatePluginInstrumentButton {
Static Call(InstrumentButton) {
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.MoveToPluginInstrumentButton("Previous instrument")
If CheckColor() {
Kontakt8.MoveToPluginInstrumentButton(InstrumentButton)
Click
Return
}
}
AccessibilityOverlay.Speak("Instrument switching unavailable. Make sure that an instrument is loaded and that you're in classic view.")
CheckColor() {
MouseGetPos &mouseXPosition, &mouseYPosition
Sleep 10
FoundColor := PixelGetColor(MouseXPosition, MouseYPosition, "Slow")
If FoundColor = "0x545355" Or FoundColor = "0x656465"
Return True
Return False
}
}
}

Class ActivatePluginSnapshotButton {
Static Call(SnapshotButton) {
Critical
Expand All @@ -220,7 +250,9 @@ Class Kontakt8 {
AccessibilityOverlay.Speak("Snapshot switching unavailable. Make sure that an instrument is loaded and that you're in classic view.")
CheckColor() {
MouseGetPos &mouseXPosition, &mouseYPosition
If PixelGetColor(MouseXPosition, MouseYPosition, "Slow") = "0x424142" Or PixelGetColor(MouseXPosition, MouseYPosition, "Slow") = "0x545454"
Sleep 10
FoundColor := PixelGetColor(MouseXPosition, MouseYPosition, "Slow")
If FoundColor = "0x424142" Or FoundColor = "0x545454"
Return True
Return False
}
Expand Down Expand Up @@ -261,6 +293,25 @@ Class Kontakt8 {
}
}

Class MoveToPluginInstrumentButton {
Static Call(InstrumentButton) {
Label := InstrumentButton
If InstrumentButton Is Object
Label := InstrumentButton.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 instrument"
MouseMove ControlX + ControlWidth - 344, ControlY + 138
Else
MouseMove ControlX + ControlWidth - 324, ControlY + 138
}
}
}

Class MoveToPluginSnapshotButton {
Static Call(SnapshotButton) {
If SnapshotButton Is Object And InStr(SnapshotButton.Label, "Snapshot", True)
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ 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.
- Only works inside REAPER.
* Provides support for the 'Browse' button in the Kontakt Content Missing dialog.
Expand Down Expand Up @@ -105,5 +107,4 @@ HotspotHelper is a special utility to make developing these kind of scripts a li

This is an incomplete list of features we're planning to look into in the future or are currently developing. Noone can guarantee that they will ever become reality, but they might at some point, and you can always open an issue to either offer help or request a new entry on this list. This list doesn't necessarily include bugfixes or additional features for entries above, except if they require special treatment and time to investigate them.

* Switching between instruments in Kontakt
* Melodyne accessibility
Loading