Fix build failure on case-sensitive file systems. Fixes #64.

It seems that BGMDriver was failing to compile on case-sensitive file
systems because BGM_Types.h included "AudioServerPlugin.h" instead of
"AudioServerPlugIn.h". (Lowercase "i".)

I tried building with the project and Xcode on a case-sensitive disk
image and it would fail without this patch. So I figure it should at
least build now. I haven't had time to test Background Music on a system
running on a case-insensitive file system yet, so I added a TODO about
it in TODO.md.

Also, some unrelated tidying up.
This commit is contained in:
Kyle Neideck 2016-06-16 14:12:45 +10:00
parent 4dba9412fb
commit 1ee9fa348e
11 changed files with 52 additions and 42 deletions

View file

@ -20,8 +20,8 @@
// Copyright © 2016 Kyle Neideck
// Portions copyright (C) 2013 Apple Inc. All Rights Reserved.
//
// Based largely on SA_Device.cpp from Apple's SimpleAudioPlugin sample code. Also uses a few sections from Apple's NullAudio.c
// sample code (found in the same sample project).
// Based largely on SA_Device.cpp from Apple's SimpleAudioDriver Plug-In sample code. Also uses a few sections from Apple's
// NullAudio.c sample code (found in the same sample project).
// https://developer.apple.com/library/mac/samplecode/AudioDriverExamples
//
@ -1828,7 +1828,7 @@ void BGM_Device::StartIO(UInt32 inClientID)
// An overview of the process this function is part of:
// - A client starts IO.
// - The plugin host (the HAL) calls the StartIO function in BGM_PluginInterface, which calls this function.
// - The plugin host (the HAL) calls the StartIO function in BGM_PlugInInterface, which calls this function.
// - BGMDriver sends a message to BGMApp telling it to start the (real) audio hardware.
// - BGMApp starts the hardware and, after the hardware is ready, replies to BGMDriver's message.
// - BGMDriver lets the host know that it's ready to do IO by returning from StartIO.

View file

@ -20,7 +20,7 @@
// Copyright © 2016 Kyle Neideck
// Portions copyright (C) 2013 Apple Inc. All Rights Reserved.
//
// Based largely on SA_Device.h from Apple's SimpleAudioPlugin sample code.
// Based largely on SA_Device.h from Apple's SimpleAudioDriver Plug-In sample code.
// https://developer.apple.com/library/mac/samplecode/AudioDriverExamples
//

View file

@ -20,7 +20,7 @@
// Copyright © 2016 Kyle Neideck
// Portions copyright (C) 2013 Apple Inc. All Rights Reserved.
//
// Based largely on SA_Object.cpp from Apple's SimpleAudioPlugin sample code.
// Based largely on SA_Object.cpp from Apple's SimpleAudioDriver Plug-In sample code.
// https://developer.apple.com/library/mac/samplecode/AudioDriverExamples
//
// Similarly to BGM_Object.h, this file hasn't been changed much from SA_Object.cpp, except to

View file

@ -20,10 +20,10 @@
// Copyright © 2016 Kyle Neideck
// Portions copyright (C) 2013 Apple Inc. All Rights Reserved.
//
// Based largely on SA_Object.h from Apple's SimpleAudioPlugin sample code.
// Based largely on SA_Object.h from Apple's SimpleAudioDriver Plug-In sample code.
// https://developer.apple.com/library/mac/samplecode/AudioDriverExamples
//
// The base class for our classes that represent audio objects. (See AudioServerPlugin.h for a
// The base class for our classes that represent audio objects. (See AudioServerPlugIn.h for a
// quick explanation of audio objects.)
//
// This is a stripped down version of SA_Object.h. Unlike the sample code plugin that SA_Object.h

View file

@ -20,7 +20,7 @@
// Copyright © 2016 Kyle Neideck
// Portions copyright (C) 2013 Apple Inc. All Rights Reserved.
//
// Based largely on SA_PlugIn.cpp from Apple's SimpleAudioPlugin sample code.
// Based largely on SA_PlugIn.cpp from Apple's SimpleAudioDriver Plug-In sample code.
// https://developer.apple.com/library/mac/samplecode/AudioDriverExamples
//

View file

@ -20,7 +20,7 @@
// Copyright © 2016 Kyle Neideck
// Portions copyright (C) 2013 Apple Inc. All Rights Reserved.
//
// Based largely on SA_PlugIn.h from Apple's SimpleAudioPlugin sample code.
// Based largely on SA_PlugIn.h from Apple's SimpleAudioDriver Plug-In sample code.
// https://developer.apple.com/library/mac/samplecode/AudioDriverExamples
//

View file

@ -20,7 +20,7 @@
// Copyright © 2016 Kyle Neideck
// Portions copyright (C) 2013 Apple Inc. All Rights Reserved.
//
// Based largely on SA_PlugIn.cpp from Apple's SimpleAudioPlugin sample code.
// Based largely on SA_PlugIn.cpp from Apple's SimpleAudioDriver Plug-In sample code.
// https://developer.apple.com/library/mac/samplecode/AudioDriverExamples
//

View file

@ -23,7 +23,7 @@
#ifndef __SharedSource__BGM_Types__
#define __SharedSource__BGM_Types__
#include <CoreAudio/AudioServerPlugin.h>
#include <CoreAudio/AudioServerPlugIn.h>
#pragma mark IDs
@ -36,9 +36,9 @@
#define kBGMDeviceUID "BGMDevice"
#define kBGMDeviceModelUID "BGMDeviceModelUID"
// The object IDs for the audio objects this driver implements
// The object IDs for the audio objects this driver implements.
//
// Regardless of the wrapped device, this driver always publishes this fixed set of objects. We might need to
// BGMDevice always publishes this fixed set of objects (regardless of the wrapped device). We might need to
// change that at some point, but so far it hasn't caused any problems and it makes the driver much simpler.
enum
{
@ -50,7 +50,7 @@ enum
kObjectID_Mute_Output_Master = 6
};
#pragma mark Custom properties
#pragma mark BGMDevice Custom Properties
enum
{
@ -116,31 +116,9 @@ enum
#define kAppRelativeVolumeMinDbValue -96.0f
#define kAppRelativeVolumeMaxDbValue 0.0f
#pragma mark XPC Return Codes
#pragma mark BGMDevice Custom Property Addresses
enum {
kBGMXPC_Success,
kBGMXPC_MessageFailure,
kBGMXPC_Timeout,
kBGMXPC_BGMAppStateError,
kBGMXPC_HardwareError,
kBGMXPC_InternalError
};
#pragma mark Exceptions
#if defined(__cplusplus)
class BGM_InvalidClientException { };
class BGM_InvalidClientPIDException { };
class BGM_InvalidClientRelativeVolumeException { };
class BGM_DeviceNotSetException { };
#endif
#pragma mark Property Addresses
// For convenience
// For convenience.
static const AudioObjectPropertyAddress kBGMMusicPlayerProcessIDAddress = {
kAudioDeviceCustomPropertyMusicPlayerProcessID,
@ -172,5 +150,27 @@ static const AudioObjectPropertyAddress kBGMAppVolumesAddress = {
kAudioObjectPropertyElementMaster
};
#pragma mark XPC Return Codes
enum {
kBGMXPC_Success,
kBGMXPC_MessageFailure,
kBGMXPC_Timeout,
kBGMXPC_BGMAppStateError,
kBGMXPC_HardwareError,
kBGMXPC_InternalError
};
#pragma mark Exceptions
#if defined(__cplusplus)
class BGM_InvalidClientException { };
class BGM_InvalidClientPIDException { };
class BGM_InvalidClientRelativeVolumeException { };
class BGM_DeviceNotSetException { };
#endif
#endif /* __SharedSource__BGM_Types__ */

View file

@ -85,9 +85,13 @@ There are also lots of other TODOs commented around the code.
- When BGMApp changes the default device to BGMDevice, some apps seem to keep using the previous default device if they
were running IO at the time. Not sure if we can do anything about this.
- Figure out how to test BGMDriver with Address Sanitizer enabled. It isn't working because coreaudiod will try to read
files outside of its sandbox.
- Figure out how to test BGMDriver with Address Sanitizer enabled. It isn't working because it makes coreaudiod try to
read files outside of its sandbox and the system kills it.
- Crash reporting
- Test Background Music on a system running OS X on a case-sensitive file system. In
[#64](https://github.com/kyleneideck/BackgroundMusic/issues/64), BGMDriver failed to compile and the error suggests it
was a case-sensitivity problem. That should be fixed now, but I haven't looked for any runtime bugs.

View file

@ -468,9 +468,14 @@ echo "[3/3] Installing $(bold_face ${APP_DIR}) to $(bold_face ${APP_PATH})." \
show_spinner "${BUILD_FAILED_ERROR_MSG}"
# Fix Background Music.app owner/group.
# (We have to run xcodebuild as root to install BGMXPCHelper because it installs to directories
#
# We have to run xcodebuild as root to install BGMXPCHelper because it installs to directories
# owned by root. But that means the build directory gets created by root, and since BGMApp uses the
# same build directory we have to run xcodebuild as root to install BGMApp as well.)
# same build directory we have to run xcodebuild as root to install BGMApp as well.
#
# TODO: Can't we just chown -R the build dir before we install BGMApp? Then we wouldn't have to
# install BGMApp as root. (But maybe still handle the unlikely case of APP_PATH not being
# user-writable.)
sudo chown -R "$(whoami):admin" "${APP_PATH}/${APP_DIR}"
# Fix the build directories' owner/group. This is mainly so the whole source directory can be

View file

@ -148,6 +148,7 @@ if [ "$user_prompt" == "y" ] || [ "$user_prompt" == "Y" ]; then
# Invalidate sudo ticket
sudo -k
# TODO: What if they only have one audio device?
echo -e "\n${bold}Done! Toggle your sound output device in the Sound control panel to complete the uninstall.${normal}"
osascript -e 'tell application "System Preferences"