Skip to content

Fastest and only macOS Dictation app with on-device STT and custom trained AI enhancement model. Windows, iOS testflight! Android, Linux waitlist open! A local Wispr Flow alternative. Follow https://x.com/fluidvoiceapp for more

chore(beta5): resolve dashboard and spectrum lint

altic-devc755620eb081
diff --git a/Sources/Fluid/Services/AudioSpectrumMeter.swift b/Sources/Fluid/Services/AudioSpectrumMeter.swift
index c6dd341b..aa257487 100644
--- a/Sources/Fluid/Services/AudioSpectrumMeter.swift
+++ b/Sources/Fluid/Services/AudioSpectrumMeter.swift
@@ -68,9 +68,11 @@ final class AudioSpectrumMeter: @unchecked Sendable {
let halfSize = Self.frameSize / 2
self.real.withUnsafeMutableBufferPointer { realPointer in
self.imaginary.withUnsafeMutableBufferPointer { imaginaryPointer in
- var split = DSPSplitComplex(realp: realPointer.baseAddress!, imagp: imaginaryPointer.baseAddress!)
+ guard let realBase = realPointer.baseAddress, let imaginaryBase = imaginaryPointer.baseAddress else { return }
+ var split = DSPSplitComplex(realp: realBase, imagp: imaginaryBase)
self.frame.withUnsafeBufferPointer { framePointer in
- framePointer.baseAddress!.withMemoryRebound(to: DSPComplex.self, capacity: halfSize) { complex in
+ guard let frameBase = framePointer.baseAddress else { return }
+ frameBase.withMemoryRebound(to: DSPComplex.self, capacity: halfSize) { complex in
vDSP_ctoz(complex, 2, &split, 1, vDSP_Length(halfSize))
}
}
@@ -86,7 +88,8 @@ final class AudioSpectrumMeter: @unchecked Sendable {
let upper = min(max(self.bandEdges[band + 1], lower + 1), halfSize)
var peak: Float = 0
self.magnitudes.withUnsafeBufferPointer { pointer in
- vDSP_maxv(pointer.baseAddress! + lower, 1, &peak, vDSP_Length(upper - lower))
+ guard let base = pointer.baseAddress else { return }
+ vDSP_maxv(base + lower, 1, &peak, vDSP_Length(upper - lower))
}
let octave = Float(band) / Float(Self.bandCount) * log2(Self.highestFrequency / Self.lowestFrequency)
let decibels = 20 * log10(max(peak * amplitudeScale, 1e-9)) + octave * Self.tiltDecibelsPerOctave
@@ -99,8 +102,12 @@ final class AudioSpectrumMeter: @unchecked Sendable {
func reset() {
self.lock.lock()
defer { self.lock.unlock() }
- for index in self.ring.indices { self.ring[index] = 0 }
- for index in self.latest.indices { self.latest[index] = 0 }
+ for index in self.ring.indices {
+ self.ring[index] = 0
+ }
+ for index in self.latest.indices {
+ self.latest[index] = 0
+ }
}
/// Band levels in 0...1, low frequencies first, resampled to `count` bars.
diff --git a/Sources/Fluid/UI/DashboardView.swift b/Sources/Fluid/UI/DashboardView.swift
index 52de5382..86416fe5 100644
--- a/Sources/Fluid/UI/DashboardView.swift
+++ b/Sources/Fluid/UI/DashboardView.swift
@@ -162,14 +162,22 @@ struct DashboardView: View {
}
}
+ private struct Lesson {
+ let title: String
+ let icon: String
+ let complete: Bool
+ let detail: String
+ let action: () -> Void
+ }
+
private var learningCenter: some View {
- let lessons: [(title: String, icon: String, complete: Bool, detail: String, action: () -> Void)] = [
- ("Voice model", "waveform", self.asr.modelsExistOnDisk || self.asr.isAsrReady, "Pick your engine", { self.selectedSidebarItem = .voiceEngine }),
- ("Microphone", "mic", self.asr.micStatus == .authorized, "Set up voice input", {
+ let lessons: [Lesson] = [
+ .init(title: "Voice model", icon: "waveform", complete: self.asr.modelsExistOnDisk || self.asr.isAsrReady, detail: "Pick your engine", action: { self.selectedSidebarItem = .voiceEngine }),
+ .init(title: "Microphone", icon: "mic", complete: self.asr.micStatus == .authorized, detail: "Set up voice input", action: {
if self.asr.micStatus == .notDetermined { self.asr.requestMicAccess() } else { self.asr.openSystemSettingsForMic() }
}),
- ("Typing access", "keyboard", self.accessibilityEnabled, "Dictate in any app", self.openAccessibilitySettings),
- ("AI cleanup", "sparkles", DictationAIPostProcessingGate.isProviderConfigured(), "Optional polish", { self.selectedSidebarItem = .aiEnhancements }),
+ .init(title: "Typing access", icon: "keyboard", complete: self.accessibilityEnabled, detail: "Dictate in any app", action: self.openAccessibilitySettings),
+ .init(title: "AI cleanup", icon: "sparkles", complete: DictationAIPostProcessingGate.isProviderConfigured(), detail: "Optional polish", action: { self.selectedSidebarItem = .aiEnhancements }),
]
let completed = lessons.filter(\.complete).count
diff --git a/Sources/Fluid/UI/StatsSnapshot.swift b/Sources/Fluid/UI/StatsSnapshot.swift
index 462779c3..00d31892 100644
--- a/Sources/Fluid/UI/StatsSnapshot.swift
+++ b/Sources/Fluid/UI/StatsSnapshot.swift
@@ -151,8 +151,12 @@ nonisolated struct StatsSnapshot: Sendable {
let after = counts(processed)
var removed = 0
var added = 0
- for (word, count) in before { removed += max(0, count - (after[word] ?? 0)) }
- for (word, count) in after { added += max(0, count - (before[word] ?? 0)) }
+ for (word, count) in before {
+ removed += max(0, count - (after[word] ?? 0))
+ }
+ for (word, count) in after {
+ added += max(0, count - (before[word] ?? 0))
+ }
return max(removed, added)
}