Commit graph

364 commits

Author SHA1 Message Date
Kyle Neideck
94f13e747c
Clarify some comments in BGMPreferredOutputDevices. 2018-10-28 18:11:40 +11:00
Kyle Neideck
4c0c656538
Store the preferred devices list in User Defaults.
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.)
2018-10-28 17:08:47 +11:00
Kyle Neideck
871bb97a52
Increment minor version number. 2018-10-25 00:00:52 +11:00
Kyle Neideck
ffe7406025
Fix errors logged when the current output device is disconnected. 2018-10-24 23:46:28 +11:00
Kyle Neideck
29642da1cf
Update the preferred devices list when the user changes output device.
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.
2018-10-24 22:29:20 +11:00
Kyle Neideck
1bb3873a53
Change output device in some cases when devices are added/removed.
Tries to copy the way CoreAudio normally handles devices being added or
removed, which it can't do while Background Music is running (because
BGMDevice needs to be the default output device for the system).

This may break when Background Music is run on later versions of macOS
as the only way BGMApp can tell what CoreAudio (probably) would have
done is by reading one of its Plist files directly.

See #167.
2018-10-23 14:07:13 +11:00
Kyle Neideck
a4c849dcb2
Update the README to link to v0.2.0. Also update the screenshot. 2018-10-20 14:40:24 +11:00
Kyle Neideck
b0282706df
Fix adding "SNAPSHOT"/"DEBUG" to the version string with multiple tags.
The most recent tag is now used to decide whether to add "-SNAPSHOT-..."
to the version string. So now we can make a new release by tagging a
commit even if we've already made a snapshot/debug release from the same
commit.
2018-10-16 12:38:52 +11:00
Kyle Neideck
94a5f37c2b
Fix BGMOutputVolumeMenuItem tooltip not always being updated.
When you changed to an output device with no data sources, the tooltip
was left set to the name of the previous output device.
2018-10-06 21:42:33 +10:00
Kyle Neideck
797d2f14f5
Update the output device name in the UI if its data source changes.
For the label above the output device volume slider, we use the name of
the output device's current data source, if it has one. But it was only
being updated when the user changed to a different output device.
BGMOutputVolumeMenuItem now updates the label if the output device
changes to a different data source, e.g. from Internal Speakers to
Headphones.
2018-10-06 21:17:41 +10:00
Kyle Neideck
b3b4482bda
Automatically set the release name for Travis CI builds.
Also mark them as prereleases, since most will be snapshot/debug builds.
We can just change that back manually for full releases.
2018-10-06 14:35:57 +10:00
Kyle Neideck
9b33fffd23
Fix the Show More Controls buttons displaying as "...".
The character we use for them (looks like '^') seems to be 1 pixel wider
on macOS 10.14, which meant it didn't fit in the text label anymore.
2018-10-06 12:46:07 +10:00
Kyle Neideck
ac33909b51
Fix pkg installer not opening BGMApp if relocated.
If the user moved BGMApp and then installed a new version from a .pkg,
BGMApp would be installed to the same place the old version had been
moved to. When pkg/postinstall tried to open BGMApp, it would fail
because it assumed BGMApp would be installed to /Applications.

Also, the installer now fails with an error message if it can't open
BGMApp after finishing the install.

Fixes #164.
2018-10-04 21:24:29 +10:00
Kyle Neideck
1a49802675
Hide call to requestAccessForMediaType when compiling on macOS < 10.14.
This should fix the compilation error in BGMAppDelegate when compiling
against a macOS SDK earlier than 10.14.
2018-10-03 18:40:22 +10:00
Kyle Neideck
75e8d5ceac
Request user permission to use input devices and Apple Events.
This is required to build against the macOS 10.14 SDK because 10.14
requires users to grant apps permission before they can use audio input
devices or send Apple Events to other apps.

I think builds built against the 10.13 SDK were supposed to continue
working, but I haven't tested it.

Note that without NSMicrophoneUsageDescription and
NSAppleEventsUsageDescription, 10.14 builds will fail more or less
silently when they try to use those features. (tccd does log a message
about it, though.)

See #163.
2018-10-03 13:28:18 +10:00
Kyle Neideck
08fdef6084
Workaround some Xcode 10 bugs in build_and_install.sh.
Also, update the Xcode versions in .travis.yml.
2018-09-23 18:19:58 +10:00
Kyle Neideck
1e5d625d64
Add app volume workaround for Skype. Fixes #112. 2018-07-03 09:49:16 +10:00
Kyle Neideck
ffa86bbcd9
Add workaround for Discord voice chat volume. 2018-06-19 22:39:40 +10:00
Kyle Neideck
5f31f54a85
Use a larger disk image in Travis CI builds.
Builds for "DEBUG" tags are running out of space.
2018-06-05 12:01:02 +10:00
Kyle Neideck
2a41204fc0
Update the years in some copyright notices. 2018-06-05 01:13:14 +10:00
Kyle Neideck
cb9cdb00b6
Support creating .pkg installers using the debug build configuration.
Users reporting bugs will be able to use these packages to install debug
builds of Background Music without having to install from source. This
is mainly useful because debug builds have more detailed logging.
Hopefully we'll get around to adding an option to enable debug logging
at runtime, but this should work well enough for now.

Also:
 - Use newer macOS images in Travis CI builds.
 - Fix an xcrun command in build_and_install.sh that was accidentally
   being started in the background.
 - Fix build_and_install.sh building libPublicUtility.a twice for no
   reason.
2018-06-05 00:40:21 +10:00
Kyle Neideck
ed06a257a8
Add auto-pause support for Swinsian. See #141. 2018-02-25 12:01:43 +11:00
Kyle Neideck
7171cfcb78
Add a test for BGM_Device::DoIOOperation. 2018-02-24 21:44:09 +11:00
Kyle Neideck
3ba53a50ac
Support building snapshot releases by creating tags.
If HEAD is tagged, check for "SNAPSHOT" or "DEBUG" in the tag name when
generating the version string for a build. If found, add
"-SNAPSHOT-abcdef0" or "-DEBUG-abcdef0" at the end of the version
string (where "abcdef0" is the short commit ID for HEAD).
2018-02-24 17:55:29 +11:00
Kyle Neideck
944fc11212
Add workaround for FaceTime volume.
FaceTime plays call audio using a daemon called avconferenced, so
BGMDriver can't tell where the audio is actually coming from. As a
hopefully temporary fix, BGMApp now just sets avconferenced's volume to
match FaceTime's. See #139.

Also,
 - set a tooltip and accessibility label for BGMApp's status bar item
   (the thing you click to show the main menu), and
 - some minor refactoring.
2018-02-24 15:23:18 +11:00
Kyle Neideck
287bae0923
Fix mocks in BGMMusicPlayersUnitTests. 2018-01-21 13:43:30 +11:00
Kyle Neideck
6117bc285c
Fix BGMApp crashing at launch if BGMDriver isn't installed. 2018-01-20 22:28:32 +11:00
Kyle Neideck
18aa97f055
Fix some minor bugs, mostly found by Coverity.
BGMDeviceControlsList: Set some members to null before they've been
lazily initialised.

BGM_TaskQueue: Fix the destructor possibly throwing.

BGM_Device and BGM_NullDevice: Fix integer division when calculating the
host clock frequency.

BGM_Utils: Fix the C++ utility function used to explicitly cast
__nullable values to __nonnull. (Was previously unused.)
2017-12-28 18:46:52 +11:00
Kyle Neideck
ac2130c3c3
build_and_install.sh: Fix printing the last command in error_handler. 2017-12-27 18:23:25 +11:00
Kyle Neideck
e83d07f00b
.travis.yml: Update Xcode versions. Print logs if package.sh fails.
Travis CI no longer supports building with Xcode 8, 8.1 or 8.2.
2017-12-27 17:53:28 +11:00
Kyle Neideck
b693a8af1e
Add .editorconfig file to fix tab width on GitHub. 2017-12-27 15:22:17 +11:00
Kyle Neideck
b3b60559f2
Link BGMDriver tests with Accelerate framework. 2017-12-27 13:46:58 +11:00
Kyle Neideck
f64cf41f8a
Add a volume slider for system sounds.
System sounds are UI-related sounds like mail notifications or terminal
bells.

Xcode 9.2 doesn't support saving .xib files in Xcode 7 format any more,
so building Background Music now requires Xcode 8 or above.

Also, fix some of the tooltips that would only work if BGMApp was the
foreground app, which it shouldn't be.
2017-12-26 23:10:57 +11:00
Kyle Neideck
bd90399ce3
Update the link to eqMac in the README. 2017-12-11 08:49:33 +11:00
Kyle Neideck
425cb4af9d
When the output device is changed, update its volume slider.
The label above the slider is set to the name of the new output device
and the slider's value is set to its volume.

Also,
 - clean up some code in BGMAudioDeviceManager and
   BGMOutputVolumeMenuItem, and
 - return from BGMAppDelegate::applicationDidFinishLaunching early if
   the launch is being aborted.
2017-11-26 16:12:56 +11:00
Kyle Neideck
4c6de2f77f
Add new QuickLook bundle ID to fix App Volumes for Finder.
QuickLook's bundle ID has changed in High Sierra, which broke the
workaround that BGMApp uses to change QuickLook's app volume when
Finder's is changed.

Reported in #134.
2017-11-25 13:28:43 +11:00
Kyle Neideck
ec81520379
Fix BGMApp unit tests not compiling. 2017-10-29 01:00:37 +11:00
Kyle Neideck
1171bee102
Refactor non-UI code out of BGMAppVolumes. 2017-10-28 18:13:08 +11:00
Kyle Neideck
fb0740c4c1
Enable new compiler warnings suggested by Xcode. 2017-10-23 21:40:30 +11:00
Kyle Neideck
db63ae0cf1
Add BGMTermination files forgotten in previous commit. 2017-10-23 21:35:49 +11:00
Kyle Neideck
59e70fb9d1
Set the OS default audio device back if BGMApp exits abnormally.
This is mostly so BGMApp won't leave BGMDevice as the default if BGMApp
crashes, which would stop audio from playing until the user changed the
default device themselves. Also handles SIGINT, SIGTERM and SIGQUIT.

For crashes where the BGMApp process may be in an unknown state, e.g.
segfaults, BGMXPCHelper handles changing the default device.

Should fix the Travis Xcode 9 build, which is currently failing because
the AppleScript we use to quit BGMApp in .travis.yml gets "user
cancelled" for some reason.

Also makes some minor improvements to the reports generated by
CrashReporter. The way CrashReporter works with Background Music should
otherwise be unchanged.
2017-10-23 20:19:42 +11:00
Kyle Neideck
47ff99303a
Fix compiler warnings in Xcode 9.
Mostly -Wpartial-availability. Fixes #129.
2017-10-12 22:20:28 +11:00
Kyle Neideck
173914e343
Add Xcode 9.0 and 9.1 to .travis.yml. 2017-10-11 09:01:05 +11:00
Kyle Neideck
cce8111251
Add an App Volumes submenu for apps that aren't shown in the dock.
Specifically, apps with NSApplicationActivationPolicyAccessory. That
includes status bar apps like Background Music, but also includes some
that aren't intended to be shown to users as applications like
SystemUIServer.

I'm not sure how much we can do about that. It would probably help if we
hid apps that BGMDriver isn't able to match to a CoreAudio client.

Resolves #122.
2017-09-25 13:05:00 +10:00
Kyle Neideck
df67e4fa2b
Accessibility improvements for the volumes menu items. 2017-09-18 15:21:32 +10:00
Kyle Neideck
e4b98e4099
Add a UI test for the output volume slider. 2017-09-17 16:43:51 +10:00
Kyle Neideck
9fd5c89b27
Move the code for the output volume slider into a new class. 2017-09-16 22:09:03 +10:00
Kyle Neideck
3c001066c4
Set the output volume slider to 0 when the output device is muted. 2017-09-14 00:06:24 +10:00
Kyle Neideck
289f6b3d27
Fix a crash in BGMBackgroundMusicDevice::ResponsibleBundleIDsOf.
If the bundle ID passed to the function (a CACFString) was wrapping a
null CFStringRef, one of the comparison operator functions of CACFString
would pass null to CFStringCompare.
2017-09-12 20:09:04 +10:00
Kyle Neideck
07a419fb34
Add an output volume slider above the app volume sliders.
Similar to the one in macOS's Volume menu extra.

I'm mainly adding it so we can increase the output volume when the user
sets an app volume above 50%. Currently, setting an app volume above 50%
(the default) risks clipping, so it doesn't make sense to do so unless
your main output volume is at its max.

The volume slider added in this commit will make it clear to the user
that their main output volume is also increasing.

The other app volumes won't change, so in the ideal case the user
wouldn't need to be aware that their output device's volume is being
changed. But they might play audio to the device directly and would
expect it to play at the same volume as before they changed the app
volume.
2017-09-12 19:48:42 +10:00