From c49c7221ecf85c7611957fafa841ea829c9ac343 Mon Sep 17 00:00:00 2001 From: Krzysztof Piaskowy Date: Wed, 9 Sep 2026 22:33:16 +0200 Subject: [PATCH] fix(ios): stop rendering audio a preset with its own sound never plays `parse()` rendered a synthesized waveform through AudioSimulator for every pattern, but `play()` only uses that buffer when the preset has no sound of its own. For a preset carrying real audio the render was pure waste, and it ran on the main thread: 1.81 s for a five-second preset in a debug build, which froze the UI on first play and on every seek. --- iOS/Pulsar/Sources/Pulsar/Composers/PatternComposer.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iOS/Pulsar/Sources/Pulsar/Composers/PatternComposer.swift b/iOS/Pulsar/Sources/Pulsar/Composers/PatternComposer.swift index 825f2804..45e884a6 100644 --- a/iOS/Pulsar/Sources/Pulsar/Composers/PatternComposer.swift +++ b/iOS/Pulsar/Sources/Pulsar/Composers/PatternComposer.swift @@ -106,7 +106,7 @@ public class PatternComposer: NSObject { print("Error playing pattern: \(error.localizedDescription)") } - audioBuffer = audioSimulator.parsePattern(from: hapticsData) + audioBuffer = hasSound ? nil : audioSimulator.parsePattern(from: hapticsData) } public func playPattern(hapticsData: PatternData) {