mirror of
https://github.com/kyleneideck/BackgroundMusic
synced 2024-11-10 14:44:14 +00:00
Clarify some comments in BGMPreferredOutputDevices.
This commit is contained in:
parent
4c0c656538
commit
94f13e747c
3 changed files with 12 additions and 9 deletions
|
@ -48,9 +48,9 @@
|
||||||
- (instancetype) initWithDevices:(BGMAudioDeviceManager*)devices
|
- (instancetype) initWithDevices:(BGMAudioDeviceManager*)devices
|
||||||
userDefaults:(BGMUserDefaults*)userDefaults;
|
userDefaults:(BGMUserDefaults*)userDefaults;
|
||||||
|
|
||||||
// Returns the most-preferred device currently connected. If no preferred devices are connected,
|
// Returns the most-preferred device that's currently connected. If no preferred devices are
|
||||||
// returns the current output device. If the current output device has been disconnected, returns
|
// connected, returns the current output device. If the current output device has been disconnected,
|
||||||
// an arbitrary device.
|
// 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
|
// 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.
|
// to use because the HAL returned errors when queried, returns kAudioObjectUnknown.
|
||||||
|
|
|
@ -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
|
// 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
|
// 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<NSDictionary*>* preferredOutputDeviceInfos = @[];
|
NSArray<NSDictionary*>* preferredOutputDeviceInfos = @[];
|
||||||
|
|
||||||
// If we can't read the Plist, we only know that the current systemwide default device is the
|
// 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
|
// 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
|
// most-preferred device in the list from the Plist that's also connected. If it isn't,
|
||||||
// probably changed, so we should ignore it's data and log a warning.
|
// the format of the Plist has probably changed, so we should ignore its data and log a
|
||||||
|
// warning.
|
||||||
BGM_Utils::LogAndSwallowExceptions(BGMDbgArgs, [&] {
|
BGM_Utils::LogAndSwallowExceptions(BGMDbgArgs, [&] {
|
||||||
BGMAudioDevice defaultDevice = CAHALAudioSystemObject().GetDefaultAudioDevice(false, false);
|
BGMAudioDevice defaultDevice = CAHALAudioSystemObject().GetDefaultAudioDevice(false, false);
|
||||||
NSString* __nullable defaultDeviceUID =
|
NSString* __nullable defaultDeviceUID =
|
||||||
|
@ -294,7 +297,7 @@ NSString* const kAudioSystemSettingsPlist =
|
||||||
|
|
||||||
if (!defaultDevice.IsBGMDeviceInstance()) {
|
if (!defaultDevice.IsBGMDeviceInstance()) {
|
||||||
// BGMDevice isn't the systemwide default device, so we know the default device is the
|
// 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;
|
preferredDevice = defaultDevice;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
#
|
#
|
||||||
# build_and_install.sh
|
# build_and_install.sh
|
||||||
#
|
#
|
||||||
# Copyright © 2016, 2017 Kyle Neideck
|
# Copyright © 2016-2018 Kyle Neideck
|
||||||
# Copyright © 2016 Nick Jacques
|
# Copyright © 2016 Nick Jacques
|
||||||
#
|
#
|
||||||
# Builds and installs BGMApp, BGMDriver and BGMXPCHelper. Requires xcodebuild and Xcode.
|
# Builds and installs BGMApp, BGMDriver and BGMXPCHelper. Requires xcodebuild and Xcode.
|
||||||
|
|
Loading…
Reference in a new issue