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

[CoreMIDI] Updates for Xcode14 Beta 1 #15917

Merged
merged 4 commits into from
Sep 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions src/CoreMidi/MidiBluetoothDriver.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
//
// MidiBluetoothDriver.cs
//
// Authors: TJ Lambert (TJ.Lambert@microsoft.com)
//
// Copyright 2022 Microsoft Corp.
//

#nullable enable

using System;
using System.Runtime.InteropServices;

using ObjCRuntime;
using CoreFoundation;
using Foundation;

#if !NET
using NativeHandle = System.IntPtr;
#endif

namespace CoreMidi {

#if NET
[SupportedOSPlatform ("ios16.0")]
[SupportedOSPlatform ("maccatalyst16.0")]
[SupportedOSPlatform ("tvos16.0")]
[SupportedOSPlatform ("macos13.0")]
#else
[iOS (16,0), Mac (13,0), Watch (9,0), TV (16,0), MacCatalyst (16,0)]
#endif // NET
public partial class MidiBluetoothDriver {
[DllImport (Constants.CoreMidiLibrary)]
static extern int MIDIBluetoothDriverActivateAllConnections ();

public static int ActivateAllConnections () => MIDIBluetoothDriverActivateAllConnections ();

[DllImport (Constants.CoreMidiLibrary)]
static extern unsafe int MIDIBluetoothDriverDisconnect (/* CFStringRef* */ NativeHandle uuid);

public static int Disconnect (NSString uuid) => MIDIBluetoothDriverDisconnect (uuid.GetHandle ());
}
}
38 changes: 38 additions & 0 deletions src/coremidi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ public enum MidiMessageType : uint {
SysEx = 3,
ChannelVoice2 = 4,
Data128 = 5,
UnknownF = 15,
}

[Mac (11, 0), iOS (14, 0)]
Expand All @@ -97,6 +98,8 @@ public enum MidiSysExStatus : uint {
Start = 1,
Continue = 2,
End = 3,
MixedDataSetHeader = 8,
MixedDataSetPayload = 9,
}

[Mac (11, 0), iOS (14, 0)]
Expand All @@ -116,6 +119,41 @@ public enum MidiSystemStatus : uint {
SystemReset = 255,
}

[iOS (16,0), Mac (13,0), MacCatalyst (16,0)]
[NativeName ("MIDINoteAttribute")]
public enum MidiNoteAttribute : byte
{
None = 0,
ManufacturerSpecific = 1,
ProfileSpecific = 2,
Pitch = 3,
}

[iOS (16,0), Mac (13,0), MacCatalyst (16,0)]
[NativeName ("MIDIPerNoteManagementOptions")]
[Flags]
public enum MidiPerNoteManagementOptions : byte
{
Reset = 1 << 0,
Detach = 1 << 1,
}

[iOS (16,0), Mac (13,0), MacCatalyst (16,0)]
[NativeName ("MIDIProgramChangeOptions")]
[Flags]
public enum MidiProgramChangeOptions : byte
{
BankValid = 1 << 0,
}

[iOS (16,0), Mac (13,0), MacCatalyst (16,0)]
[NativeName ("MIDIUtilityStatus")]
public enum MidiUtilityStatus : uint
{
Noop = 0,
JitterReductionClock = 1,
JitterReductionTimestamp = 2,
}

[NoTV][NoWatch]
[Mac (10,15)]
Expand Down
3 changes: 3 additions & 0 deletions src/frameworks.sources
Original file line number Diff line number Diff line change
Expand Up @@ -602,6 +602,9 @@ COREMIDI_CORE_SOURCES = \
CoreMidi/MidiThruConnection.cs \
CoreMidi/MidiThruConnectionParams.cs \

COREMIDI_SOURCES = \
CoreMidi/MidiBluetoothDriver.cs \

# CoreML

COREML_SOURCES = \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,3 +74,5 @@
!missing-pinvoke! MIDIReceivedEventList is not bound
!missing-pinvoke! MIDISendEventList is not bound
!missing-pinvoke! MIDISourceCreateWithProtocol is not bound
# introduced in Xcode13.3 but low level and cannot test without device
!missing-pinvoke! MIDIEventListForEachEvent is not bound
10 changes: 0 additions & 10 deletions tests/xtro-sharpie/api-annotations-dotnet/iOS-CoreMIDI.todo

This file was deleted.

10 changes: 0 additions & 10 deletions tests/xtro-sharpie/api-annotations-dotnet/macOS-CoreMIDI.todo

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# CoreMIDI not supported for TV in Xcode14
!missing-enum! MIDICVStatus not bound
!missing-enum! MIDIMessageType not bound
!missing-enum! MIDINetworkConnectionPolicy not bound
Expand All @@ -12,6 +13,5 @@
!missing-enum! MIDITransformControlType not bound
!missing-enum! MIDITransformType not bound
!missing-enum! MIDIUtilityStatus not bound
!missing-pinvoke! MIDIEventListForEachEvent is not bound
!missing-pinvoke! MIDIBluetoothDriverActivateAllConnections is not bound
!missing-pinvoke! MIDIBluetoothDriverDisconnect is not bound
2 changes: 2 additions & 0 deletions tests/xtro-sharpie/common-CoreMIDI.ignore
Original file line number Diff line number Diff line change
Expand Up @@ -74,3 +74,5 @@
!missing-pinvoke! MIDIReceivedEventList is not bound
!missing-pinvoke! MIDISendEventList is not bound
!missing-pinvoke! MIDISourceCreateWithProtocol is not bound
# introduced in Xcode13.3 but low level and cannot test without device
!missing-pinvoke! MIDIEventListForEachEvent is not bound
10 changes: 0 additions & 10 deletions tests/xtro-sharpie/iOS-CoreMIDI.todo

This file was deleted.

10 changes: 0 additions & 10 deletions tests/xtro-sharpie/macOS-CoreMIDI.todo

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# CoreMIDI not supported for TV in Xcode14
!missing-enum! MIDICVStatus not bound
!missing-enum! MIDIMessageType not bound
!missing-enum! MIDINetworkConnectionPolicy not bound
Expand All @@ -12,6 +13,5 @@
!missing-enum! MIDITransformControlType not bound
!missing-enum! MIDITransformType not bound
!missing-enum! MIDIUtilityStatus not bound
!missing-pinvoke! MIDIEventListForEachEvent is not bound
!missing-pinvoke! MIDIBluetoothDriverActivateAllConnections is not bound
!missing-pinvoke! MIDIBluetoothDriverDisconnect is not bound
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# CoreMIDI not supported for watch in Xcode14
!missing-enum! MIDICVStatus not bound
!missing-enum! MIDIMessageType not bound
!missing-enum! MIDINetworkConnectionPolicy not bound
Expand All @@ -12,6 +13,5 @@
!missing-enum! MIDITransformControlType not bound
!missing-enum! MIDITransformType not bound
!missing-enum! MIDIUtilityStatus not bound
!missing-pinvoke! MIDIEventListForEachEvent is not bound
!missing-pinvoke! MIDIBluetoothDriverActivateAllConnections is not bound
!missing-pinvoke! MIDIBluetoothDriverDisconnect is not bound