Swift API for controlling Novation Launchpad.
$ pod 'LaunchpadKit'
$ pod install
- Singleton
shared
object. - Autoconnects launchpads.
- Informs implementor with
LaunchpadManagarDelegate
func launchpadManagerSetupDidChange(_ launchpadManager: LaunchpadManager)
func launchpadManager(_ launchpadManager: LaunchpadManager, didConnect launchpad: Launchpad)
func launchpadManager(_ launchpadManager: LaunchpadManager, didDisconnect launchpad: Launchpad)
func launchpadManager(_ launchpadManager: LaunchpadManager, launchpad: Launchpad, didPress button: LaunchpadButton)
func launchpadManager(_ launchpadManager: LaunchpadManager, launchpad: Launchpad, didUnpress button: LaunchpadButton)
- Can connect/disconnect launchpads manually
public func connect(launchpad: Launchpad)
public func disconnect(launchpad: Launchpad)
- Can set colors of
LaunchpadButton
s
public func setLaunchpadButtonColor(
_ launchpad: Launchpad,
x: Int,
y: Int,
color: LaunchpadButton.Color,
brightness: LaunchpadButton.Brightness
)
- The launchpad object with grid of
LaunchpadButton
s. - Created by
LaunchpadManager
automatically when it detects an available launchpad. - Can get/set a button with
[row: Int, column: Int]
subscript.
// First button of the second row.
let button = launchpad[1, 0]
// Sets third button of first row.
launchpad[1, 2] = newButton
- Can get all buttons in a row.
// get first row
let firstRow = launchpad[row: 0]
- Can get all buttons in a column.
// get first column
let firstCol = launchpad[col: 0]
- Can get
sceneButtons
. - Can get
liveButtons
.
- Created by
Launchpad
object initially on itsgrid
array. - Has
color
andbrightness
properties.
public enum Brightness: Int {
case off
case min
case mid
case max
}
public enum Color: Int {
case green
case red
case yellow
case amber
}
- You can read
isPressed
state.