summary refs log tree commit diff
path: root/examples/hrtf.zig
diff options
context:
space:
mode:
Diffstat (limited to 'examples/hrtf.zig')
-rw-r--r--examples/hrtf.zig15
1 files changed, 7 insertions, 8 deletions
diff --git a/examples/hrtf.zig b/examples/hrtf.zig
index 2db3d78..76e1257 100644
--- a/examples/hrtf.zig
+++ b/examples/hrtf.zig
@@ -1,5 +1,5 @@
 // Positional audio example with HRTF
-// Copyright (C) 2021  Nguyễn Gia Phong
+// Copyright (C) 2021, 2023  Nguyễn Gia Phong
 //
 // This file is part of zeal.
 //
@@ -18,7 +18,7 @@
 
 const std = @import("std");
 const allocator = std.heap.c_allocator;
-const args = std.process.args;
+const args = std.process.argsWithAllocator;
 const print = std.debug.print;
 const sleep = std.time.sleep;
 
@@ -35,18 +35,17 @@ pub fn main() !void {
     const device = try Device.init(null);
     defer device.deinit() catch unreachable;
 
-    const context = try Context.init(device, &.{ alc.HRTF, alc.TRUE });
+    const context = try Context.init(device, &.{ alc.HRTF, alc.TRUE, 0 });
     if (try device.enabledHrtf())
         print("HRTF enabled!\n", .{})
     else
         print("HRTF not enabled!\n", .{});
     defer context.deinit() catch unreachable;
 
-    var argv = args();
-    allocator.free(try argv.next(allocator).?);
-    const path = try argv.next(allocator).?;
-    defer allocator.free(path);
-    const audio = try Audio.read(allocator, path);
+    var argv = try args(allocator);
+    defer argv.deinit();
+    _ = argv.next().?;
+    const audio = try Audio.read(allocator, argv.next().?);
     defer audio.free();
 
     try context.makeCurrent();