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

644 B
Raw Blame
import Combine
import SwiftUI

protocol AudioVisualizationConfig {
    var noiseThreshold: CGFloat { get }
    var maxAnimationScale: CGFloat { get }
    var animationSpring: Animation { get }
}

final class AudioVisualizationData: ObservableObject {
    @Published var audioLevel: CGFloat = 0.0
    private var cancellable: AnyCancellable?

    init(audioLevelPublisher: AnyPublisher<CGFloat, Never>) {
        self.cancellable = audioLevelPublisher
            .receive(on: RunLoop.main)
            .sink { [weak self] level in
                self?.audioLevel = level
            }
    }

    deinit {
        cancellable?.cancel()
    }
}