v2.3.3 release: cross-platform driver in docs (makeDefaultAudioDriver)
This commit is contained in:
@@ -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)
|
||||
```
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -227,7 +227,7 @@ import LyrebirdSynth
|
||||
let engine = SynthesisEngine(
|
||||
blockSize: 512, sampleRate: 44100,
|
||||
numOutputChannels: 2, numInputChannels: 0,
|
||||
driver: CoreAudioDriver()
|
||||
driver: makeDefaultAudioDriver()
|
||||
)
|
||||
try engine.start()
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ let engine = SynthesisEngine(
|
||||
sampleRate: 44100,
|
||||
numOutputChannels: 2,
|
||||
numInputChannels: 0,
|
||||
driver: CoreAudioDriver()
|
||||
driver: makeDefaultAudioDriver()
|
||||
)
|
||||
try engine.start()
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -146,7 +146,7 @@ let engine = SynthesisEngine(
|
||||
sampleRate: 44100,
|
||||
numOutputChannels: 2,
|
||||
numInputChannels: 2,
|
||||
driver: CoreAudioDriver()
|
||||
driver: makeDefaultAudioDriver()
|
||||
)
|
||||
|
||||
// Add your Synthesizers here.
|
||||
|
||||
@@ -69,7 +69,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 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
|
||||
|
||||
|
||||
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user