diff --git a/BGMApp/BGMApp/BGMPreferredOutputDevices.h b/BGMApp/BGMApp/BGMPreferredOutputDevices.h index e5bd7e4..ef25bfb 100644 --- a/BGMApp/BGMApp/BGMPreferredOutputDevices.h +++ b/BGMApp/BGMApp/BGMPreferredOutputDevices.h @@ -48,9 +48,9 @@ - (instancetype) initWithDevices:(BGMAudioDeviceManager*)devices userDefaults:(BGMUserDefaults*)userDefaults; -// Returns the most-preferred device currently connected. If no preferred devices are connected, -// returns the current output device. If the current output device has been disconnected, returns -// an arbitrary device. +// Returns the most-preferred device that's currently connected. If no preferred devices are +// connected, returns the current output device. If the current output device has been disconnected, +// returns an arbitrary device. // // If none of the connected devices can be used as the output device, or if it can't find a device // to use because the HAL returned errors when queried, returns kAudioObjectUnknown. diff --git a/BGMApp/BGMApp/BGMPreferredOutputDevices.mm b/BGMApp/BGMApp/BGMPreferredOutputDevices.mm index c658f2b..3a96743 100644 --- a/BGMApp/BGMApp/BGMPreferredOutputDevices.mm +++ b/BGMApp/BGMApp/BGMPreferredOutputDevices.mm @@ -110,15 +110,18 @@ NSString* const kAudioSystemSettingsPlist = // Default to a list with just the systemwide default device (or an empty list if that fails) if // we can't read the preferred devices from the Plist because preferredDeviceUIDsFrom will use - // BGMApp's stored preferred devices to fill in the rest. + // BGMApp's stored preferred devices to fill in the rest optimistically. This doesn't help us + // tell when to switch to a newly connected device, but it should improve our chances of + // switching to the best device if the current output device is disconnected. NSArray* preferredOutputDeviceInfos = @[]; // If we can't read the Plist, we only know that the current systemwide default device is the - // most-preferred device. + // most-preferred device that's currently connected. // // TODO: If we are able to read the Plist, check that the systemwide default device is the - // most-preferred in the list from the Plist. If it isn't, the format of the Plist has - // probably changed, so we should ignore it's data and log a warning. + // most-preferred device in the list from the Plist that's also connected. If it isn't, + // the format of the Plist has probably changed, so we should ignore its data and log a + // warning. BGM_Utils::LogAndSwallowExceptions(BGMDbgArgs, [&] { BGMAudioDevice defaultDevice = CAHALAudioSystemObject().GetDefaultAudioDevice(false, false); NSString* __nullable defaultDeviceUID = @@ -294,7 +297,7 @@ NSString* const kAudioSystemSettingsPlist = if (!defaultDevice.IsBGMDeviceInstance()) { // BGMDevice isn't the systemwide default device, so we know the default device is the - // most preferred. + // most-preferred device that's currently connected. preferredDevice = defaultDevice; } }); diff --git a/build_and_install.sh b/build_and_install.sh index 73fdb18..6a8cb9f 100755 --- a/build_and_install.sh +++ b/build_and_install.sh @@ -19,7 +19,7 @@ # # build_and_install.sh # -# Copyright © 2016, 2017 Kyle Neideck +# Copyright © 2016-2018 Kyle Neideck # Copyright © 2016 Nick Jacques # # Builds and installs BGMApp, BGMDriver and BGMXPCHelper. Requires xcodebuild and Xcode.