Commit graph

68 commits

Author SHA1 Message Date
Kyle Neideck
5000c64084
Fix build errors in XCode 15.2.
Ignore deprecation warnings in PublicUtility and drop support for macOS
10.12 and earlier.

See #712.
2024-01-23 23:44:31 +11:00
Kyle Neideck
d048287140
Fix slider knob sizes.
Also,
 - Update copyright years.
 - Drop support for macOS 10.9.
2022-06-12 14:36:59 +10:00
Antoine Cœur
f31aebcf51 spelling 2022-01-21 09:35:16 +08:00
Kyle Neideck
a5b7cd69e3
Update the link to the latest SNAPSHOT in the README.
Also, update the copyright year in the UI and in the bundles.
2021-04-03 18:28:01 +11:00
Kyle Neideck
c0ab98b98b
Workaround deadlocks when starting IO on macOS Big Sur.
This works similarly to the workaround in the previous commit, but
avoids the short wait while XPC times out. It still allows some initial
frames to be dropped when IO starts.

See #328, #388 and PR #390.
2020-11-26 00:49:34 +11:00
Aleksey Yurkevich
043bfb3633 Big Sur fix 2020-11-21 16:27:59 +03:00
Kyle Neideck
23ecf7e46e
Fix BGMDriver and BGMXPCHelper's version strings for SNAPSHOT builds.
And DEBUG builds. The "-SNAPSHOT-abc0123" suffix was only being added to
the version string for BGMApp.
2020-02-09 22:18:52 +11:00
Kyle Neideck
8de821d4aa
Add an archive option (-a) to build_and_install.sh.
Archiving is the standard way to build a release for distribution using
Xcode. package.sh now uses this option when it creates a release
package.

This change is mainly to keep the Run settings in the Xcode schemes from
affecting the release builds, which means we can commit the schemes with
more sensible settings.

Also, disable AddressSanitizer in the BGMDevice scheme, which was
stopping coreaudiod from launching because its sandbox won't allow the
process to load the AddressSanitizer dylib.
2020-02-05 00:09:14 +11:00
Kyle Neideck
2c1677305d
Add optional debug logging in release builds.
Clicking the status bar icon with the option key held now reveals a
setting that enables debug logging in BGMApp. It's enabled by default in
debug builds.

It doesn't enable debug logging in BGMDriver or BGMXPCHelper yet.

This will hopefully make it easier for people to include logs when they
report bugs that don't occur with most hardware or are otherwise hard to
reproduce.

Enabling debug logging should be unlikely to cause audio glitches, but I
haven't tried to make it completely safe.

Also,
 - add some basic unit tests for BGMPlayThrough and expand the mocks for
   the CoreAudio HAL API,
 - fix the UI tests so you can run them without code signing them, and
 - update copyright years.
2020-01-24 08:07:34 +11:00
Kyle Neideck
8ca17bb5f8
Fix occasional IO deadline misses in BGM_Device.
Seems to have been introduced by my previous commit.
2019-12-01 14:04:57 +11:00
Kyle Neideck
120606b95e
Fix the BGMDriver tests not compiling. 2019-11-30 22:36:17 +11:00
Kyle Neideck
5fc615bdb5
Add a copy of CARingBuffer to the BGMDriver project.
It was using the copy in the BGMApp project, but for historical reasons
they both have a separate copy of the PublicUtility classes. We haven't
gotten around to combining them yet, so this commit is to keep them
consistent until we do.

Also, some minor clean up in BGMDriver related to #218.
2019-11-30 21:04:21 +11:00
Gordon Childs
40f0128dcd
first attempt at using CARingBuffer 2019-11-30 21:04:21 +11:00
Kyle Neideck
f61f998c51
BGMDriver: Copy settings when a new client matches an existing one.
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.
2019-08-17 16:16:17 +10:00
Kyle Neideck
7f6c0e9d4f
Update the README to link to v0.3.1.
Also, bump the minor version number.
2019-08-13 18:46:25 +10:00
Kyle Neideck
9e50e2348b
Bump the patch version. I code signed v0.3.0 incorrectly. #233 2019-08-13 10:13:52 +10:00
Kyle Neideck
002afc0cd1
Update copyright years. #227 2019-08-05 22:42:17 +10:00
Kyle Neideck
0a7be7d32c
Enable Hardened Runtime in BGMApp, BGMXPCHelper and BGMDriver.
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.)
2019-08-05 21:25:57 +10:00
Kyle Neideck
475d141ae4
Make builds more deterministic.
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.
2018-11-12 19:15:26 +11:00
Kyle Neideck
871bb97a52
Increment minor version number. 2018-10-25 00:00:52 +11:00
Kyle Neideck
2a41204fc0
Update the years in some copyright notices. 2018-06-05 01:13:14 +10:00
Kyle Neideck
7171cfcb78
Add a test for BGM_Device::DoIOOperation. 2018-02-24 21:44:09 +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
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
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
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
02558cd275
BGMApp: Move some more code into BGMBackgroundMusicDevice.
Mostly code for getting and setting BGMDevice's custom properties. Also
adds some stricter checking for property data received from BGMDevice.
2017-08-06 22:16:17 +10:00
Kyle Neideck
b715212cab
Ignore UI sounds when auto-pausing.
On macOS, apps are supposed to play UI-related sounds using the "system
default" device. This commit creates a new instance of BGM_Driver, which
BGMApp sets as the system default device. BGMApp ignores audio played to
that device when deciding whether to pause/unpause the user's music
player.

Since UI sounds are short, this helps avoid pausing the music player and
unpausing it shortly after.
2017-07-30 18:16:25 +10:00
Kyle Neideck
ccac7d7001
Rename BGMDevice from "Background Music Device" to "Background Music".
Resolves #116.
2017-06-25 12:39:34 +10:00
Kyle Neideck
9aec1aed34
Enable AddressSanitizer by default in debug builds and tests.
Except when running BGMDriver because you have to change coreaudiod's
sandbox profile for that. And you have to disable SIP (rootless) to do
that.
2017-06-24 20:20:16 +10:00
Kyle Neideck
5a657a01a6
Fix dropped frames when starting IO.
It turns out that the HAL will sometimes call BGM_Driver::StartIO before
sending kAudioDevicePropertyDeviceIsRunning to BGMPlayThrough. In that
case, BGMApp would start playthrough and tell BGMDriver to return from
StartIO immediately, which meant we would drop the initial frames while
the output device started up.

So now BGMApp waits for the output device in that case as well.

Fixes #7.
2017-06-22 19:36:17 +10:00
Kyle Neideck
aa8d9ae518
Increment minor version number. 2017-06-22 19:36:17 +10:00
Kyle Neideck
3732eceed8
Increase the version number. (But just the patch level.) 2017-06-17 18:01:09 +10:00
Kyle Neideck
45519a4d52
Fix BGMDriver's version number. 2017-06-12 17:22:34 +10:00
Kyle Neideck
5e4556b49d
Add packaging script and (possibly) support for OS X 10.9. 2017-06-11 19:19:31 +10:00
Kyle Neideck
8d1adf25bb
BGM_Device: Fix over-releasing custom property data.
BGM_Device::Device_SetPropertyData was releasing the CFArray it gets
from the host (i.e. coreaudiod) when BGMApp sets
kAudioDeviceCustomPropertyEnabledOutputControls, which would deallocate
it, but coreaudiod also releases that CFArray.

Found with AddressSanitizer.
2017-06-04 23:31:56 +10:00
Kyle Neideck
c33941a22b
Disable -Wpartial-availability in BGMDriver tests. 2017-06-04 01:31:31 +10:00
Kyle Neideck
ec7128495f
Skip setting NSMenuItem.accessibilityTitle on OS X < 10.12.
This should also fix compilation with the 10.11 SDK.

Also enabled -Wpartial-availability and raised the deployment target to
OS X 10.9.
2017-06-03 23:17:34 +10:00
Kyle Neideck
c617d98f9d
BGMDevice: Only enable volume/mute if the output device also has them.
BGMApp now disables BGMDevice's volume and/or mute controls if the
output device selected in BGMApp doesn't have matching controls. This
prevents the controls from being presented to the user when they don't
do anything.

In BGMPlayThrough, wait much longer for our IOProcs to stop themselves
before assuming something's gone wrong. In testing, rapidly changing
between output devices with and without controls while playing audio
would occasionally cause one of the IOProcs to take too long to stop
itself.

Also adds some basic scriptability, mainly so UI tests can use
AppleScript to check BGMApp's state that would be complicated to check
otherwise. (In this case, to check which output device is selected.)

Fixes #101.
2017-05-30 23:22:48 +10:00
Kyle Neideck
60e1b3564b
Add a UI tests target for BGMApp. Only has one test so far.
The UI tests run with clean user defaults, but BGMDevice and Scripting Bridge
still need to be mocked/stubbed out. That also means that the UI tests can only
run if BGMDriver is installed and that changes to BGMDriver's state made during
the tests will persist.
2017-02-19 13:39:34 +11:00
Kyle Neideck
8257f49b46
Merge pull request #98 from rakslice/pan 2017-02-14 23:32:21 +11:00
Kyle Neideck
cdea147010
Move the pan sliders into an "extra controls" section of the menu items.
Also add centre tick marks and "L"/"R" (left/right) labels to them.

The idea is to eventually include extra controls like an equalizer, recording
apps, hiding/ignoring apps, routing apps, etc.

Also, remove the left margin from the App Volumes menu items. Even macOS isn't
consistent about including that margin, as far as I can tell.
2017-02-11 16:47:52 +11:00
Kyle Neideck
a91615fc5e
Fix a deadlock when changing output device while IO is running.
BGM_Device::StartIO blocks on
BGMAudioDeviceManager::waitForOutputDeviceToStart, which could be blocked by
HAL requests that the HAL wouldn't return until BGM_Device::StartIO returned.

Also:
 - Replace BGMPlayThrough's move constructor with a SetDevices function for
   simplicity.
 - Pause/abort debug builds if an error is logged.
2017-02-01 09:09:00 +11:00
Andrew Tonner
acf3976b9b remove suprious setCellClass call; cleanup 2017-01-09 14:58:05 -08:00
rakslice
f6ac51a334 fixed typo 2017-01-02 02:43:40 -08:00
rakslice
94c594b342 added per-app pan sliders 2017-01-02 02:30:00 -08:00
Kyle Neideck
847313a174
Log debug messages to syslog and include debug symbols in BGMApp bundle.
In BGMApp, messages logged with the DebugMsg macro now go to syslog
instead of stdout.

People running standalone BGMApp debug builds (i.e. not in Xcode) should
be able the find the debug logs more easily. Xcode still shows the debug
logs normally when running BGMApp in Xcode.

Also, debug symbols (the .dSYM directory) are now included in the
Background Music.app bundle. (In both debug and release builds.)
CrashReporter is able to find these and use them to symbolicate BGMApp
crash logs.
2016-12-26 21:27:41 +11:00
Kyle Neideck
7992a5708c
Use data source names instead of device names in the output device menu.
The names of the data source(s) for a device are generally the names
intended to be shown to the user, since the OS X volume menu, System
Preferences, etc. use them.

A menu item is now added for each data source of each output device,
rather than one per device.

Also adds some macros/functions for casting values to __nonnull.

Resolves #59.
2016-12-23 01:46:27 +11:00