@@ -3,7 +3,6 @@ const ClapExtExample = @This();
33const std = @import ("std" );
44
55const zigplug = @import ("zigplug" );
6- const clap = @import ("zigplug_clap" );
76
87pub const meta : zigplug.Meta = .{
98 .name = "zigplug clap extension example" ,
@@ -26,52 +25,6 @@ pub const meta: zigplug.Meta = .{
2625 },
2726};
2827
29- fn getExtension (id : [:0 ]const u8 ) ? * const anyopaque {
30- // let's implement the "note-name" extension, which is not supported in zigplug (yet?).
31- // we can test this in reaper for example
32- //
33- // https://github.com/free-audio/clap/blob/main/include/clap/ext/note-name.h
34- if (std .mem .eql (u8 , id , & clap .c .CLAP_EXT_NOTE_NAME )) {
35- const ext = struct {
36- pub fn count (_ : [* c ]const clap.c.clap_plugin_t ) callconv (.c ) u32 {
37- return 1 ;
38- }
39-
40- pub fn get (clap_plugin : [* c ]const clap.c.clap_plugin_t , index : u32 , note_name : [* c ]clap.c.clap_note_name_t ) callconv (.c ) bool {
41- // you can use this to access your plugin's state
42- const self = clap .pluginFromClap (clap_plugin , ClapExtExample );
43- _ = self ;
44-
45- if (index == 0 ) {
46- // let's set the name of every note to some string
47- note_name .* = .{
48- // zig initializes c structs with `std.mem.zeroes` so we don't have to deal with an undefined
49- // name value
50- .port = -1 ,
51- .key = -1 ,
52- .channel = -1 ,
53- };
54- std .mem .copyForwards (u8 , & note_name .* .name , "Hello world... i mean note" );
55- return true ;
56- }
57- return false ;
58- }
59- };
60- return & clap.c.clap_plugin_note_name_t {
61- .count = ext .count ,
62- .get = ext .get ,
63- };
64- }
65- return null ;
66- }
67-
68- pub const clap_meta : clap.Meta = .{
69- .id = "com.bandithedoge.zigplug_clap_ext_example" ,
70- .features = &.{ .instrument , .synthesizer , .mono },
71- .extra_features = &.{"custom-namespace:custom-feature" },
72- .getExtension = getExtension ,
73- };
74-
7528gpa : std .heap .GeneralPurposeAllocator (.{}) = .init ,
7629
7730phase : f32 = 0 ,
0 commit comments