Files
voice-cat/clients/apple/Package.swift
Talon 50416c33a2 feat(clients): event sound effects + optional text-to-speech
Add audible cues and optional spoken announcements for session events
(join/leave, channel + PM sent/recv, login, logout/connection-lost,
mic on/off, voice-activity, PTT) across all three clients, driven off
the shared C ABI vc_event stream so the mapping stays consistent.

TTS is off by default; when enabled it announces events and reads
message/PM bodies aloud. Master toggles + a sound-volume slider; the
per-utterance voice-activity and PTT cues default off. WAVs ship from
assets/sounds/.

Windows (built + verified): new VoiceCat.App/Notifications/ layer
(FeedbackSettings -> %AppData%\VoiceCat\feedback.json, SoundPlayerPool
via System.Media.SoundPlayer, SpeechAnnouncer via Prismatoid 0.3.0,
EventFeedback dispatcher); MainForm hooks; NotificationSettingsForm
under Settings > Notifications; csproj adds the Prismatoid PackageRef
and copies the WAVs into sounds\.

macOS + iOS (written, not yet built -- needs a Mac): shared
VoiceCatCore/Feedback/ (SoundEvent, EventFeedback = AVAudioPlayer pool
+ native AVSpeechSynthesizer, FeedbackSettings over UserDefaults); WAVs
bundled via Package.swift resources (.process). Hooks in SessionState/
AppState (iOS) and MainWindowController (macOS); settings UI in
SettingsView (iOS) and SettingsWindowController (macOS).

No core/server code touched; ctest --preset dev unaffected.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-22 15:20:31 +02:00

69 lines
3.4 KiB
Swift

// swift-tools-version: 6.0
//
// VoiceCatCore the shared Swift core for the VoiceCat macOS (AppKit) and iOS (SwiftUI)
// clients. It wraps libvoicecat's C ABI (core/include/voicecat.h) as imported through the
// VoiceCatCore.xcframework binary target's module map (`import VoiceCatC`), and exposes a
// Swift-idiomatic, @MainActor-safe surface.
//
// Architecture: docs/architecture.md §4 ("one core, many faces"). The Windows C# client
// (clients/windows/VoiceCat.Interop) is the proven mirror of this same layering the Swift
// wrapper follows the same patterns (callback-lifetime, string-lifetime, event-delivery
// thread handoff, immediate vc_free_* on list reads) adapted to Swift's interop model.
//
// The XCFramework is a LOCAL BUILD ARTIFACT run `scripts/build-xcframework.sh` before
// `swift build` / `swift test`. See clients/apple/README.md.
import PackageDescription
let package = Package(
name: "VoiceCatCore",
// macOS 14 (Sonoma) is the AppKit client's deployment target. iOS 18 is the SwiftUI client
// target (clients/apple/iOS/) 18.0 unlocks the newest AVAudioSession APIs (stereo capture,
// polar patterns, data sources). Run `scripts/build-xcframework.sh --all` to produce all
// three slices: macos-arm64, ios-arm64, ios-arm64-simulator.
// swift-tools-version 6.0 is required for .iOS(.v18); swiftLanguageVersions .v5 keeps the
// Swift 5 language mode (avoids Swift 6 strict concurrency checking on pre-existing code).
platforms: [
.macOS(.v14),
.iOS(.v18),
],
products: [
.library(name: "VoiceCatCore", targets: ["VoiceCatCore"]),
],
targets: [
// Binary target the prebuilt static lib + headers + module map. Produced by
// scripts/build-xcframework.sh from the `apple-dev` CMake preset.
.binaryTarget(
name: "VoiceCatCoreXCF",
path: "VoiceCatCore.xcframework"
),
// The Swift wrapper library what the macOS/iOS apps import as `import VoiceCatCore`.
.target(
name: "VoiceCatCore",
dependencies: ["VoiceCatCoreXCF"],
path: "Sources/VoiceCatCore",
// Event-cue WAVs (shared with the Windows client) bundled into the package's
// resource bundle; EventFeedback loads them via Bundle.module. Copied from
// assets/sounds/ into Sources/VoiceCatCore/Sounds/.
resources: [.process("Sounds")]
),
// Smoke tests against a real voicecat-server mirrors clients/windows/
// VoiceCat.Interop.Tests/VoiceCatClientSmokeTests.cs. Requires the `dev` CMake preset
// to be built (build/dev/bin/voicecat-server + voicecat-admin).
//
// linkerSettings: libvoicecat.a is a static C++20 library (built by the apple-dev
// preset with vcpkg's clang), so the final executable must link libc++ (the LLVM C++
// standard library on macOS). vcpkg's static deps (mbedtls/sodium/opus/protobuf/
// sqlite3/spdlog/asio) are already compiled into the .a; macOS system frameworks
// (CoreAudio/CoreFoundation) are auto-discovered by the linker (PROGRESS.md).
.testTarget(
name: "VoiceCatCoreTests",
dependencies: ["VoiceCatCore"],
path: "Tests/VoiceCatCoreTests",
linkerSettings: [
.linkedLibrary("c++"),
]
),
],
swiftLanguageModes: [.v5]
)