Files
Lyrebird/Demos/LyrebirdScratchDemo/LyrebirdScratchDemo/main.swift
T

29 lines
853 B
Swift

// main.swift
// Lyrebird
//
// Copyright (c) 2026 Joshua Parmenter / realizedsound
// SPDX-License-Identifier: MIT
import AppKit
import LyrebirdSynth
let engine: SynthesisEngine = SynthesisEngine(
blockSize: 512,
sampleRate: 48000,
numOutputChannels: 2,
numInputChannels: 0,
driver: CoreAudioDriver()
)
// AppDelegate.init is `@MainActor` (mirrors the other demos' bootstrap — since
// `SynthesizerBase` is `@MainActor`, AppKit-side construction is main-actor
// isolated). Program entry runs on the main thread, so assert main-actor
// isolation for the AppKit bootstrap rather than hopping asynchronously.
MainActor.assumeIsolated {
let delegate: AppDelegate = AppDelegate(engine: engine)
let app: NSApplication = NSApplication.shared
app.setActivationPolicy(.regular)
app.delegate = delegate
app.run()
}