Commit graph

10 commits

Author SHA1 Message Date
Kyle Neideck
488ed16dfc
Hopefully fix a segfault caused by BGM_PlayThrough.
Issue #276 reported a segfault that occurred while BGMApp was launching.
It was caused by BGM_PlayThrough's output IOProc when it tried to read
from the ring buffer. I haven't been able to reproduce the problem, so I
don't know whether this commit will actually fix it. Hopefully it will
at least make it easier to diagnose.

This commit adds locking around accesses to the buffer so that the
IOProcs will skip the current IO cycle if it isn't safe to use the ring
buffer. That should only happen during launch or when changing the
output device. (And only if something else has gone wrong.)
2020-04-18 22:00:49 +10: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
Gordon Childs
40f0128dcd
first attempt at using CARingBuffer 2019-11-30 21:04:21 +11: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
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
1171bee102
Refactor non-UI code out of BGMAppVolumes. 2017-10-28 18:13:08 +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
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
ab9d4cdc2b
Add more exception handling to BGMApp...
And other reliability improvements. Mostly in BGMPlayThrough and the
classes that use it. Trying to catch C++ exceptions as early as possible
in the Objective-C++ code and, if necessary, convert them to NSErrors.

More errors are logged in release builds now, which will hopefully help
with debugging issues the developers can't reproduce themselves.
2016-12-15 03:20:07 +11:00
Kyle Neideck
b17d736382 Initial commit 2016-02-19 16:25:34 +11:00