Skip to content

Commit

Permalink
add CoreMidi support
Browse files Browse the repository at this point in the history
Signed-off-by: Stephen Gutekanst <[email protected]>
  • Loading branch information
slimsag committed Jan 13, 2024
1 parent 83ed74d commit adca458
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/main.zig
Original file line number Diff line number Diff line change
Expand Up @@ -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
\\
, .{});
Expand All @@ -1929,6 +1933,7 @@ fn usage() void {
const Framework = enum {
metal,
avf_audio,
core_midi,
};

pub fn main() anyerror!void {
Expand All @@ -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);
};
Expand Down Expand Up @@ -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();
}
Expand Down

0 comments on commit adca458

Please sign in to comment.