summaryrefslogtreecommitdiff
path: root/src/host/Host.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/host/Host.zig')
-rw-r--r--src/host/Host.zig4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/host/Host.zig b/src/host/Host.zig
index 1a75b2a..000488b 100644
--- a/src/host/Host.zig
+++ b/src/host/Host.zig
@@ -1010,6 +1010,7 @@ const api: abi.Host.VTable = .{
.textSize = apiTextSize,
.loadSound = apiLoadSound,
.decodeSound = apiDecodeSound,
+ .newSound = apiNewSound,
.samples = apiSamples,
.readFile = apiReadFile,
.env = apiEnv,
@@ -1076,6 +1077,9 @@ fn apiLoadSound(ctx: *anyopaque, path: []const u8) abi.Audio {
fn apiDecodeSound(ctx: *anyopaque, wav: []const u8) abi.Audio {
return hostOf(ctx).audio.decode(wav);
}
+fn apiNewSound(ctx: *anyopaque, samples: [*]const f32, len: usize) callconv(.c) abi.Audio {
+ return hostOf(ctx).audio.new(samples[0..len]);
+}
fn apiReadFile(ctx: *anyopaque, path: []const u8) []const u8 {
const self = hostOf(ctx);
if (self.files.get(path)) |bytes| return bytes;