TriggerKit

0.2.0

lightbeamapps/TriggerKit

What's New

0.2.0

2024-01-20T04:06:12Z

What's Changed

Full Changelog: 0.1.0...0.2.0

TriggerKit

Bind MIDI events to code blocks in your application

BSD 3-clause

TriggerKit is a Swift framework for binding events to your app's code. You can use TriggerKit with iOS and iPad applications. MacOS is enabled in the Package, but not currently tested.

TriggerKit is currently in Beta, and as such, may have breaking changes in future releases. When the planned event types are added, I will issue a 1.0 release.

I would like to thank Steffan Andrews for their MIDIKit library, without which TriggerKit would not be able to exist in it's current form.

The key concept for TriggerKit, is that you can create codable actions for you app and events, and easily store and restore mappings for MIDI and other event types.

Event Types supported

  • MIDI CC βœ…
  • MIDI Notes βœ…

Event Types planned πŸ—ΊοΈ

  • OSC
  • Gamepad

These event types are planned as additions to TriggerKit, in future releases. Please don't hesitate to open an issue or create a PR for features you need πŸ™

Quick start 🏁

  • Add TriggerKit to your project via Swift Package Manager: https://github.com/lightbeamapps/TriggerKit

  • Create an enumeration of the actions your app wants to map, that conforms to TKAppActionConstraints

  • Instantiate the TriggerKit Bus

let config = TKBusConfig(clientName: "TriggerKit", model: "TriggerKit", manufacturer: "Lightbeam Apps")
let bus = TKBus<YourAppAction>(config: config)
  • Add Mappings
let mapping = TKMapping(appAction: TestAcYourAppActiontion.action1, event: TKEvent.midiCC(trigger: .init(cc: 1)))

bus.addMapping(mapping) { payload in
    // Do something!
}

You now have a TriggerKit Bus, and your first mapping πŸŽ‰!

Usage and key concepts

Codable

Once you have created actions and mappings, you can encode these to persist them to disk and retrieve at run time.

Learning events

You can set a single callback for all events with the bus function:

bus.setEventCallback() { event in 
    // Use/persist the most recent event to update or add a mapping
}

The demo application shows an example of this.

Examples

  • TriggerKitDemo - a SwiftUI app that shows example mappings, and an event learn set up.

Inbuilt views for Bluetooth midi

TriggerKit has some wrappers for the CoreAudio BlueTooth MIDI detection views:

  • TKBluetoothMIDIView SwiftUI
  • TKBTMIDICentralViewController UIKit

Contributing

Code of Conduct and Contributing rules πŸ§‘β€βš–οΈ

  • Our guide to contributing is available here: CONTRIBUTING.md.
  • All contributions, pull requests, and issues are expected to adhere to our community code of conduct: CODE_OF_CONDUCT.md.

Key contributors ⚑️

Admin

License πŸ“ƒ

TriggerKit is licensed with the BSD-3-Clause license, more information here: LICENSE.MD

This is a permissive license which allows for any type of use, provided the copyright notice is included.

Acknowledgements πŸ™

Description

  • Swift Tools 5.8.0
View More Packages from this Author

Dependencies

Last updated: Fri Oct 18 2024 10:47:35 GMT-0900 (Hawaii-Aleutian Daylight Time)