summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--.build.yml2
-rw-r--r--src/alc.zig4
-rw-r--r--src/main.zig6
3 files changed, 7 insertions, 5 deletions
diff --git a/.build.yml b/.build.yml
index 11b6b8a..5b1d52e 100644
--- a/.build.yml
+++ b/.build.yml
@@ -1,10 +1,12 @@
 image: archlinux
 packages:
   - openal
+  - pulseaudio
   - zig
 sources:
   - https://git.sr.ht/~cnx/zeal
 tasks:
   - build: |
       cd zeal
+      pulseaudio -D
       zig build test
diff --git a/src/alc.zig b/src/alc.zig
index 3a6d9a8..68e12b3 100644
--- a/src/alc.zig
+++ b/src/alc.zig
@@ -73,8 +73,8 @@ pub fn getContextsDevice(context: *Context) !*Device {
 }
 
 /// Open the named playback device.
-pub fn openDevice(devicename: [*c]const u8) !*Device {
-    if (alcOpenDevice(devicename)) |device|
+pub fn openDevice(device_name: [*c]const u8) !*Device {
+    if (alcOpenDevice(device_name)) |device|
         return device;
     return switch (alcGetError(null)) {
         ALC_INVALID_VALUE => Error.InvalidValue,
diff --git a/src/main.zig b/src/main.zig
index 159ab24..add48ae 100644
--- a/src/main.zig
+++ b/src/main.zig
@@ -18,8 +18,8 @@
 
 const alc = @import("alc.zig");
 
-pub fn init() !void {
-    const device = try alc.openDevice(null);
+pub fn init(device_name: [*c]const u8) !void {
+    const device = try alc.openDevice(device_name);
     const context = try alc.createContext(device, null);
     try alc.makeContextCurrent(context);
 }
@@ -33,6 +33,6 @@ pub fn deinit() !void {
 }
 
 test {
-    try init();
+    try init(null);
     try deinit();
 }