-
-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
120 additions
and
96 deletions.
There are no files selected for viewing
70 changes: 0 additions & 70 deletions
70
Sources/MIDIKit/IO/Core MIDI/MIDIEventList/MIDIEventList MKUnsafeSequence.swift
This file was deleted.
Oops, something went wrong.
26 changes: 26 additions & 0 deletions
26
Sources/MIDIKit/IO/Core MIDI/MIDIEventList/MIDIEventList PacketPointers.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// | ||
// MIDIEventList PacketPointers.swift | ||
// MIDIKit • https://github.com/orchetect/MIDIKit | ||
// | ||
|
||
import Foundation | ||
import CoreMIDI | ||
|
||
@available(macOS 11, iOS 14, macCatalyst 14, tvOS 14, watchOS 7, *) | ||
extension UnsafePointer where Pointee == MIDIEventList { | ||
|
||
@inline(__always) | ||
func packetsPointers() -> [UnsafePointer<MIDIEventPacket>] { | ||
|
||
Array(unsafeSequence()) | ||
|
||
} | ||
|
||
@inline(__always) | ||
func packets() -> [MIDI.Packet.UniversalPacketData] { | ||
|
||
unsafeSequence().map { MIDI.Packet.UniversalPacketData($0) } | ||
|
||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
Sources/MIDIKit/IO/Core MIDI/MIDIPacketLIst/MIDIPacketList PacketPointers.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// | ||
// MIDIPacketList PacketPointers.swift | ||
// MIDIKit • https://github.com/orchetect/MIDIKit | ||
// | ||
|
||
import Foundation | ||
import CoreMIDI | ||
|
||
extension UnsafePointer where Pointee == MIDIPacketList { | ||
|
||
func packetsPointers() -> [UnsafePointer<MIDIPacket>] { | ||
|
||
// prefer newer Core MIDI API if platform supports it | ||
|
||
if #available(macOS 10.15, iOS 13.0, macCatalyst 13.0, *) { | ||
return Array(unsafeSequence()) | ||
} else { | ||
return mkUnsafeSequence().pointers | ||
} | ||
|
||
} | ||
|
||
func packets() -> [MIDI.Packet.PacketData] { | ||
|
||
packetsPointers().map { MIDI.Packet.PacketData($0) } | ||
|
||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters