fixed bluetooth going into headset mode on quit
@ -275,12 +275,15 @@ class Application {
|
||||
return
|
||||
}
|
||||
var volume: Double = Application.store.state.effects.volume.gain
|
||||
if (AudioDevice.currentOutputDevice.outputVolumeSupported) {
|
||||
volume = Double(AudioDevice.currentOutputDevice.virtualMasterVolume(direction: .playback)!)
|
||||
var muted = store.state.effects.volume.muted
|
||||
if (selectedDevice!.outputVolumeSupported) {
|
||||
volume = Double(selectedDevice!.virtualMasterVolume(direction: .playback)!)
|
||||
muted = selectedDevice!.mute
|
||||
}
|
||||
|
||||
Application.dispatchAction(VolumeAction.setGain(volume, false))
|
||||
Application.dispatchAction(VolumeAction.setBalance(Application.store.state.effects.volume.balance, false))
|
||||
Application.dispatchAction(VolumeAction.setMuted(muted))
|
||||
|
||||
Driver.device!.setVirtualMasterVolume(volume > 1 ? 1 : Float32(volume), direction: .playback)
|
||||
Driver.latency = selectedDevice!.latency(direction: .playback) ?? 0 // Set driver latency to mimic device
|
||||
@ -441,10 +444,10 @@ class Application {
|
||||
}
|
||||
|
||||
static func stopSave () {
|
||||
stopListeners()
|
||||
switchBackToLastKnownDevice()
|
||||
stopRemoveEngines()
|
||||
Storage.synchronize()
|
||||
stopListeners()
|
||||
stopRemoveEngines()
|
||||
switchBackToLastKnownDevice()
|
||||
}
|
||||
|
||||
static func handleSleep () {
|
||||
|
@ -68,30 +68,27 @@ class Volume: StoreSubscriber {
|
||||
}
|
||||
|
||||
mixer.outputVolume = Float(virtualVolume)
|
||||
|
||||
if (!volumeSupported) {
|
||||
Driver.device!.mute = false
|
||||
device.mute = false
|
||||
}
|
||||
|
||||
let shouldMute = gain == 0.0
|
||||
Driver.device!.mute = shouldMute
|
||||
device.mute = shouldMute
|
||||
|
||||
Volume.gainChanged.emit(gain)
|
||||
|
||||
Application.ignoreNextVolumeEvent = false
|
||||
Application.ignoreNextDriverMuteEvent = false
|
||||
|
||||
if (gain == 0) {
|
||||
Application.dispatchAction(VolumeAction.setMuted(true))
|
||||
} else if (muted) {
|
||||
Application.dispatchAction(VolumeAction.setMuted(false))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var muted: Bool = false {
|
||||
didSet {
|
||||
Driver.device!.mute = muted
|
||||
Application.selectedDevice!.mute = muted
|
||||
if (muted) {
|
||||
mixer.outputVolume = 0
|
||||
} else {
|
||||
(gain = gain)
|
||||
}
|
||||
Application.ignoreNextDriverMuteEvent = false
|
||||
Volume.mutedChanged.emit(muted)
|
||||
}
|
||||
}
|
||||
@ -175,6 +172,9 @@ class Volume: StoreSubscriber {
|
||||
Console.log("Creating Volume")
|
||||
({
|
||||
self.boostEnabled = state.boostEnabled
|
||||
self.balance = state.balance
|
||||
self.gain = state.gain
|
||||
self.muted = state.muted
|
||||
})()
|
||||
setupStateListener()
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ class StatusItem {
|
||||
}
|
||||
}
|
||||
|
||||
private static let iconSize = NSMakeSize(20, 15)
|
||||
private static let iconSize = NSMakeSize(20, 14)
|
||||
private static let speakerIconImages: [NSImage] = [
|
||||
NSImage(named: "speaker0")!.resize(with: iconSize),
|
||||
NSImage(named: "speaker1")!.resize(with: iconSize),
|
||||
@ -37,8 +37,8 @@ class StatusItem {
|
||||
NSImage(named: "speaker3")!.resize(with: iconSize)
|
||||
]
|
||||
private static let classicIconImage = NSImage(named: "statusBarIcon")!.resize(with: NSMakeSize(20, 20))
|
||||
static func getNativeImageForVolume (_ volume: Double) -> NSImage {
|
||||
if volume <= 0.01 {
|
||||
static func getNativeImageFor (volume: Double, muted: Bool) -> NSImage {
|
||||
if muted || volume <= 0.01 {
|
||||
return speakerIconImages[0]
|
||||
}
|
||||
if volume <= 0.33 {
|
||||
@ -63,7 +63,10 @@ class StatusItem {
|
||||
image.isTemplate = false
|
||||
break
|
||||
case .macOS:
|
||||
image = StatusItem.getNativeImageForVolume(Application.store.state.effects.volume.gain)
|
||||
image = StatusItem.getNativeImageFor(
|
||||
volume: Application.store.state.effects.volume.gain,
|
||||
muted: Application.store.state.effects.volume.muted
|
||||
)
|
||||
image.isTemplate = true
|
||||
break
|
||||
}
|
||||
@ -78,6 +81,7 @@ class StatusItem {
|
||||
private let rightClickMenu = NSMenu()
|
||||
let rightClickGesture = NSClickGestureRecognizer()
|
||||
private var volumeGainChangedListener: EventListener<Double>!
|
||||
private var mutedChangedListener: EventListener<Bool>!
|
||||
|
||||
let item = NSStatusBar.system.statusItem(withLength: NSStatusItem.squareLength)
|
||||
var button: NSStatusBarButton!
|
||||
@ -86,7 +90,12 @@ class StatusItem {
|
||||
public init() {
|
||||
self.button = item.button!
|
||||
// Listen to volume changes and apply icon
|
||||
self.volumeGainChangedListener = Volume.gainChanged.on { [weak self] gain in
|
||||
self.volumeGainChangedListener = Volume.gainChanged.on { [weak self] _ in
|
||||
if (self != nil && self!.iconType == .macOS) {
|
||||
(self!.iconType = self!.iconType)
|
||||
}
|
||||
}
|
||||
self.mutedChangedListener = Volume.mutedChanged.on { [weak self] _ in
|
||||
if (self != nil && self!.iconType == .macOS) {
|
||||
(self!.iconType = self!.iconType)
|
||||
}
|
||||
|
@ -1,67 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "1140"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
buildImplicitDependencies = "YES">
|
||||
<BuildActionEntries>
|
||||
<BuildActionEntry
|
||||
buildForTesting = "YES"
|
||||
buildForRunning = "YES"
|
||||
buildForProfiling = "YES"
|
||||
buildForArchiving = "YES"
|
||||
buildForAnalyzing = "YES">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "2743C9C51D7EF84B0089613B"
|
||||
BuildableName = "libPublicUtility.a"
|
||||
BlueprintName = "PublicUtility"
|
||||
ReferencedContainer = "container:Driver.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildActionEntry>
|
||||
</BuildActionEntries>
|
||||
</BuildAction>
|
||||
<TestAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES">
|
||||
<Testables>
|
||||
</Testables>
|
||||
</TestAction>
|
||||
<LaunchAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
launchStyle = "0"
|
||||
useCustomWorkingDirectory = "NO"
|
||||
ignoresPersistentStateOnLaunch = "NO"
|
||||
debugDocumentVersioning = "YES"
|
||||
debugServiceExtension = "internal"
|
||||
allowLocationSimulation = "YES">
|
||||
</LaunchAction>
|
||||
<ProfileAction
|
||||
buildConfiguration = "Release"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||
savedToolIdentifier = ""
|
||||
useCustomWorkingDirectory = "NO"
|
||||
debugDocumentVersioning = "YES">
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "2743C9C51D7EF84B0089613B"
|
||||
BuildableName = "libPublicUtility.a"
|
||||
BlueprintName = "PublicUtility"
|
||||
ReferencedContainer = "container:Driver.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
</ProfileAction>
|
||||
<AnalyzeAction
|
||||
buildConfiguration = "Debug">
|
||||
</AnalyzeAction>
|
||||
<ArchiveAction
|
||||
buildConfiguration = "Release"
|
||||
revealArchiveInOrganizer = "YES">
|
||||
</ArchiveAction>
|
||||
</Scheme>
|
BIN
native/shared/assets.xcassets/speaker0.imageset/0-1.png
vendored
Normal file
After Width: | Height: | Size: 4.7 KiB |
BIN
native/shared/assets.xcassets/speaker0.imageset/0-2.png
vendored
Normal file
After Width: | Height: | Size: 4.7 KiB |
BIN
native/shared/assets.xcassets/speaker0.imageset/0.png
vendored
Normal file
After Width: | Height: | Size: 4.7 KiB |
@ -1,17 +1,17 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"filename" : "speaker0-66.png",
|
||||
"filename" : "0-2.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"filename" : "speaker0-65.png",
|
||||
"filename" : "0-1.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename" : "speaker0-64.png",
|
||||
"filename" : "0.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
|
Before Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 1.3 KiB |
BIN
native/shared/assets.xcassets/speaker1.imageset/1-1.png
vendored
Normal file
After Width: | Height: | Size: 2.7 KiB |
BIN
native/shared/assets.xcassets/speaker1.imageset/1-2.png
vendored
Normal file
After Width: | Height: | Size: 2.7 KiB |
BIN
native/shared/assets.xcassets/speaker1.imageset/1.png
vendored
Normal file
After Width: | Height: | Size: 2.7 KiB |
@ -1,17 +1,17 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"filename" : "speaker1-66.png",
|
||||
"filename" : "1-2.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"filename" : "speaker1-65.png",
|
||||
"filename" : "1-1.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename" : "speaker1-64.png",
|
||||
"filename" : "1.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
|
Before Width: | Height: | Size: 1.7 KiB |
Before Width: | Height: | Size: 1.7 KiB |
Before Width: | Height: | Size: 1.7 KiB |
BIN
native/shared/assets.xcassets/speaker2.imageset/2-1.png
vendored
Normal file
After Width: | Height: | Size: 2.8 KiB |
BIN
native/shared/assets.xcassets/speaker2.imageset/2-2.png
vendored
Normal file
After Width: | Height: | Size: 2.8 KiB |
BIN
native/shared/assets.xcassets/speaker2.imageset/2.png
vendored
Normal file
After Width: | Height: | Size: 2.8 KiB |
@ -1,17 +1,17 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"filename" : "speaker2-66.png",
|
||||
"filename" : "2-2.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"filename" : "speaker2-65.png",
|
||||
"filename" : "2-1.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename" : "speaker2-64.png",
|
||||
"filename" : "2.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
|
Before Width: | Height: | Size: 2.2 KiB |
Before Width: | Height: | Size: 2.2 KiB |
Before Width: | Height: | Size: 2.2 KiB |
BIN
native/shared/assets.xcassets/speaker3.imageset/3-1.png
vendored
Normal file
After Width: | Height: | Size: 2.4 KiB |
BIN
native/shared/assets.xcassets/speaker3.imageset/3-2.png
vendored
Normal file
After Width: | Height: | Size: 2.4 KiB |
BIN
native/shared/assets.xcassets/speaker3.imageset/3.png
vendored
Normal file
After Width: | Height: | Size: 2.4 KiB |
@ -1,17 +1,17 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"filename" : "speaker3-66.png",
|
||||
"filename" : "3-2.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"filename" : "speaker3-65.png",
|
||||
"filename" : "3-1.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename" : "speaker3-64.png",
|
||||
"filename" : "3.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
|
Before Width: | Height: | Size: 2.7 KiB |
Before Width: | Height: | Size: 2.7 KiB |
Before Width: | Height: | Size: 2.7 KiB |