From 0fbc9281a14ba1a45b5259ecc230bf80c294c760 Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Mon, 19 Oct 2026 12:14:48 +0200 Subject: [PATCH 1/2] [AudioToolbox] Bind music device selectors Expose the music device selector constants as MusicDeviceSelector, including the range marker and MIDI event-list selector. Match the values in MusicDevice.h and document each member without introducing unrelated music device APIs. Add parameterized regression coverage for all eight selector values. Fixes #12490. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 834f092e-f43a-4f1e-b980-12734e1d1f0a --- src/AudioToolbox/Enums.cs | 21 ++++++++++++++++ .../AudioToolbox/MusicDeviceSelectorTest.cs | 25 +++++++++++++++++++ 2 files changed, 46 insertions(+) create mode 100644 tests/monotouch-test/AudioToolbox/MusicDeviceSelectorTest.cs diff --git a/src/AudioToolbox/Enums.cs b/src/AudioToolbox/Enums.cs index 168701bf83d1..056ed174a8b1 100644 --- a/src/AudioToolbox/Enums.cs +++ b/src/AudioToolbox/Enums.cs @@ -2,6 +2,27 @@ #nullable enable namespace AudioToolbox { + /// Identifies music device audio unit selectors. + [MacCatalyst (13, 1)] + public enum MusicDeviceSelector : uint { + /// The start of the selector range reserved for music devices. + Range = 0x0100, + /// Sends a MIDI channel message to a music device. + MidiEvent = 0x0101, + /// Sends a MIDI system-exclusive message to a music device. + SysEx = 0x0102, + /// Prepares an instrument for playback. + PrepareInstrument = 0x0103, + /// Releases an instrument's resources. + ReleaseInstrument = 0x0104, + /// Starts a note and returns its instance identifier. + StartNote = 0x0105, + /// Stops a note using its instance identifier. + StopNote = 0x0106, + /// Sends a MIDI event list to a music device. + MidiEventList = 0x0107, + } + [MacCatalyst (13, 1)] [Flags] public enum AudioSettingsFlags : uint { diff --git a/tests/monotouch-test/AudioToolbox/MusicDeviceSelectorTest.cs b/tests/monotouch-test/AudioToolbox/MusicDeviceSelectorTest.cs new file mode 100644 index 000000000000..1235127f4463 --- /dev/null +++ b/tests/monotouch-test/AudioToolbox/MusicDeviceSelectorTest.cs @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +#nullable enable + +using AudioToolbox; + +namespace MonoTouchFixtures.AudioToolbox { + [TestFixture] + [Preserve (AllMembers = true)] + public class MusicDeviceSelectorTest { + [TestCase (MusicDeviceSelector.Range, 0x0100u)] + [TestCase (MusicDeviceSelector.MidiEvent, 0x0101u)] + [TestCase (MusicDeviceSelector.SysEx, 0x0102u)] + [TestCase (MusicDeviceSelector.PrepareInstrument, 0x0103u)] + [TestCase (MusicDeviceSelector.ReleaseInstrument, 0x0104u)] + [TestCase (MusicDeviceSelector.StartNote, 0x0105u)] + [TestCase (MusicDeviceSelector.StopNote, 0x0106u)] + [TestCase (MusicDeviceSelector.MidiEventList, 0x0107u)] + public void NativeValue (MusicDeviceSelector selector, uint expected) + { + Assert.That ((uint) selector, Is.EqualTo (expected), selector.ToString ()); + } + } +} From 5397507e8dc993afdc8fe5c9c9009a4ab2f84a73 Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Mon, 26 Oct 2026 20:47:02 +0100 Subject: [PATCH 2/2] [AudioToolbox] Remove enum-only selector tests Remove MusicDeviceSelectorTest as requested: enum constants do not need dedicated tests. Keep the documented selector binding unchanged. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 834f092e-f43a-4f1e-b980-12734e1d1f0a --- .../AudioToolbox/MusicDeviceSelectorTest.cs | 25 ------------------- 1 file changed, 25 deletions(-) delete mode 100644 tests/monotouch-test/AudioToolbox/MusicDeviceSelectorTest.cs diff --git a/tests/monotouch-test/AudioToolbox/MusicDeviceSelectorTest.cs b/tests/monotouch-test/AudioToolbox/MusicDeviceSelectorTest.cs deleted file mode 100644 index 1235127f4463..000000000000 --- a/tests/monotouch-test/AudioToolbox/MusicDeviceSelectorTest.cs +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -#nullable enable - -using AudioToolbox; - -namespace MonoTouchFixtures.AudioToolbox { - [TestFixture] - [Preserve (AllMembers = true)] - public class MusicDeviceSelectorTest { - [TestCase (MusicDeviceSelector.Range, 0x0100u)] - [TestCase (MusicDeviceSelector.MidiEvent, 0x0101u)] - [TestCase (MusicDeviceSelector.SysEx, 0x0102u)] - [TestCase (MusicDeviceSelector.PrepareInstrument, 0x0103u)] - [TestCase (MusicDeviceSelector.ReleaseInstrument, 0x0104u)] - [TestCase (MusicDeviceSelector.StartNote, 0x0105u)] - [TestCase (MusicDeviceSelector.StopNote, 0x0106u)] - [TestCase (MusicDeviceSelector.MidiEventList, 0x0107u)] - public void NativeValue (MusicDeviceSelector selector, uint expected) - { - Assert.That ((uint) selector, Is.EqualTo (expected), selector.ToString ()); - } - } -}