diff --git a/BGMApp/BGMApp/BGMAppVolumes.mm b/BGMApp/BGMApp/BGMAppVolumes.mm index d0a0b7d..d6f1c0b 100644 --- a/BGMApp/BGMApp/BGMAppVolumes.mm +++ b/BGMApp/BGMApp/BGMAppVolumes.mm @@ -410,7 +410,7 @@ static CGFloat const kAppVolumeViewInitialHeight = 20; // [kAppRelativeVolumeMinRawValue, kAppRelativeVolumeMaxRawValue] already. context.audioDevices.bgmDevice.SetAppVolume(self.intValue, appProcessID, - (__bridge CFStringRef)appBundleID); + (__bridge_retained CFStringRef)appBundleID); } @end @@ -456,7 +456,7 @@ static CGFloat const kAppVolumeViewInitialHeight = 20; // The values from our sliders are in [kAppPanLeftRawValue, kAppPanRightRawValue] already. context.audioDevices.bgmDevice.SetAppPanPosition(self.intValue, appProcessID, - (__bridge CFStringRef)appBundleID); + (__bridge_retained CFStringRef)appBundleID); } @end diff --git a/BGMApp/BGMApp/BGMBackgroundMusicDevice.cpp b/BGMApp/BGMApp/BGMBackgroundMusicDevice.cpp index c1e9697..746590b 100644 --- a/BGMApp/BGMApp/BGMBackgroundMusicDevice.cpp +++ b/BGMApp/BGMApp/BGMBackgroundMusicDevice.cpp @@ -185,10 +185,10 @@ void BGMBackgroundMusicDevice::SendAppVolumeOrPanToBGMDevice(SInt32 inNewValue, addVolumeChange(inAppProcessID, inAppBundleID); // Add the same change for each process the app is responsible for. - for(CFStringRef responsibleBundleID : ResponsibleBundleIDsOf(inAppBundleID)) + for(CACFString responsibleBundleID : ResponsibleBundleIDsOf(CACFString(inAppBundleID))) { // Send -1 as the PID so this volume will only ever be matched by bundle ID. - addVolumeChange(-1, responsibleBundleID); + addVolumeChange(-1, responsibleBundleID.GetCFString()); } CFPropertyListRef changesPList = appVolumeChanges.AsPropertyList(); @@ -209,32 +209,32 @@ void BGMBackgroundMusicDevice::SendAppVolumeOrPanToBGMDevice(SInt32 inNewValue, // this list if the API doesn't work. // // static -std::vector -BGMBackgroundMusicDevice::ResponsibleBundleIDsOf(CFStringRef inParentBundleID) +std::vector +BGMBackgroundMusicDevice::ResponsibleBundleIDsOf(CACFString inParentBundleID) { - std::map> bundleIDMap = { + std::map> bundleIDMap = { // Finder - { CFSTR("com.apple.finder"), { CFSTR("com.apple.quicklook.ui.helper") } }, + { "com.apple.finder", { "com.apple.quicklook.ui.helper" } }, // Safari - { CFSTR("com.apple.Safari"), { CFSTR("com.apple.WebKit.WebContent") } }, + { "com.apple.Safari", { "com.apple.WebKit.WebContent" } }, // Firefox - { CFSTR("org.mozilla.firefox"), { CFSTR("org.mozilla.plugincontainer") } }, + { "org.mozilla.firefox", { "org.mozilla.plugincontainer" } }, // Firefox Nightly - { CFSTR("org.mozilla.nightly"), { CFSTR("org.mozilla.plugincontainer") } }, + { "org.mozilla.nightly", { "org.mozilla.plugincontainer" } }, // VMWare Fusion - { CFSTR("com.vmware.fusion"), { CFSTR("com.vmware.vmware-vmx") } }, + { "com.vmware.fusion", { "com.vmware.vmware-vmx" } }, // Parallels - { CFSTR("com.parallels.desktop.console"), { CFSTR("com.parallels.vm") } }, + { "com.parallels.desktop.console", { "com.parallels.vm" } }, // MPlayer OSX Extended - { CFSTR("hu.mplayerhq.mplayerosx.extended"), - { CFSTR("ch.sttz.mplayerosx.extended.binaries.officialsvn") } } + { "hu.mplayerhq.mplayerosx.extended", + { "ch.sttz.mplayerosx.extended.binaries.officialsvn" } } }; // Parallels' VM "dock helper" apps have bundle IDs like // com.parallels.winapp.87f6bfc236d64d70a81c47f6243add4c.f5a25fdede514f7aa0a475a1873d3287.fs - if(CFStringHasPrefix(inParentBundleID, CFSTR("com.parallels.winapp."))) + if(inParentBundleID.StartsWith(CFSTR("com.parallels.winapp."))) { - return { CFSTR("com.parallels.vm") }; + return { "com.parallels.vm" }; } return bundleIDMap[inParentBundleID]; diff --git a/BGMApp/BGMApp/BGMBackgroundMusicDevice.h b/BGMApp/BGMApp/BGMBackgroundMusicDevice.h index 02cac82..c605dab 100644 --- a/BGMApp/BGMApp/BGMBackgroundMusicDevice.h +++ b/BGMApp/BGMApp/BGMBackgroundMusicDevice.h @@ -40,6 +40,9 @@ // Local Includes #include "BGM_Types.h" +// PublicUtility Includes +#include "CACFString.h" + // STL Includes #include @@ -123,8 +126,8 @@ private: pid_t inAppProcessID, CFStringRef inAppBundleID); - static std::vector - ResponsibleBundleIDsOf(CFStringRef inParentBundleID); + static std::vector + ResponsibleBundleIDsOf(CACFString inParentBundleID); #pragma mark Audible State