11// Copyright © 2022 Brad Howes. All rights reserved.
22
3+ #if os(macOS)
4+
35import AUv3Support
46import CoreAudioKit
57import Kernel
@@ -14,13 +16,14 @@ extension Knob: @retroactive AUParameterValueProvider, @retroactive RangedContro
1416/**
1517 Controller for the AUv3 filter view. Handles wiring up of the controls with AUParameter settings.
1618 */
17- @objc open class ViewController : AUViewController {
19+ @objc final public class ViewController : AUViewController {
1820
1921 // NOTE: this special form sets the subsystem name and must run before any other logger calls.
2022 private let log : OSLog = Shared . logger ( Bundle . main. auBaseName + " AU " , " ViewController " )
2123
2224 private let parameters = Parameters ( )
2325 private var viewConfig : AUAudioUnitViewConfiguration !
26+ private var versionTagValue : String = " "
2427
2528 @IBOutlet private weak var controlsView : NSView !
2629
@@ -45,7 +48,7 @@ extension Knob: @retroactive AUParameterValueProvider, @retroactive RangedContro
4548 @IBOutlet private weak var odd90Control : NSSwitch !
4649 @IBOutlet private weak var negativeFeedbackControl : NSSwitch !
4750
48- @IBOutlet private weak var versionTag : NSTextView !
51+ @IBOutlet private weak var versionTag : NSTextField !
4952
5053 private lazy var controls : [ ParameterAddress : ( Knob , FocusAwareTextField ) ] = [
5154 . depth: ( depthControl, depthValueLabel) ,
@@ -88,6 +91,10 @@ public extension ViewController {
8891 os_log ( . info, log: log, " viewDidLoad END " )
8992 }
9093
94+ override func viewDidAppear( ) {
95+ versionTag. text = versionTagValue
96+ }
97+
9198 override func mouseDown( with event: NSEvent ) {
9299 // Allow for clicks on the common NSView to end editing of values
93100 NSApp . keyWindow? . makeFirstResponder ( nil )
@@ -104,15 +111,12 @@ extension ViewController: AUAudioUnitFactory {
104111 @objc public func createAudioUnit( with componentDescription: AudioComponentDescription ) throws -> AUAudioUnit {
105112 let bundle = InternalConstants . bundle
106113
107- DispatchQueue . main. async {
108- self . versionTag. string = bundle. versionTag
109- }
110-
111114 let kernel = KernelBridge ( bundle. auBaseName, maxDelayMilliseconds: parameters [ . delay] . maxValue)
112115 let audioUnit = try FilterAudioUnitFactory . create ( componentDescription: componentDescription,
113116 parameters: parameters,
114117 kernel: kernel,
115118 viewConfigurationManager: self )
119+ self . versionTagValue = bundle. versionTag
116120 self . audioUnit = audioUnit
117121 return audioUnit
118122 }
@@ -201,3 +205,5 @@ private enum InternalConstants {
201205 private class EmptyClass { }
202206 static let bundle = Bundle ( for: InternalConstants . EmptyClass. self)
203207}
208+
209+ #endif
0 commit comments