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

Enable build on tvOS & watchOS #124

Closed
3 tasks done
orchetect opened this issue Jul 1, 2022 · 1 comment
Closed
3 tasks done

Enable build on tvOS & watchOS #124

orchetect opened this issue Jul 1, 2022 · 1 comment
Labels
🎩 refinement An enhancement to an existing feature

Comments

@orchetect
Copy link
Owner

orchetect commented Jul 1, 2022

Actionable Items

  • Enable build on tvOS
  • Enable build on watchOS
  • Add tvOS & watchOS builds to GitHub CI

Proposal

Although most of Core MIDI is unavailable on tvOS and watchOS, it would be ideal to allow MIDIKit to build on those platforms by conditionally fencing out incompatible code or marking them as not @available.

Even though the majority of functionality will be unavailable, the benefit to this would be allowing cross-platform applications or packages whose targets include tvOS and/or watchOS to use MIDIKit as a dependency. This also allows compatibility of MIDIKit extensions like MIDIKitSMF (Standard MIDI File) to function on those platforms where the unavailable Core MIDI I/O methods are not needed.

Essentially what would be left remaining and usable would be:

  • Global proprietary types (MIDI.UInt7, etc.)
  • MIDI.Event abstracts, including filters
  • MIDI.Note abstract
  • MIDI.IO.APIVersion and MIDI.IO.ProtocolVersion
  • MIDI.IO.Packet and its nested types

Implementation

It may make sense to simply remove most of the I/O module by conditional compilation. The downside is the lack of symbolication, but in theory that shouldn't be a problem.

#if !os(tvOS) && !os(watchOS)
// ...
#endif

Otherwise, individual objects, methods and properties could be marked @available. The downside would be added clutter to the MIDIKit codebase.

This may also not even be possible because some of the Core MIDI symbolication/headers are completely missing on tvOS/watchOS.

@available(macOS 10.12, iOS 10.0, tvOS 9999, watchOS 9999, *)
func abc() { }
@orchetect orchetect added the 🎩 refinement An enhancement to an existing feature label Jul 1, 2022
@orchetect
Copy link
Owner Author

orchetect commented Jul 1, 2022

Kind of baffling that packets/event list API is available on tvOS/watchOS but no I/O API whatsoever. What is the point of this? Google turns up nothing useful. I would assume that something like Bluetooth MIDI could have a market on the Apple TV but it doesn't look currently possible.

API available to tvOS 15.0 and watchOS 8.0:

New API

  • MIDIEventPacket
  • MIDIEventList
  • MIDIEventListInit
  • MIDIEventListAdd
  • MIDIEventPacketNext
  • MIDIProtocolID
  • MIDIObjectRef / MIDIClientRef / MIDIPortRef / MIDIDeviceRef / MIDIEntityRef / MIDIEndpointRef
  • MIDITimeStamp
  • MIDINotification / MIDIObjectAddRemoveNotification / MIDIObjectPropertyChangeNotification / MIDIIOErrorNotification

Legacy

  • MIDIPacket
  • MIDIPacketList
  • MIDIPacketNext

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🎩 refinement An enhancement to an existing feature
Projects
None yet
Development

No branches or pull requests

1 participant