tiny.sys.CoreaudioPlaybackStorage
Defined in coreaudio.
API (12)
Actions
Public operations.
Types and contracts
Public types and contracts.
Fields and members
Public fields and members.
Source
Source: lib/sys/src/coreaudio.zig:110
zig
pub const Storage = struct { phase: alloc_phase.capacity.Phase, capacity: CoreAudioCapacity, state: *State, pub const Limits: type = StorageLimits; pub const Capacity: type = CoreAudioCapacity; pub const Exhaustion = error{BufferLimitExceeded}; pub const InitError = std.mem.Allocator.Error || CapacityError; pub const claim: alloc_phase.capacity.Declaration = .{ .source = .{ .id = "sys.coreaudio_playback_storage", .kind = .phase_static, .limit_source = .caller, .storage = .{ .covered = &.{ .{ .id = "one_stable_coreaudio_callback_state", .lifetime = .steady, .detail = "one stable CoreAudio callback state", }, }, .excluded = &.{ "caller-owned interleaved PCM frames", "AudioQueue objects and framework-allocated playback buffers", "CoreAudio device, converter, and callback thread storage", }, }, .capacity = .{ .inputs = &.{}, .type_selectors = &.{ alloc_phase.capacity.bindType(State, "state"), }, .nodes = &.{ .{ .constant = 1 }, .{ .scale = .{ .node = 0, .coefficient = .{ .size_of_concrete_type = 0 } } }, }, .assertions = &.{.{ .scope = .closure_total, .measure = .retained, .relation = .exact, .expression = 1, }}, }, .overload = .{ .kind = .reject_before_mutation, .detail = "oversize playback payloads reject before a free queue buffer is acquired", }, .risks = .{ .transitive = .{ .status = .open, .detail = "playback synchronization enters the host thread implementation", }, .foreign = .{ .status = .open, .detail = "AudioQueue owns three bounded buffers and internal device state", }, }, .obligations = &.{ .{ .key = "sys_coreaudio_playback_capacity_capacity_model", .role = .capacity_model }, .{ .key = "sys_coreaudio_playback_capacity_overload", .role = .overload }, .{ .key = "sys_coreaudio_playback_oom_retry", .role = .custom }, }, }, .bindings = .{ .owner = @This(), .seal = .{ .family = alloc_phase.capacity.selector(@This().activate), .premise = .{ .class = .checked_semantic_fact, .authority = .checker, }, }, .teardown = .{ .family = alloc_phase.capacity.selector(@This().deinit), .premise = .{ .class = .checked_semantic_fact, .authority = .checker, }, }, }, }; pub fn init(allocator: std.mem.Allocator, limits: StorageLimits) InitError!Storage { const capacity = try CoreAudioCapacity.derive(limits); const state = try allocator.create(State); state.* = .{}; return .{ .phase = .initialization, .capacity = capacity, .state = state, }; } pub fn activate(self: *Storage) void { std.debug.assert(self.phase == .initialization); self.phase = .steady; } pub fn validatePayload(self: *Storage, byte_count: usize) Exhaustion!void { std.debug.assert(self.phase == .steady); if (byte_count > self.capacity.buffer_bytes) return error.BufferLimitExceeded; } pub fn deinit(self: *Storage, allocator: std.mem.Allocator) void { std.debug.assert(self.phase != .teardown); self.phase = .teardown; allocator.destroy(self.state); self.state = undefined; }};Source: lib/sys/src/root.zig:61
zig
pub const CoreaudioPlaybackStorage = @import("coreaudio.zig").Storage;Audit
| Definitions | 10 |
|---|---|
| Public names | 20 |
| Members | 4 |
| Version | 26.7.0 |
| Revision | daab053ee433 |