Cached API tables and cut allocations in the PlayDate bindings target.

This commit is contained in:
2026-07-25 10:43:32 +02:00
parent 6594794cec
commit dfeadabfb6
20 changed files with 272 additions and 89 deletions
+2 -2
View File
@@ -7,7 +7,7 @@
internal import CPlaydate
var snd: UnsafePointer<playdate_sound> { Playdate.soundAPI }
var snd: UnsafePointer<playdate_sound> { Playdate.soundAPI.unsafelyUnwrapped }
/// The sound API: channels, players, synths, sequences, and effects.
public enum Sound {}
@@ -176,7 +176,7 @@ extension Sound {
/// A mixer channel holding sources and effects. Wraps `SoundChannel`.
public final class Channel {
private static var api: UnsafePointer<playdate_sound_channel> { snd.pointee.channel.unsafelyUnwrapped }
private static var api: UnsafePointer<playdate_sound_channel> { Playdate.channelAPI.unsafelyUnwrapped }
let pointer: OpaquePointer
let isOwned: Bool