diff --git a/INSTALLATION_AND_USAGE.md b/INSTALLATION_AND_USAGE.md index d1de1b2..7e66895 100644 --- a/INSTALLATION_AND_USAGE.md +++ b/INSTALLATION_AND_USAGE.md @@ -156,7 +156,7 @@ let engine = SynthesisEngine( sampleRate: 48_000, numOutputChannels: 2, numInputChannels: 0, - driver: CoreAudioDriver()) + driver: makeDefaultAudioDriver()) try engine.start() try engine.add(SineTone()) diff --git a/README.md b/README.md index c5287bc..92df0dd 100644 --- a/README.md +++ b/README.md @@ -112,7 +112,7 @@ let engine = SynthesisEngine( sampleRate: 48_000, numOutputChannels: 2, numInputChannels: 0, - driver: CoreAudioDriver()) // NRTDriver for offline, iOSAudioDriver for iOS + driver: makeDefaultAudioDriver()) // CoreAudio on macOS, iOS driver on iOS, ALSA on Linux; NRTDriver for offline try engine.start() try engine.add(FMTone()) // sounds immediately @@ -121,7 +121,7 @@ try engine.schedule(tone, after: 2.5) // sample-accurate, 2.5 s from now tone.carrierFreq = 660 // live, atomic, no glitch ``` -Swap `CoreAudioDriver()` for `NRTDriver(outputURL:duration:)` and the identical graph renders offline to a CAF file. See [`INSTALLATION_AND_USAGE.md`](INSTALLATION_AND_USAGE.md) to add the package and scaffold projects, and [`ARCHITECTURE.md`](ARCHITECTURE.md) for how the threading and scheduling work underneath. +Swap `makeDefaultAudioDriver()` for `NRTDriver(outputURL:duration:)` and the identical graph renders offline to a CAF file. See [`INSTALLATION_AND_USAGE.md`](INSTALLATION_AND_USAGE.md) to add the package and scaffold projects, and [`ARCHITECTURE.md`](ARCHITECTURE.md) for how the threading and scheduling work underneath. ### Live coding — prototype in the interpreter @@ -136,7 +136,7 @@ import LyrebirdSynth let engine = SynthesisEngine( blockSize: 512, sampleRate: 48_000, numOutputChannels: 2, numInputChannels: 0, - driver: CoreAudioDriver()) + driver: makeDefaultAudioDriver()) try engine.start() // Define a synth right in the session. diff --git a/Sources/Lyrebird/Lyrebird.docc/EngineSetup.md b/Sources/Lyrebird/Lyrebird.docc/EngineSetup.md index a1ca53c..093285e 100644 --- a/Sources/Lyrebird/Lyrebird.docc/EngineSetup.md +++ b/Sources/Lyrebird/Lyrebird.docc/EngineSetup.md @@ -18,10 +18,12 @@ let engine = SynthesisEngine( sampleRate: 48000, numOutputChannels: 2, numInputChannels: 0, - driver: CoreAudioDriver() + driver: makeDefaultAudioDriver() ) ``` +> Note: ``makeDefaultAudioDriver()`` returns the live-audio driver for the platform the build targets — `CoreAudioDriver` on macOS, `iOSAudioDriver` on iOS, `ALSAAudioDriver` on a Linux build with libasound, and ``OfflineDriver`` (silent) where no live backend exists. Prefer it over a concrete driver so one source builds and runs on every platform; name a concrete driver only in code already locked to a single platform. Check ``isLiveAudioAvailable`` when silence would be a surprise. + The full parameter list is ``SynthesisEngine/init(blockSize:controlBlockSize:sampleRate:numOutputChannels:numInputChannels:numAudioBuses:numControlBuses:eventQueueCapacity:maxEventsPerBlock:driver:)``: | Parameter | Meaning | Default | diff --git a/Sources/Lyrebird/Lyrebird.docc/GettingStarted.md b/Sources/Lyrebird/Lyrebird.docc/GettingStarted.md index b2e8d44..ff6b2fa 100644 --- a/Sources/Lyrebird/Lyrebird.docc/GettingStarted.md +++ b/Sources/Lyrebird/Lyrebird.docc/GettingStarted.md @@ -86,7 +86,7 @@ let engine = SynthesisEngine( sampleRate: 48000, numOutputChannels: 2, numInputChannels: 0, - driver: CoreAudioDriver() + driver: makeDefaultAudioDriver() ) try engine.start() try engine.add(MySynth()) diff --git a/Sources/Lyrebird/Lyrebird.docc/Lyrebird.md b/Sources/Lyrebird/Lyrebird.docc/Lyrebird.md index 5b148fe..62bcaed 100644 --- a/Sources/Lyrebird/Lyrebird.docc/Lyrebird.md +++ b/Sources/Lyrebird/Lyrebird.docc/Lyrebird.md @@ -7,7 +7,7 @@ A native macOS audio synthesis framework for Swift. Lyrebird provides a signal-graph engine backed by Core Audio. You define instruments and effects as ``Synthesizer`` instances containing networks of ``Generator`` objects, then add them to a running ``SynthesisEngine``. All signal processing runs on the Core Audio real-time thread with no heap allocation in steady state. ```swift -let driver = CoreAudioDriver() +let driver = makeDefaultAudioDriver() let engine = SynthesisEngine( blockSize: 512, sampleRate: 44100, numOutputChannels: 2, numInputChannels: 0, diff --git a/Sources/Lyrebird/Lyrebird.docc/MultiCore.md b/Sources/Lyrebird/Lyrebird.docc/MultiCore.md index 7f651f4..e25b3cb 100644 --- a/Sources/Lyrebird/Lyrebird.docc/MultiCore.md +++ b/Sources/Lyrebird/Lyrebird.docc/MultiCore.md @@ -25,7 +25,7 @@ Lyrebird provides two ways to use multiple cores: let engine = SynthesisEngine( blockSize: 512, sampleRate: 44100, numOutputChannels: 2, numInputChannels: 0, - driver: CoreAudioDriver() + driver: makeDefaultAudioDriver() ) let voices = ParallelGroup(engine: engine) diff --git a/Sources/Lyrebird/Lyrebird.docc/NRTGuide.md b/Sources/Lyrebird/Lyrebird.docc/NRTGuide.md index ca73342..5c189f7 100644 --- a/Sources/Lyrebird/Lyrebird.docc/NRTGuide.md +++ b/Sources/Lyrebird/Lyrebird.docc/NRTGuide.md @@ -22,7 +22,7 @@ NRT rendering is the correct approach for: ## Approach 1 — NRTDriver -Replace `CoreAudioDriver()` with `NRTDriver(outputURL:duration:)`. Everything else stays the same. +Replace `makeDefaultAudioDriver()` with `NRTDriver(outputURL:duration:)`. Everything else stays the same. ```swift import Foundation diff --git a/Sources/Lyrebird/Lyrebird.docc/ProcessSystem.md b/Sources/Lyrebird/Lyrebird.docc/ProcessSystem.md index 22736c6..d762067 100644 --- a/Sources/Lyrebird/Lyrebird.docc/ProcessSystem.md +++ b/Sources/Lyrebird/Lyrebird.docc/ProcessSystem.md @@ -879,7 +879,7 @@ let events: [LyrebirdEvent] = [ // MARK: - Live performance -let driver = CoreAudioDriver() +let driver = makeDefaultAudioDriver() let engine = SynthesisEngine( blockSize: 512, sampleRate: 44100, diff --git a/Sources/Lyrebird/Lyrebird.docc/ProjectSystem.md b/Sources/Lyrebird/Lyrebird.docc/ProjectSystem.md index d5c00eb..5ef36c5 100644 --- a/Sources/Lyrebird/Lyrebird.docc/ProjectSystem.md +++ b/Sources/Lyrebird/Lyrebird.docc/ProjectSystem.md @@ -111,7 +111,7 @@ let engine = SynthesisEngine( sampleRate: 44100, numOutputChannels: 2, numInputChannels: 2, - driver: CoreAudioDriver() + driver: makeDefaultAudioDriver() ) // engine.add(MySynth()) diff --git a/Sources/Lyrebird/Lyrebird.docc/REPLGuide.md b/Sources/Lyrebird/Lyrebird.docc/REPLGuide.md index c717478..f77fbbf 100644 --- a/Sources/Lyrebird/Lyrebird.docc/REPLGuide.md +++ b/Sources/Lyrebird/Lyrebird.docc/REPLGuide.md @@ -50,7 +50,7 @@ import LyrebirdSynth let engine = SynthesisEngine( blockSize: 512, sampleRate: 44100, numOutputChannels: 2, numInputChannels: 2, - driver: CoreAudioDriver() + driver: makeDefaultAudioDriver() ) try engine.start() diff --git a/Sources/Lyrebird/Lyrebird.docc/Targets.md b/Sources/Lyrebird/Lyrebird.docc/Targets.md index cd6974a..a6e45ec 100644 --- a/Sources/Lyrebird/Lyrebird.docc/Targets.md +++ b/Sources/Lyrebird/Lyrebird.docc/Targets.md @@ -63,7 +63,7 @@ swift run LyrebirdDemo Demonstrates: `SynthesizerBase`, `@LiveParam`, `OscSin`, `DelayLine`, `engine.add`/`remove`, and RT-safe parameter updates. Runs real-time audio via ``CoreAudioDriver``. -**Copy this target** when you want a headless synthesis starting point. Swap `CoreAudioDriver()` for `NRTDriver(outputURL:duration:)` for offline rendering — see . +**Copy this target** when you want a headless synthesis starting point. Swap `makeDefaultAudioDriver()` for `NRTDriver(outputURL:duration:)` for offline rendering — see . ### LyrebirdUIDemo — GUI starting point diff --git a/claude/agents/lyrebird_demo_agent.md b/claude/agents/lyrebird_demo_agent.md index 89fc35e..6544221 100644 --- a/claude/agents/lyrebird_demo_agent.md +++ b/claude/agents/lyrebird_demo_agent.md @@ -115,7 +115,7 @@ import LyrebirdSynth let engine = SynthesisEngine( blockSize: 512, sampleRate: 48000, numOutputChannels: 2, numInputChannels: 2, - driver: CoreAudioDriver() + driver: makeDefaultAudioDriver() // CoreAudio (macOS) / iOS / ALSA (Linux) ) do { try engine.start() } catch { print("Engine failed: \(error)"); exit(1) } diff --git a/docs/engine/multi-engine-host.md b/docs/engine/multi-engine-host.md index 6ec06c1..b39302a 100644 --- a/docs/engine/multi-engine-host.md +++ b/docs/engine/multi-engine-host.md @@ -52,7 +52,7 @@ let cfg = SynthesisEngineConfig( sampleRate: 44100, numOutputChannels: 2, numInputChannels: 0, - driver: CoreAudioDriver() + driver: makeDefaultAudioDriver() ) let engine = try host.makeEngine(role: .rtOutput(deviceID: 0), config: cfg) ``` diff --git a/docs/learning-swift/01-hello-world.md b/docs/learning-swift/01-hello-world.md index e32364a..31d4e5b 100644 --- a/docs/learning-swift/01-hello-world.md +++ b/docs/learning-swift/01-hello-world.md @@ -43,13 +43,13 @@ A Lyrebird program is a normal Swift program that uses the Lyrebird library. Her import Foundation import LyrebirdSynth -// The engine owns Core Audio and runs the audio graph. +// The engine owns the audio device and runs the audio graph. let engine: SynthesisEngine = SynthesisEngine( blockSize: 512, sampleRate: 48000, numOutputChannels: 2, numInputChannels: 0, - driver: CoreAudioDriver() + driver: makeDefaultAudioDriver() ) // A synthesizer describes the sound. @@ -98,7 +98,7 @@ let engine: SynthesisEngine = SynthesisEngine( sampleRate: 48000, numOutputChannels: 2, numInputChannels: 0, - driver: CoreAudioDriver() + driver: makeDefaultAudioDriver() ) ``` @@ -108,7 +108,7 @@ let engine: SynthesisEngine = SynthesisEngine( - `blockSize: 512` — the engine processes audio 512 samples at a time. (Lyrebird caps this at 512.) - `sampleRate: 48000` — 48,000 samples per second. - `numOutputChannels: 2` — stereo out. `numInputChannels: 0` — no microphone input. -- `driver: CoreAudioDriver()` — talk to the Mac's audio hardware. (iOS uses a different driver; guide 4.) +- `driver: makeDefaultAudioDriver()` — connect to the platform's audio hardware. It picks the backend automatically: Core Audio on macOS, the iOS driver on iOS, ALSA on Linux (and a silent offline driver where no live audio exists), so the same line works everywhere. (guide 4.) ### Describing the sound diff --git a/docs/tooling/cli-guide.md b/docs/tooling/cli-guide.md index 33ef792..6efe3ff 100644 --- a/docs/tooling/cli-guide.md +++ b/docs/tooling/cli-guide.md @@ -227,7 +227,7 @@ import LyrebirdSynth let engine = SynthesisEngine( blockSize: 512, sampleRate: 44100, numOutputChannels: 2, numInputChannels: 0, - driver: CoreAudioDriver() + driver: makeDefaultAudioDriver() ) try engine.start() diff --git a/docs/tooling/midi-clock-sync.md b/docs/tooling/midi-clock-sync.md index 088c573..72ff947 100644 --- a/docs/tooling/midi-clock-sync.md +++ b/docs/tooling/midi-clock-sync.md @@ -39,7 +39,7 @@ let engine = SynthesisEngine( sampleRate: 44100, numOutputChannels: 2, numInputChannels: 0, - driver: CoreAudioDriver() + driver: makeDefaultAudioDriver() ) try engine.start() diff --git a/docs/tooling/nrt-guide.md b/docs/tooling/nrt-guide.md index fcdaaf8..2c008d8 100644 --- a/docs/tooling/nrt-guide.md +++ b/docs/tooling/nrt-guide.md @@ -24,7 +24,7 @@ Use `NRTDriver` for most cases — it is a drop-in replacement for `CoreAudioDri ### Basic usage -Replace `CoreAudioDriver()` with `NRTDriver(outputURL:duration:)`. Everything else stays the same. +Replace `makeDefaultAudioDriver()` with `NRTDriver(outputURL:duration:)`. Everything else stays the same. ```swift import Foundation diff --git a/docs/tooling/project-system.md b/docs/tooling/project-system.md index 534d5ea..144a88a 100644 --- a/docs/tooling/project-system.md +++ b/docs/tooling/project-system.md @@ -146,7 +146,7 @@ let engine = SynthesisEngine( sampleRate: 44100, numOutputChannels: 2, numInputChannels: 2, - driver: CoreAudioDriver() + driver: makeDefaultAudioDriver() ) // Add your Synthesizers here. diff --git a/docs/tooling/repl.md b/docs/tooling/repl.md index a3861d9..85a9a60 100644 --- a/docs/tooling/repl.md +++ b/docs/tooling/repl.md @@ -69,7 +69,7 @@ import LyrebirdSynth let engine = SynthesisEngine( blockSize: 512, sampleRate: 44100, numOutputChannels: 2, numInputChannels: 2, - driver: CoreAudioDriver() + driver: makeDefaultAudioDriver() ) try engine.start() diff --git a/docs/tooling/targets.md b/docs/tooling/targets.md index a37bda3..d290446 100644 --- a/docs/tooling/targets.md +++ b/docs/tooling/targets.md @@ -63,7 +63,7 @@ swift run LyrebirdDemo Demonstrates: `SynthesizerBase`, `@LiveParam`, `OscSin`, `DelayLine`, `engine.add`/`remove`, and RT-safe parameter updates from the main thread. Runs real-time audio via `CoreAudioDriver`, plays for a few seconds, then stops. -**Copy this target** when you want a headless synthesis starting point. Swap `CoreAudioDriver()` for `NRTDriver(outputURL:duration:)` to render offline to a file — see [nrt-guide.md](nrt-guide.md). +**Copy this target** when you want a headless synthesis starting point. Swap `makeDefaultAudioDriver()` for `NRTDriver(outputURL:duration:)` to render offline to a file — see [nrt-guide.md](nrt-guide.md). ### `LyrebirdUIDemo` — GUI starting point diff --git a/docs/tooling/workflow.md b/docs/tooling/workflow.md index 964ec03..b4c20c6 100644 --- a/docs/tooling/workflow.md +++ b/docs/tooling/workflow.md @@ -37,7 +37,7 @@ import LyrebirdSynth let engine = SynthesisEngine( blockSize: 512, sampleRate: 44100, numOutputChannels: 2, numInputChannels: 2, - driver: CoreAudioDriver() + driver: makeDefaultAudioDriver() ) try engine.start() @@ -153,7 +153,7 @@ let engine = SynthesisEngine( sampleRate: 44100, numOutputChannels: 2, numInputChannels: 2, - driver: CoreAudioDriver() + driver: makeDefaultAudioDriver() ) let kick = KickDrum() diff --git a/scripts/doc-snippets-manifest.txt b/scripts/doc-snippets-manifest.txt index bd1913d..dd2e302 100644 --- a/scripts/doc-snippets-manifest.txt +++ b/scripts/doc-snippets-manifest.txt @@ -6,8 +6,9 @@ LYREBIRD_START_HERE.md 0 a2547833f11acd72 none LYREBIRD_START_HERE.md 3 c0653ad6f9dc0f5b none LYREBIRD_START_HERE.md 4 3d0d1e2673fda229 none README.md 0 1d7c7c19c5a6d112 none -README.md 1 3190dd60b6a8f7f8 none -README.md 3 4bd7e864af2f05fd none +README.md 1 9e7419986634c82c none +README.md 2 3190dd60b6a8f7f8 none +README.md 4 d4768129a1cfed0f none Sources/Lyrebird/AudioDrivers/CoreAudioDriver.swift 0 2b7f04ec486a9a5d none Sources/Lyrebird/AudioDrivers/DefaultAudioDriver.swift 0 5b79c5afb54ed465 none Sources/Lyrebird/Buffers/WavetableSet.swift 0 d2f7469591d6a837 none @@ -106,7 +107,7 @@ Sources/Lyrebird/Lyrebird.docc/DiagnosticsGuide.md 3 4f36c6bd97e3df32 none Sources/Lyrebird/Lyrebird.docc/DiagnosticsGuide.md 4 f1c7f9029c6f48ea none Sources/Lyrebird/Lyrebird.docc/DiagnosticsGuide.md 8 8efe9dc71d2dd8dd engine Sources/Lyrebird/Lyrebird.docc/DiagnosticsGuide.md 9 a0ccfaf1137b9c84 engine -Sources/Lyrebird/Lyrebird.docc/EngineSetup.md 0 cfce51934da66872 none +Sources/Lyrebird/Lyrebird.docc/EngineSetup.md 0 7cfe8e6e89b6005e none Sources/Lyrebird/Lyrebird.docc/EngineSetup.md 1 6a365ef4f437a5f0 engine Sources/Lyrebird/Lyrebird.docc/EngineSetup.md 2 f4d72dca55661e7f engine Sources/Lyrebird/Lyrebird.docc/EngineSetup.md 3 3d81a4c501cf0801 engine @@ -240,8 +241,8 @@ Sources/Lyrebird/Lyrebird.docc/Generators/WritingGenerators.md 2 2134b4cd357e438 Sources/Lyrebird/Lyrebird.docc/Generators/WritingGenerators.md 4 b4dc205b9aa5fc5a none Sources/Lyrebird/Lyrebird.docc/GettingStarted.md 0 3ab248f11418d799 none Sources/Lyrebird/Lyrebird.docc/GettingStarted.md 1 45ba41d51b1116b5 none -Sources/Lyrebird/Lyrebird.docc/GettingStarted.md 2 df30c1eb8663478c synth -Sources/Lyrebird/Lyrebird.docc/Lyrebird.md 0 34c2d1c25110eceb synth +Sources/Lyrebird/Lyrebird.docc/GettingStarted.md 2 c5ca5bc6162803a3 synth +Sources/Lyrebird/Lyrebird.docc/Lyrebird.md 0 cf74375c53429db5 synth Sources/Lyrebird/Lyrebird.docc/MultiCore.md 1 8c645d659f87c9e7 none Sources/Lyrebird/Lyrebird.docc/NRTGuide.md 0 5493b7be98c51e79 none Sources/Lyrebird/Lyrebird.docc/NRTGuide.md 10 2d0a41bdf5b1bbd8 none @@ -269,10 +270,10 @@ Sources/Lyrebird/Lyrebird.docc/ParameterInputs.md 0 d31f119c2f2c873c none Sources/Lyrebird/Lyrebird.docc/ParameterInputs.md 1 6320b52dca1af028 none Sources/Lyrebird/Lyrebird.docc/ParameterInputs.md 6 6b933bd11ae2b8d3 engine Sources/Lyrebird/Lyrebird.docc/PolyphonicVoices.md 1 9baae05324ee9c36 engine -Sources/Lyrebird/Lyrebird.docc/ProcessSystem.md 31 16ac8c55fec10e72 none -Sources/Lyrebird/Lyrebird.docc/ProjectSystem.md 1 5ca73171977bcda7 none +Sources/Lyrebird/Lyrebird.docc/ProcessSystem.md 31 5e03e7865c8f4ace none +Sources/Lyrebird/Lyrebird.docc/ProjectSystem.md 1 371e7bb6ce49e53f none Sources/Lyrebird/Lyrebird.docc/ProjectSystem.md 2 bd3f90eb47fd6006 none -Sources/Lyrebird/Lyrebird.docc/REPLGuide.md 0 44e28203300162fe none +Sources/Lyrebird/Lyrebird.docc/REPLGuide.md 0 2dc70e99b6404557 none Sources/Lyrebird/Lyrebird.docc/RoutineTask.md 0 97969b7e340a3fad none Sources/Lyrebird/Lyrebird.docc/RoutineTask.md 14 86a37ee4afa1de70 none Sources/Lyrebird/Lyrebird.docc/RoutineTask.md 16 62b70fad58edb312 engine @@ -395,6 +396,7 @@ Sources/Lyrebird/TemporalStream/Algorithms/TemporalTendency.swift 0 c710ddd78ba4 Sources/Lyrebird/TemporalStream/Algorithms/TemporalTendency.swift 2 da1b4e7b74d72598 none Sources/LyrebirdUI/LyrebirdUI.docc/GUISystem.md 0 a7c7ea54be39417e none Sources/LyrebirdUI/MouseTracker.swift 0 5b5368aaa517dfa7 none +Sources/LyrebirdUI/MouseTracker.swift 1 5b5368aaa517dfa7 none docs/diagnostics-guide.md 10 dc9b6d6a6320a78c engine docs/diagnostics-guide.md 2 42a857719bcee2d7 none docs/diagnostics-guide.md 3 4f36c6bd97e3df32 none @@ -405,7 +407,7 @@ docs/engine/alsa-audio-driver.md 0 d255cf28c7eff929 none docs/engine/bus-system.md 0 7aa0d214382e2c02 none docs/engine/bus-system.md 4 1420e89a6b21dffd member docs/engine/bus-system.md 5 5882de3452d3fb30 member -docs/engine/multi-engine-host.md 1 10672b6a8d764ee0 none +docs/engine/multi-engine-host.md 1 0032b031fd5a5dbc none docs/engine/scheduling.md 0 2c95d843ffa87129 none docs/engine/scheduling.md 5 18f17a73ca3ff9ae none docs/engine/synthesis-engine.md 1 a5fd826f8cdc7143 engine @@ -413,9 +415,9 @@ docs/engine/synthesis-engine.md 5 b86ed5cdad961753 engine docs/engine/synthesis-engine.md 7 420a077205369626 engine docs/engine/synthesis-engine.md 8 17aeb564649952e4 engine docs/learning-swift/01-hello-world.md 0 03653506ac9beeb2 none -docs/learning-swift/01-hello-world.md 1 ed87a599242dc1ac none +docs/learning-swift/01-hello-world.md 1 960bf10c1da5bae7 none docs/learning-swift/01-hello-world.md 2 0df7f63da21f430c none -docs/learning-swift/01-hello-world.md 3 7fb514e0b937b06b none +docs/learning-swift/01-hello-world.md 3 370a407cba47b238 none docs/learning-swift/01-hello-world.md 4 5f8c95401204fb36 none docs/learning-swift/02-swift-basics.md 0 560d2988df332558 none docs/learning-swift/02-swift-basics.md 1 74425300ee178185 none @@ -430,6 +432,7 @@ docs/learning-swift/03-types-and-functional.md 5 ba1ff2d440140b4d none docs/learning-swift/03-types-and-functional.md 7 bd9afda685bee4eb none docs/learning-swift/03-types-and-functional.md 8 1f72f3e7f59aa2ba none docs/learning-swift/04-xcode-and-packages.md 3 391201fc9e1fa104 none +docs/migrating-to-2.0.md 2 d5ea5668715939f8 none docs/protocols/generator.md 0 759d4352212759f3 none docs/protocols/generator.md 2 a0f4ffb20378c07d none docs/protocols/generator.md 3 0f13c732d11665c0 none @@ -552,16 +555,16 @@ docs/stdlib/theory.md 7 cb778d54e742c021 none docs/stdlib/theory.md 8 ac601091423d2985 none docs/stdlib/theory.md 9 74dda0c11f3d34c4 none docs/tooling/cli-guide.md 0 1407c405647e96de none -docs/tooling/cli-guide.md 1 5173fda0e36a5213 none -docs/tooling/midi-clock-sync.md 0 526a3779a15793c6 none +docs/tooling/cli-guide.md 1 d458830d43b7be3e none +docs/tooling/midi-clock-sync.md 0 dd95b6fa4608e119 none docs/tooling/nrt-guide.md 0 046617aa0016f750 none docs/tooling/nrt-guide.md 14 f06ebc900acda570 none docs/tooling/nrt-guide.md 4 11c60dfed731ac6c none docs/tooling/nrt-guide.md 7 5b70d42bbb32382d engine docs/tooling/nrt-guide.md 9 7a2bd7072c940754 none -docs/tooling/project-system.md 1 f4208870a115401f none +docs/tooling/project-system.md 1 a92cddd62262b494 none docs/tooling/project-system.md 3 491d32c269a92cbf none -docs/tooling/repl.md 0 28355170a44f09cd none +docs/tooling/repl.md 0 fe33a7d93a42d23c none docs/tooling/routine-task.md 1 13ef865253b3351c none docs/tooling/routine-task.md 11 b95b191b847d061e engine docs/tooling/routine-task.md 9 be652d2b3b6f274f none diff --git a/scripts/doc_snippets.py b/scripts/doc_snippets.py index c1d0f56..65d0cfc 100644 --- a/scripts/doc_snippets.py +++ b/scripts/doc_snippets.py @@ -253,9 +253,15 @@ def modules_dir(root: Path) -> Path: proc = subprocess.run(["swift", "build", "--show-bin-path"], cwd=root, capture_output=True, text=True) if proc.returncode == 0 and proc.stdout.strip(): - d = Path(proc.stdout.strip()) / "Modules" + bin_dir = Path(proc.stdout.strip()) + d = bin_dir / "Modules" if d.is_dir(): return d + # Newer SwiftPM build layouts (e.g. .build/out/Products/Debug) drop the + # Modules/ subdir and place the .swiftmodule bundles directly in the bin + # dir. Use the bin dir itself as the import search path in that case. + if any(bin_dir.glob("*.swiftmodule")): + return bin_dir raise RuntimeError("could not locate the built Modules dir; run `swift build` first")