@@ -4,6 +4,8 @@ const util = @import("util.zig");
4
4
const backends = @import ("backends.zig" );
5
5
const conv = @import ("conv.zig" );
6
6
7
+ const log = std .log .scoped (.sysaudio );
8
+
7
9
pub const Backend = backends .Backend ;
8
10
pub const Range = util .Range ;
9
11
@@ -33,18 +35,23 @@ pub const Context = struct {
33
35
pub fn init (comptime backend : ? Backend , allocator : std.mem.Allocator , options : Options ) InitError ! Context {
34
36
const data : backends.Context = blk : {
35
37
if (backend ) | b | {
36
- break : blk try @typeInfo (
38
+ const d = try @typeInfo (
37
39
std .meta .fieldInfo (backends .Context , b ).type ,
38
40
).pointer .child .init (allocator , options );
41
+ log .info ("Backend selected: {s}" , .{b .name });
42
+ break :blk d ;
39
43
} else {
40
44
inline for (std .meta .fields (Backend ), 0.. ) | b , i | {
41
45
if (@typeInfo (
42
46
std .meta .fieldInfo (backends .Context , @as (Backend , @enumFromInt (b .value ))).type ,
43
47
).pointer .child .init (allocator , options )) | d | {
48
+ log .info ("Backend selected: {s}" , .{b .name });
44
49
break :blk d ;
45
50
} else | err | {
46
- if (i == std .meta .fields (Backend ).len - 1 )
51
+ if (i == std .meta .fields (Backend ).len - 1 ) {
52
+ log .info ("Init failed of Backend: {s}" , .{b .name });
47
53
return err ;
54
+ }
48
55
}
49
56
}
50
57
unreachable ;
0 commit comments