Skip to content

Conversation

@tacshi
Copy link
Contributor

@tacshi tacshi commented Jan 3, 2026

Why is this change needed?

Fixes build failures with Xcode 16 / macOS 26.2 SDK where AVAudioPCMBuffer
captured in AVAudioConverterInputBlock closures triggers Sendable errors.

Uses nonisolated(unsafe) since the buffers are accessed synchronously
by AVAudioConverter's callback and don't cross actor boundaries.

Problem

FluidAudio v0.9.0 fails to build with macOS 26.2 SDK (Xcode 16+) due to strict Swift 6 Sendable checking. The AVAudioConverterInputBlock closure captures AVAudioPCMBuffer which isn't marked as Sendable.

Affected Files

  1. AudioConverter.swift:155-165 - buffer captured in input block
  2. StreamingAudioSourceFactory.swift:128-155 - inputBuffer captured in input block

Errors

error: capture of 'buffer' with non-Sendable type 'AVAudioPCMBuffer' in a '@Sendable' closure
error: capture of 'inputBuffer' with non-Sendable type 'AVAudioPCMBuffer' in a '@Sendable' closure

@Alex-Wengg Alex-Wengg self-requested a review January 3, 2026 18:29
@Alex-Wengg Alex-Wengg merged commit 915a392 into FluidInference:main Jan 3, 2026
9 checks passed
@tacshi tacshi deleted the fix/capture branch January 3, 2026 21:54
Alex-Wengg added a commit that referenced this pull request Jan 4, 2026
### Why is this change needed?
<!-- Explain the motivation for this change. What problem does it solve?
-->

Fixes build failures with Xcode 16 / macOS 26.2 SDK where
AVAudioPCMBuffer
captured in AVAudioConverterInputBlock closures triggers Sendable
errors.

Uses `nonisolated(unsafe)` since the buffers are accessed synchronously
by AVAudioConverter's callback and don't cross actor boundaries.

### Problem
FluidAudio v0.9.0 fails to build with macOS 26.2 SDK (Xcode 16+) due to
strict Swift 6 Sendable checking. The `AVAudioConverterInputBlock`
closure captures `AVAudioPCMBuffer` which isn't marked as Sendable.

### Affected Files
1. `AudioConverter.swift:155-165` - `buffer` captured in input block
2. `StreamingAudioSourceFactory.swift:128-155` - `inputBuffer` captured
in input block

### Errors

```
error: capture of 'buffer' with non-Sendable type 'AVAudioPCMBuffer' in a '@sendable' closure
error: capture of 'inputBuffer' with non-Sendable type 'AVAudioPCMBuffer' in a '@sendable' closure
```

Co-authored-by: Alex <36247722+Alex-Wengg@users.noreply.github.com>
Alex-Wengg added a commit that referenced this pull request Jan 5, 2026
### Why is this change needed?
<!-- Explain the motivation for this change. What problem does it solve?
-->

Fixes build failures with Xcode 16 / macOS 26.2 SDK where
AVAudioPCMBuffer
captured in AVAudioConverterInputBlock closures triggers Sendable
errors.

Uses `nonisolated(unsafe)` since the buffers are accessed synchronously
by AVAudioConverter's callback and don't cross actor boundaries.

### Problem
FluidAudio v0.9.0 fails to build with macOS 26.2 SDK (Xcode 16+) due to
strict Swift 6 Sendable checking. The `AVAudioConverterInputBlock`
closure captures `AVAudioPCMBuffer` which isn't marked as Sendable.

### Affected Files
1. `AudioConverter.swift:155-165` - `buffer` captured in input block
2. `StreamingAudioSourceFactory.swift:128-155` - `inputBuffer` captured
in input block

### Errors

```
error: capture of 'buffer' with non-Sendable type 'AVAudioPCMBuffer' in a '@sendable' closure
error: capture of 'inputBuffer' with non-Sendable type 'AVAudioPCMBuffer' in a '@sendable' closure
```

Co-authored-by: Alex <36247722+Alex-Wengg@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants