Skip to content

Commit 3355436

Browse files
committed
ton of improvements
1 parent 2487ff7 commit 3355436

20 files changed

Lines changed: 241 additions & 159 deletions

File tree

native/app/Embedded/eqMac.driver/Contents/Info.plist

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,15 @@
2121
<key>CFBundlePackageType</key>
2222
<string>BNDL</string>
2323
<key>CFBundleShortVersionString</key>
24-
<string>1.0.0</string>
24+
<string>1.1.0</string>
2525
<key>CFBundleSignature</key>
2626
<string>????</string>
2727
<key>CFBundleSupportedPlatforms</key>
2828
<array>
2929
<string>MacOSX</string>
3030
</array>
3131
<key>CFBundleVersion</key>
32-
<string>1.0.0</string>
32+
<string>1.1.0</string>
3333
<key>CFPlugInFactories</key>
3434
<dict>
3535
<key>7080ba34-76cc-40b2-b2b3-819d28460e7e</key>
400 Bytes
Binary file not shown.

native/app/Source/Application.swift

Lines changed: 53 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ import SwiftyUserDefaults
1717
import SwiftyJSON
1818
import ServiceManagement
1919
import ReSwift
20-
import AudioKit
2120
import Sparkle
2221

2322
enum VolumeChangeDirection: String {
@@ -83,6 +82,8 @@ class Application {
8382
self.setupUI()
8483
if (User.isFirstLaunch || Constants.DEBUG) {
8584
UI.show()
85+
} else {
86+
UI.close()
8687
}
8788

8889
}
@@ -108,7 +109,7 @@ class Application {
108109
}
109110

110111
private static func installDriver (_ completion: @escaping() -> Void) {
111-
if !Driver.isInstalled || Driver.isOutdated {
112+
if !Driver.isInstalled {
112113
Alert.confirm(
113114
title: "Audio Driver Installation",
114115
message: "eqMac needs to install an Audio Driver. \nIn order to do that we will ask for your System Password. \nPlease close any apps playing audio (Spotify, YouTube etc.) otherwise installation might fail.",
@@ -130,6 +131,28 @@ class Application {
130131
quit()
131132
}
132133
}
134+
} else if (Driver.isOutdated) {
135+
Alert.confirm(
136+
title: "Audio Driver Update",
137+
message: "There is an optional Audio Driver update that should improve user experience. \nIn order to update eqMac will ask for your System Password. \nPlease close any apps playing audio (Spotify, YouTube etc.) otherwise installation might fail.",
138+
okText: "Update Driver",
139+
cancelText: "Skip update"
140+
) { update in
141+
if update {
142+
Driver.install(started: {
143+
UI.showLoadingWindow("Updating eqMac audio driver")
144+
}) { success in
145+
if (success) {
146+
UI.hideLoadingWindow()
147+
completion()
148+
} else {
149+
driverFailedToInstallPrompt()
150+
}
151+
}
152+
} else {
153+
completion()
154+
}
155+
}
133156
} else {
134157
completion()
135158
}
@@ -490,6 +513,34 @@ class Application {
490513
updater.checkForUpdates(nil)
491514
}
492515

516+
static func reinstallDriver (_ completion: @escaping () -> Void) {
517+
Alert.confirm(
518+
title: "Audio Driver Reinstall",
519+
message: "\nIn order to reinstall the driver eqMac we will ask for your System Password. \nPlease close any apps playing audio (Spotify, YouTube etc.) otherwise installation might fail.",
520+
cancelText: "Cancel"
521+
) { reinstall in
522+
if reinstall {
523+
Driver.install(started: {
524+
UI.showLoadingWindow("Installing eqMac audio driver")
525+
self.stopListeners()
526+
self.stopEngines()
527+
self.switchBackToLastKnownDevice()
528+
}) { success in
529+
if (success) {
530+
UI.hideLoadingWindow()
531+
setupAudio()
532+
completion()
533+
} else {
534+
driverFailedToInstallPrompt()
535+
}
536+
}
537+
} else {
538+
completion()
539+
}
540+
}
541+
542+
}
543+
493544
static func uninstall (_ completion: @escaping (Bool) -> Void) {
494545
Driver.uninstall(started: {
495546
self.stopListeners()

native/app/Source/Audio/Sources/System/Driver.swift

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,15 @@ class Driver {
3737
}
3838
}
3939

40+
static var lastInstalledVersion: String? {
41+
get {
42+
return Storage[.lastInstalledDriverVersion]
43+
}
44+
set {
45+
Storage[.lastInstalledDriverVersion] = newValue
46+
}
47+
}
48+
4049
static var pluginId: AudioObjectID? {
4150
return AudioDevice.lookupIDByPluginBundleID(by: Constants.DRIVER_BUNDLE_ID)
4251
}
@@ -47,9 +56,17 @@ class Driver {
4756
}
4857
}
4958

59+
static var info: Dictionary<String, Any> {
60+
return NSDictionary(contentsOfFile: Bundle.main.path(forResource: "Info", ofType: "plist", inDirectory: "eqMac.driver/Contents")!) as! Dictionary<String, Any>
61+
}
62+
63+
static var bundledVersion: String {
64+
return info["CFBundleVersion"] as! String
65+
}
66+
5067
static var isOutdated: Bool {
5168
get {
52-
return false
69+
return bundledVersion != lastInstalledVersion
5370
}
5471
}
5572

@@ -195,11 +212,21 @@ class Driver {
195212
}
196213

197214
static func install (started: (() -> Void)? = nil, _ finished: @escaping (Bool) -> Void) {
198-
Script.sudo("install_driver", started: started, finished)
215+
Script.sudo("install_driver", started: started, { success in
216+
if (success) {
217+
lastInstalledVersion = bundledVersion
218+
}
219+
finished(success)
220+
})
199221
}
200222

201223
static func uninstall (started: (() -> Void)? = nil, _ finished: @escaping (Bool) -> Void) {
202-
Script.sudo("uninstall_driver", started: started, finished)
224+
Script.sudo("uninstall_driver", started: started, { success in
225+
if (success) {
226+
lastInstalledVersion = nil
227+
}
228+
finished(success)
229+
})
203230
}
204231

205232
}

native/app/Source/Extensions/AKWorkingEqualizerFilter.swift

Lines changed: 0 additions & 29 deletions
This file was deleted.

native/app/Source/Extensions/AudioDevice.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ extension AudioDevice {
7676
mElement: kAudioObjectPropertyElementMaster)
7777
var value = AudioValueRange(mMinimum: 0, mMaximum: 0)
7878
// Try master first
79+
7980
if checkErr(AudioDevice.getPropertyData(self.id, address: propertyAddress, andValue: &value)) != nil {
8081
propertyAddress.mElement = 1
8182
// Try single channel

native/app/Source/Helpers/Storage.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ extension DefaultsKeys {
2626

2727
// Effects - Equalizer - Advanced
2828
static let advancedEqualizerPresets = DefaultsKey<[AdvancedEqualizerPreset]?>("advancedEqualizerPresets")
29-
29+
static let lastInstalledDriverVersion = DefaultsKey<String?>("lastInstalledDriverVersion")
3030
}
3131

3232
let Storage = Defaults

native/app/Source/Scripts/install_driver.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ touch /Library/Extensions &>/dev/null || true
2727

2828
# Copy driver into Plug-Ins folder
2929
cp -f -r "$DIR/eqMac.driver" /Library/Audio/Plug-Ins/HAL/ ||
30-
cp -f -r "../../../build/eqMac/Build/Products/Release/eqMac.driver" /Library/Audio/Plug-Ins/HAL/ # if running from terminal
30+
cp -f -r "../../Embedded/eqMac.driver" /Library/Audio/Plug-Ins/HAL/ # if running from terminal
3131

3232
# Restart CoreAudio
3333
coreaudiod_plist="/System/Library/LaunchDaemons/com.apple.audio.coreaudiod.plist"

native/app/Source/UI/Window.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ import Cocoa
1212
class Window: NSWindow, NSWindowDelegate {
1313
override init(contentRect: NSRect, styleMask style: NSWindow.StyleMask, backing backingStoreType: NSWindow.BackingStoreType, defer flag: Bool) {
1414
super.init(contentRect: contentRect, styleMask: style, backing: backingStoreType, defer: flag)
15+
self.isOneShot = false
1516

16-
self.isOneShot = true
1717
self.titleVisibility = .hidden
1818
self.titlebarAppearsTransparent = true
1919
self.isMovableByWindowBackground = true

native/app/eqMac.xcodeproj/project.pbxproj

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@
3838
E02FF91622C7EC6C0051342A /* Transition.swift in Sources */ = {isa = PBXBuildFile; fileRef = E02FF91522C7EC6C0051342A /* Transition.swift */; };
3939
E02FF91822C8E87D0051342A /* Time.swift in Sources */ = {isa = PBXBuildFile; fileRef = E02FF91722C8E87D0051342A /* Time.swift */; };
4040
E02FF91A22C95B310051342A /* TransitionDataBus.swift in Sources */ = {isa = PBXBuildFile; fileRef = E02FF91922C95B310051342A /* TransitionDataBus.swift */; };
41-
E030FDB4211F766100BA524E /* AKWorkingEqualizerFilter.swift in Sources */ = {isa = PBXBuildFile; fileRef = E030FDB3211F766100BA524E /* AKWorkingEqualizerFilter.swift */; };
4241
E031E9CE23700DDF00BA6DD8 /* Outputs.swift in Sources */ = {isa = PBXBuildFile; fileRef = E031E9CD23700DDF00BA6DD8 /* Outputs.swift */; };
4342
E036BCE723598772001F057B /* DataBus.swift in Sources */ = {isa = PBXBuildFile; fileRef = E036BCE623598772001F057B /* DataBus.swift */; };
4443
E036BCEA235B1171001F057B /* ApplicationDataBus.swift in Sources */ = {isa = PBXBuildFile; fileRef = E036BCE9235B1171001F057B /* ApplicationDataBus.swift */; };
@@ -158,7 +157,6 @@
158157
E02FF91522C7EC6C0051342A /* Transition.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Transition.swift; sourceTree = "<group>"; };
159158
E02FF91722C8E87D0051342A /* Time.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Time.swift; sourceTree = "<group>"; };
160159
E02FF91922C95B310051342A /* TransitionDataBus.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TransitionDataBus.swift; sourceTree = "<group>"; };
161-
E030FDB3211F766100BA524E /* AKWorkingEqualizerFilter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AKWorkingEqualizerFilter.swift; sourceTree = "<group>"; };
162160
E031E9CD23700DDF00BA6DD8 /* Outputs.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Outputs.swift; sourceTree = "<group>"; };
163161
E036BCE623598772001F057B /* DataBus.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DataBus.swift; sourceTree = "<group>"; };
164162
E036BCE9235B1171001F057B /* ApplicationDataBus.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ApplicationDataBus.swift; sourceTree = "<group>"; };
@@ -263,7 +261,6 @@
263261
isa = PBXGroup;
264262
children = (
265263
E00C595C23BBBB6C00C7B8B6 /* UnsafeMutableAudioBufferListPointer.swift */,
266-
E030FDB3211F766100BA524E /* AKWorkingEqualizerFilter.swift */,
267264
E01F2F5E2034A188005123BE /* ArrayExtensions.swift */,
268265
E07A24E31FF3D49F007AEF20 /* AudioDevice.swift */,
269266
E07B45A520FBA4990086AA7E /* Encodable.swift */,
@@ -833,7 +830,6 @@
833830
files = (
834831
E00C596623BBBF3100C7B8B6 /* Atomic.m in Sources */,
835832
E089AC492095E0B1005B72E5 /* Console.swift in Sources */,
836-
E030FDB4211F766100BA524E /* AKWorkingEqualizerFilter.swift in Sources */,
837833
E0AAD9DA249C109000D58099 /* SwiftyPing.swift in Sources */,
838834
E090AD5820A9725F003BE5FF /* Volume.swift in Sources */,
839835
E073727D20167E7600874CC6 /* Application.swift in Sources */,

0 commit comments

Comments
 (0)