v2.3.1 release: cross-platform LyrebirdGUIDemo + Linux demo ports + doc refresh
- New Demos/LyrebirdGUIDemo: one shared source (synths + node-based views) that bootstraps SwiftUI on macOS and GTK4/SwiftOpenUI on Linux; LYREBIRD_DEMO=vector|sine. - The four CLI demos (Quickstart/Demo/NRT/Score) now build and run on Linux. - README + Linux getting-started refreshed; LyrebirdATK row removed from the Extensions section pending collaborator sign-off. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -7,9 +7,21 @@
|
||||
import Foundation
|
||||
import LyrebirdSynth
|
||||
|
||||
// Output to the Desktop — triggers the NSDesktopFolderUsageDescription TCC prompt on first run.
|
||||
let outputURL = FileManager.default.homeDirectoryForCurrentUser
|
||||
// Offline render has no audio device, so this demo runs the same on macOS and Linux.
|
||||
// Only the output container differs: CAF is Apple-only (it goes through `ExtAudioFile`),
|
||||
// so off Apple we write the portable WAV codec instead.
|
||||
#if canImport(AudioToolbox)
|
||||
// Apple: CAF on the Desktop — triggers the NSDesktopFolderUsageDescription TCC prompt on first run.
|
||||
let outputURL: URL = FileManager.default.homeDirectoryForCurrentUser
|
||||
.appendingPathComponent("Desktop/nrt_output.caf")
|
||||
let outputFormat: AudioFileFormat = .cafFloat32
|
||||
#else
|
||||
// Linux (and any non-Apple): WAV in the current working directory — no special-folder
|
||||
// permission needed, and `WavFileWriter` is the portable encoder off Apple.
|
||||
let outputURL: URL = URL(fileURLWithPath: FileManager.default.currentDirectoryPath)
|
||||
.appendingPathComponent("nrt_output.wav")
|
||||
let outputFormat: AudioFileFormat = .wavFloat32
|
||||
#endif
|
||||
|
||||
// Render parameters.
|
||||
let sampleRate: Double = 48000
|
||||
@@ -43,7 +55,7 @@ let tailDuration: Double = 0.1
|
||||
let lastStart = voices.map(\.start).max() ?? 0.0
|
||||
let totalDur = lastStart + interSetDelay + voiceLength + tailDuration
|
||||
|
||||
let driver = NRTDriver(outputURL: outputURL, duration: totalDur)
|
||||
let driver = NRTDriver(outputURL: outputURL, duration: totalDur, format: outputFormat)
|
||||
let engine = SynthesisEngine(
|
||||
blockSize: blockSize,
|
||||
sampleRate: sampleRate,
|
||||
@@ -77,7 +89,7 @@ do {
|
||||
)
|
||||
}
|
||||
} catch {
|
||||
fputs("engine.schedule failed: \(error)\n", stderr)
|
||||
FileHandle.standardError.write(Data("engine.schedule failed: \(error)\n".utf8))
|
||||
exit(1)
|
||||
}
|
||||
|
||||
@@ -87,7 +99,7 @@ do {
|
||||
try engine.start()
|
||||
print("Done.")
|
||||
} catch {
|
||||
fputs("Render failed: \(error)\n", stderr)
|
||||
FileHandle.standardError.write(Data("Render failed: \(error)\n".utf8))
|
||||
exit(1)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user