diff options
Diffstat (limited to 'src/abi.zig')
| -rw-r--r-- | src/abi.zig | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/abi.zig b/src/abi.zig index f0abdb3..3c47e69 100644 --- a/src/abi.zig +++ b/src/abi.zig @@ -632,6 +632,8 @@ pub const Host = struct { /// WAV, FLAC or Ogg Vorbis bytes in memory. Not cached. `.none` if /// they do not decode. decodeSound: *const fn (*anyopaque, []const u8) Audio, + /// Samples a sketch made, copied: see `Host.newSound`. + newSound: *const fn (*anyopaque, [*]const f32, usize) callconv(.c) Audio, /// A loaded sound's samples: mono, at `Input.sample_rate`, alive as /// long as the host. Empty for `.none`. samples: *const fn (*anyopaque, Audio) []const f32, @@ -696,6 +698,14 @@ pub const Host = struct { pub fn decodeSound(h: Host, wav: []const u8) Audio { return h.vtable.decodeSound(h.ctx, wav); } + /// Mono samples at `Input.sample_rate`, copied into the host: a sound + /// for `Voice.audio` like a loaded one (synthesised one-shots become + /// voices, reconciled and replay-safe). Kept for the life of the host, + /// like every sound: make each once (in `setup`, or cached in Session). + /// `.none` if a sample is not finite. + pub fn newSound(h: Host, sound: []const f32) Audio { + return h.vtable.newSound(h.ctx, sound.ptr, sound.len); + } pub fn samples(h: Host, audio: Audio) []const f32 { return h.vtable.samples(h.ctx, audio); } |
