b6fdee8bfc
Consolidated release: the cross-platform Linux port (engine, generators, CLI, REPL, NRT, portable DSP), live ALSA audio + ALSA MIDI + POSIX OSC + portable WAV codec, the GTK4 GUI (LyrebirdUI on the SwiftOpenUI backend), and the Linux live-coding scratchpad (LiveCompile). Apple platforms unchanged; all additive. See RELEASES.md and LINUX_README.md. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
38 lines
1.9 KiB
Swift
38 lines
1.9 KiB
Swift
// ALSAError.swift
|
|
// Lyrebird
|
|
//
|
|
// Copyright (c) 2026 Joshua Parmenter / realizedsound
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
/// Errors thrown by `ALSAAudioDriver` during setup or start.
|
|
///
|
|
/// Every case carries the raw ALSA return code where one exists; pass it to
|
|
/// `snd_strerror` for the system's own description. Declared unconditionally
|
|
/// (not behind the Linux guard) so cross-platform code can name the type.
|
|
public enum ALSAError: Error, Equatable, Sendable {
|
|
/// `snd_pcm_open` failed for the playback device. Associated values are the
|
|
/// device name asked for and the ALSA error code.
|
|
case playbackDeviceOpenFailed(device: String, code: Int)
|
|
/// `snd_pcm_open` failed for the capture device.
|
|
case captureDeviceOpenFailed(device: String, code: Int)
|
|
/// `snd_pcm_set_params` rejected the requested format, rate, channel count,
|
|
/// or latency for the named stream.
|
|
case parameterNegotiationFailed(stream: String, code: Int)
|
|
/// `snd_pcm_prepare` failed — either before the render loop started, or
|
|
/// when recovering from an underrun inside it.
|
|
case prepareFailed(stream: String, code: Int)
|
|
/// A `snd_pcm_writei` / `snd_pcm_readi` transfer failed with an error the
|
|
/// render loop cannot recover from (device removed, bad descriptor).
|
|
case transferFailed(stream: String, code: Int)
|
|
/// `setup(engine:)` was never called, so there is nothing to start.
|
|
case notConfigured
|
|
/// The render thread did not leave its loop within the stop timeout —
|
|
/// almost always a transfer wedged inside the driver. The PCM handles and
|
|
/// staging buffers are deliberately leaked rather than freed under a thread
|
|
/// that may still be using them.
|
|
case renderThreadDidNotExit
|
|
/// The render loop exited before it could start: the engine reference or a
|
|
/// staging buffer was missing.
|
|
case renderLoopPreconditionFailed
|
|
}
|