v2.3.3 release: cross-platform driver in docs (makeDefaultAudioDriver)
This commit is contained in:
@@ -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 |
|
||||
|
||||
@@ -86,7 +86,7 @@ let engine = SynthesisEngine(
|
||||
sampleRate: 48000,
|
||||
numOutputChannels: 2,
|
||||
numInputChannels: 0,
|
||||
driver: CoreAudioDriver()
|
||||
driver: makeDefaultAudioDriver()
|
||||
)
|
||||
try engine.start()
|
||||
try engine.add(MySynth())
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -879,7 +879,7 @@ let events: [LyrebirdEvent] = [
|
||||
|
||||
// MARK: - Live performance
|
||||
|
||||
let driver = CoreAudioDriver()
|
||||
let driver = makeDefaultAudioDriver()
|
||||
let engine = SynthesisEngine(
|
||||
blockSize: 512,
|
||||
sampleRate: 44100,
|
||||
|
||||
@@ -111,7 +111,7 @@ let engine = SynthesisEngine(
|
||||
sampleRate: 44100,
|
||||
numOutputChannels: 2,
|
||||
numInputChannels: 2,
|
||||
driver: CoreAudioDriver()
|
||||
driver: makeDefaultAudioDriver()
|
||||
)
|
||||
|
||||
// engine.add(MySynth())
|
||||
|
||||
@@ -50,7 +50,7 @@ import LyrebirdSynth
|
||||
let engine = SynthesisEngine(
|
||||
blockSize: 512, sampleRate: 44100,
|
||||
numOutputChannels: 2, numInputChannels: 2,
|
||||
driver: CoreAudioDriver()
|
||||
driver: makeDefaultAudioDriver()
|
||||
)
|
||||
try engine.start()
|
||||
|
||||
|
||||
@@ -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 <doc:NRTGuide>.
|
||||
**Copy this target** when you want a headless synthesis starting point. Swap `makeDefaultAudioDriver()` for `NRTDriver(outputURL:duration:)` for offline rendering — see <doc:NRTGuide>.
|
||||
|
||||
### LyrebirdUIDemo — GUI starting point
|
||||
|
||||
|
||||
Reference in New Issue
Block a user