From adca4588805d748653d35532fe8b3a7bfff7ddbf Mon Sep 17 00:00:00 2001 From: Stephen Gutekanst Date: Sat, 13 Jan 2024 15:39:30 -0700 Subject: [PATCH] add CoreMidi support Signed-off-by: Stephen Gutekanst --- src/main.zig | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/main.zig b/src/main.zig index 10c81db..dd40af5 100644 --- a/src/main.zig +++ b/src/main.zig @@ -1915,12 +1915,16 @@ fn generateAVFAudio(generator: anytype) !void { try generator.addProtocol("AVAudioSessionDelegate"); } +fn generateCoreMIDI(generator: anytype) !void { + try generator.addProtocol("MIDIInputPortCreateWithProtocol"); +} + fn usage() void { std.log.warn( \\mach-objc-generator [options] \\ \\Options: - \\ --framework Metal,AVFAudio which code to generate + \\ --framework Metal,AVFAudio,CoreMIDI which code to generate \\ --help \\ , .{}); @@ -1929,6 +1933,7 @@ fn usage() void { const Framework = enum { metal, avf_audio, + core_midi, }; pub fn main() anyerror!void { @@ -1952,6 +1957,7 @@ pub fn main() anyerror!void { framework = blk: { if (std.mem.eql(u8, args[i], "Metal")) break :blk .metal; if (std.mem.eql(u8, args[i], "AVFAudio")) break :blk .avf_audio; + if (std.mem.eql(u8, args[i], "CoreMIDI")) break :blk .core_midi; usage(); std.os.exit(1); }; @@ -1982,6 +1988,7 @@ pub fn main() anyerror!void { switch (framework) { .metal => try generateMetal(&generator), .avf_audio => try generateAVFAudio(&generator), + .core_midi => try generateCoreMIDI(&generator), } try generator.generate(); }