summaryrefslogtreecommitdiff
path: root/src/sketch
diff options
context:
space:
mode:
Diffstat (limited to 'src/sketch')
-rw-r--r--src/sketch/root.zig4
-rw-r--r--src/sketch/web.zig4
2 files changed, 6 insertions, 2 deletions
diff --git a/src/sketch/root.zig b/src/sketch/root.zig
index 1270b5d..d15046d 100644
--- a/src/sketch/root.zig
+++ b/src/sketch/root.zig
@@ -212,6 +212,10 @@ pub const Frame = struct {
pub fn voice(f: *Frame, v: Voice) void {
f.emit(.{ .voice = v });
}
+ /// Scales every voice of `group` this frame (1 when not declared).
+ pub fn gain(f: *Frame, group: u3, value: f32) void {
+ f.emit(.{ .gain = .{ .group = group, .gain = value } });
+ }
pub fn audio(f: *Frame, key: u32, samples: []const f32, options: struct { clear: bool = false }) void {
f.emit(.{ .audio = .{ .key = key, .samples = samples, .clear = options.clear } });
}
diff --git a/src/sketch/web.zig b/src/sketch/web.zig
index 817862c..62a173a 100644
--- a/src/sketch/web.zig
+++ b/src/sketch/web.zig
@@ -241,9 +241,9 @@ fn Driver(comptime App: type) type {
},
.download => |v| js.download(@backingInt(v.buffer), v.offset, v.size, v.key),
.open_file => |v| js.openFile(v.command.ptr, v.command.len, v.pattern.ptr, v.pattern.len),
- // Synthesised voices are not on the web yet; quitting a page
+ // Voices (and so their groups) are not on the web yet; quitting a page
// means nothing; `run` lines go after the frame.
- .voice, .quit, .run, .backdrop => {},
+ .voice, .gain, .quit, .run, .backdrop => {},
}
}