diff options
Diffstat (limited to 'src/al.zig')
-rw-r--r-- | src/al.zig | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/src/al.zig b/src/al.zig index b15f2a1..e806e90 100644 --- a/src/al.zig +++ b/src/al.zig @@ -16,14 +16,25 @@ // You should have received a copy of the GNU Lesser General Public License // along with zeal. If not, see <https://www.gnu.org/licenses/>. -usingnamespace @cImport({ @cInclude("AL/al.h"); }); +const Child = @import("std").meta.Child; + +usingnamespace @cImport(@cInclude("AL/al.h")); pub const POSITION = AL_POSITION; pub const ORIENTATION = AL_ORIENTATION; pub const listener = struct { - pub const setFloat = alListenerf; - pub const setFloatVector = alListenerfv; + pub fn set(comptime T: type, param: ALenum, value: T) void { + switch (T) { + f32 => alListenerf(param, value), + i32 => alListeneri(param, value), + else => switch (Child(T)) { + f32 => alListenerfv(param, value[0..]), + i32 => alListeneriv(param, value[0..]), + else => unreachable, + } + } + } }; // alBufferData |