Skip to content

Commit

Permalink
Merge pull request #42 from orchetect/dev
Browse files Browse the repository at this point in the history
Fixed access levels
  • Loading branch information
orchetect authored Sep 30, 2021
2 parents c4bade0 + 2f2f93c commit 025f885
Show file tree
Hide file tree
Showing 9 changed files with 207 additions and 178 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -126,12 +126,10 @@ extension _MIDIIOSendsMIDIMessagesProtocol {

}

extension MIDIIOSendsMIDIMessagesProtocol {
extension _MIDIIOSendsMIDIMessagesProtocol {

@inline(__always)
public func send(event: MIDI.Event) throws
where Self : _MIDIIOSendsMIDIMessagesProtocol
{
public func send(event: MIDI.Event) throws {

switch api {
case .legacyCoreMIDI:
Expand All @@ -145,14 +143,13 @@ extension MIDIIOSendsMIDIMessagesProtocol {
}

try send(rawWords: event.umpRawWords(protocol: self.midiProtocol))

}

}

@inline(__always)
public func send(events: [MIDI.Event]) throws
where Self : _MIDIIOSendsMIDIMessagesProtocol
{
public func send(events: [MIDI.Event]) throws {

switch api {
case .legacyCoreMIDI:
Expand All @@ -168,6 +165,7 @@ extension MIDIIOSendsMIDIMessagesProtocol {
for event in events {
try send(rawWords: event.umpRawWords(protocol: self.midiProtocol))
}

}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,10 @@ extension MIDI.IO {

}

extension MIDIIOObjectProtocol {
extension _MIDIIOObjectProtocol {

/// Return as `AnyMIDIIOObject`, a type-erased representation of a MIDIKit object conforming to `MIDIIOObjectProtocol`.
public func asAnyMIDIIOObject() -> MIDI.IO.AnyMIDIIOObject
where Self : _MIDIIOObjectProtocol
{
public func asAnyMIDIIOObject() -> MIDI.IO.AnyMIDIIOObject {

.init(self)

Expand Down
10 changes: 6 additions & 4 deletions Sources/MIDIKit/IO/Objects/Endpoint/MIDIIOEndpointProtocol.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,21 @@

public protocol MIDIIOEndpointProtocol: MIDIIOObjectProtocol {

// implemented in extension _MIDIIOEndpointProtocol

func getEntity() -> MIDI.IO.Entity?

}

internal protocol _MIDIIOEndpointProtocol: MIDIIOEndpointProtocol, _MIDIIOObjectProtocol {

}

extension MIDIIOEndpointProtocol {
extension _MIDIIOEndpointProtocol {

public var objectType: MIDI.IO.ObjectType { .endpoint }

internal func getEntity() -> MIDI.IO.Entity?
where Self : _MIDIIOEndpointProtocol
{
public func getEntity() -> MIDI.IO.Entity? {

try? MIDI.IO.getSystemEntity(for: self.coreMIDIObjectRef)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,9 @@

// (conforming types to MIDIIOObjectProtocol just need to conform to Equatable and this implementation will be used)

extension MIDIIOObjectProtocol {
extension _MIDIIOObjectProtocol {

static public func == (lhs: Self, rhs: Self) -> Bool
where Self : _MIDIIOObjectProtocol
{
static public func == (lhs: Self, rhs: Self) -> Bool {

lhs.coreMIDIObjectRef == rhs.coreMIDIObjectRef

Expand All @@ -23,12 +21,9 @@ extension MIDIIOObjectProtocol {

// (conforming types to MIDIIOObjectProtocol just need to conform to Hashable and this implementation will be used)

extension MIDIIOObjectProtocol {
extension _MIDIIOObjectProtocol {

/// Hash
public func hash(into hasher: inout Hasher)
where Self : _MIDIIOObjectProtocol
{
public func hash(into hasher: inout Hasher) {

hasher.combine(self.coreMIDIObjectRef)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,13 @@

import Foundation

extension MIDIIOObjectProtocol {
extension _MIDIIOObjectProtocol {

/// Get all properties as a key/value pair array, formatted as human-readable strings.
/// Useful for displaying in a user interface or outputting to console for debugging.
public func getPropertiesAsStrings(
onlyIncludeRelevant: Bool = true
) -> [(key: String, value: String)]
where Self : _MIDIIOObjectProtocol
{
) -> [(key: String, value: String)] {

(
onlyIncludeRelevant
Expand All @@ -28,14 +26,12 @@ extension MIDIIOObjectProtocol {

}

extension MIDIIOObjectProtocol {
extension _MIDIIOObjectProtocol {

/// Returns a human-readable key and value pair for the property.
internal func getPropertyKeyValuePairAsStrings(
of property: MIDI.IO.kMIDIProperty
) -> (key: String, value: String)
where Self : _MIDIIOObjectProtocol
{
) -> (key: String, value: String) {

switch property {

Expand Down
Loading

0 comments on commit 025f885

Please sign in to comment.