v1.6.0 release: soundfile format expansion (WAV int depths + RF64 >4GB, AIFF/CAF, AAC/ALAC compressed, 4GB guard, unified AudioFileFormat)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-07-22 17:45:34 -07:00
parent 62b2f5dbec
commit 8eb64f883f
33 changed files with 2650 additions and 352 deletions
@@ -323,29 +323,19 @@ public final class LyrebirdScratchMenuController: NSObject, NSMenuItemValidation
}
@objc private func renderToFile(_ sender: Any?) {
// 1. Output path.
// Single save dialog: an accessory view carries the format popup + duration,
// and keeps the filename extension in sync with the chosen container.
let defaultRenderDuration: Double = 5.0
let panel: NSSavePanel = NSSavePanel()
if let caf: UTType = UTType(filenameExtension: "caf") {
panel.allowedContentTypes = [caf]
}
panel.nameFieldStringValue = "render.caf"
panel.message = "Render the snippet (or selection) to a CAF audio file"
guard panel.runModal() == .OK, let url: URL = panel.url else { return }
panel.message = "Render the snippet (or selection) to an audio file"
let accessory: RenderOptionsAccessory = RenderOptionsAccessory(
baseName: "render", initialDuration: defaultRenderDuration, savePanel: panel
)
panel.accessoryView = accessory
// 2. Duration.
let alert: NSAlert = NSAlert()
alert.messageText = "Render duration"
alert.informativeText = "Length to render, in seconds:"
let durationFieldWidth: CGFloat = 200
let durationFieldHeight: CGFloat = 24
let field: NSTextField = NSTextField(frame: NSRect(x: 0, y: 0, width: durationFieldWidth, height: durationFieldHeight))
field.stringValue = "5.0"
alert.accessoryView = field
alert.addButton(withTitle: "Render")
alert.addButton(withTitle: "Cancel")
guard alert.runModal() == .alertFirstButtonReturn else { return } // cancelled
guard let duration: Double = Double(field.stringValue.trimmingCharacters(in: .whitespaces)),
duration > 0 else {
guard panel.runModal() == .OK, let chosenURL: URL = panel.url else { return }
guard let duration: Double = accessory.durationSeconds else {
let invalid: NSAlert = NSAlert()
invalid.messageText = "Invalid duration"
invalid.informativeText = "Enter a positive number of seconds (e.g. 5.0)."
@@ -353,8 +343,15 @@ public final class LyrebirdScratchMenuController: NSObject, NSMenuItemValidation
return
}
let format: AudioFileFormat = accessory.selectedFormat
// This is the source of truth for the final extension: force it to match the
// chosen format so a hand-typed name with the wrong (or no) extension still
// produces a correctly-named file. (The accessory's own panel-name sync is a
// live-preview convenience; enforcement happens here.)
let url: URL = chosenURL.deletingPathExtension().appendingPathExtension(format.fileExtension)
Task { @MainActor in
let ok: Bool = await model.renderToFile(url: url, duration: duration)
let ok: Bool = await model.renderToFile(url: url, format: format, duration: duration)
if ok { NSWorkspace.shared.activateFileViewerSelecting([url]) }
}
}