If the new client has the same bundle ID as an existing one, we now copy
its settings (volume, etc.) to the new client. This is to fix app
volumes not being applied consistently to apps that play audio through
multiple subprocesses (specifically Google Chrome). See #61.
The install and uninstall scripts try to restart coreaudiod in a number
of ways until one works. Despite that, it still wasn't always successful
when I tested it on macOS Catalina. This commit will hopefully fix that.
`sudo` is usually passwordless in Travis CI builds, but for some reason
`sudo -v` still causes a password prompt in macOS Travis builds.
_uninstall-non-interactive.sh already included a workaround for this,
but it doesn't work when the Travis build for the Homebrew Cask calls
`brew uninstall background-music`, which then calls
_uninstall-non-interactive.sh. The old workaround used the `TRAVIS` env
var, but Homebrew seems to run the script in an environment without it.
See <https://github.com/Homebrew/homebrew-cask/pull/67524>.
This is required for Notarization, which will be mandatory in macOS
Catalina.
Also, suppress some STL deprecation warnings in PublicUtility code. (The
warnings were recently added to Clang.)
The code for GPMDP is a lot more complicated than the code for other
music players. See BGMGooglePlayMusicDesktopPlayer.h for details.
Adds a class, BGMAppWatcher, to hold the code that notifies listeners
when a given app is launched or terminated.
Resolves#161.
Fixes the same issue as df9815a4be, but in
BGMOutputVolumeMenuItem instead of BGMStatusBarItem.
I think the problem was that it captured a weak reference in a C++
lambda, but it would capture by (C++) reference and when the reference
was used it would be referencing invalid memory. The fix to have the
lambda capture by value instead.
See #202.
I think that, because BGMStatusBarItem::initWithMenu was capturing a
weak reference in a C++ lambda as a C++ reference, the C++ reference
would be invalid when it was used. The fix to have the lambda capture by
value instead.
I'm not completely sure why builds from Xcode never crashed or why ASan
didn't catch the bug. Maybe the stack memory was just never
reused/invalidated with Xcode builds. (And I probably just don't
understand how ASan works well enough.)
Fixes#202.
My plan is to also build the packages locally (at least full releases),
code sign manually and then check that the two packages match apart from
the code signature. That way I don't have to give the Travis script
access to my signing private key, which I figure is slightly more
secure.
Packages built with package.sh should now be byte-identical except for
timestamps in Assets.car (in BGMApp resources) and modification dates in
the package's Bom file, if built with the same version of Xcode.
Hopefully this will be enough to allow builds to be reproduced, with a
bit of effort.
I don't know why I put them in the Preferences menu initially. This is
more convenient.
Closes#170.
Also:
- Update the output device menu items as needed instead of when the
user opens the menu. This saves a bit of CPU time and means if the
user has the menu open, changes are made when they're needed instead
of the next time the user opens the menu.
- Fix BGMAppUITests::testCycleOutputDevices for the latest Xcode/macOS.
BGMApp has to set BGMDevice, and often also the Null Device for a short
time, as the systemwide default audio device, which makes CoreAudio put
them in the preferred devices list in its Plist file. And since the list
is limited to three devices, it only gives us one or two usable ones.
Ideally, CoreAudio just wouldn't add our devices to its list, but I
don't think we can prevent that.
As a partial workaround, we now store our own copy of the preferred
devices list without our devices, which BGMApp can use to figure out
which devices were pushed out of CoreAudio's list by our devices.
This doesn't fix the problem entirely because our devices still take up
room in CoreAudio's list when BGMApp is closed, but I think that would
be harder to solve.
See #167.
Also:
- Handle setting the initial output device in BGMPreferredOutputDevices
instead of BGMAudioDeviceManager.
- Fix a crash in BGMOutputVolumeMenuItem::dealloc caused by using
dispatch_sync to dispatch to the main queue while running on the main
queue.
- Fix a crash in BGMPreferredOutputDevices if
/Library/Preferences/Audio/com.apple.audio.SystemSettings.plist
doesn't exist.
- Add Swinsian to the list of music players in the README. (I must have
forgotten to do that when I added support for it.)
When the user chooses a different output device in BGMApp, the new
device is now added to the front of the list of preferred devices. This
stops BGMPreferredOutputDevices changing the output device back shortly
afterward when it gets a device connection/disconnection notification,
which is sent because BGMDriver's Null Device is enabled and then
disabled as part of changing the output device.
It also means BGMApp will now account for the times the output device
has been changed since BGMApp started when deciding whether to change to
a newly connected device and deciding which device to change to when the
current output device is removed.