summaryrefslogtreecommitdiff
path: root/src/abi.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/abi.zig')
-rw-r--r--src/abi.zig8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/abi.zig b/src/abi.zig
index 3c47e69..35c399b 100644
--- a/src/abi.zig
+++ b/src/abi.zig
@@ -303,6 +303,11 @@ pub const Voice = struct {
volume: f32 = 1,
/// Linear fade at both ends, in samples.
fade: u32 = 0,
+ /// Playback speed, as pitch: 2 is an octave up and half as long, 0
+ /// holds it. Changing it does not restart the voice.
+ rate: f32 = 1,
+ /// Whose gain (`Command.gain`) also scales it: music, speech, effects.
+ group: u3 = 0,
};
/// Slices must stay alive until the host consumes the frame, right after
@@ -372,6 +377,9 @@ pub const Command = union(enum) {
voice: Voice,
/// Mono samples at `Input.sample_rate` for stream `key`.
audio: struct { key: u32, samples: []const f32, clear: bool = false },
+ /// The gain of a group of voices (`Voice.group`) this frame; a group
+ /// not given one plays at 1. Declared like a voice, so it replays.
+ gain: struct { group: u3, gain: f32 },
/// RGBA8 rows of `w * 4` bytes into an image made by `Host.newImage`.
pixels: struct { image: Image, w: u32, h: u32, rgba: []const u8, premultiplied: bool = false },
/// Renders a GPU pass into an image made by `Host.newImage`, when