Merge pull request #464 from marcuswu/fix/issue_457

Fix/issue 459
This commit is contained in:
Kyle Neideck 2021-04-03 00:04:12 +11:00 committed by GitHub
commit fe786fb338
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 11 additions and 7 deletions

View file

@ -36,7 +36,7 @@
bgmMenu:(NSMenu*)inMenu
appVolumeView:(NSView*)inView;
// Pass -1 for initialVolume or initialPan to leave the volume/pan at its default level.
// Pass -1 for initialVolume or kAppPanNoValue for initialPan to leave the volume/pan at its default level.
- (void) insertMenuItemForApp:(NSRunningApplication*)app
initialVolume:(int)volume
initialPan:(int)pan;

View file

@ -153,7 +153,7 @@ static NSString* const kMoreAppsMenuTitle = @"More Apps";
- (BGMAppVolumeAndPan) getVolumeAndPanForApp:(NSRunningApplication*)app {
BGMAppVolumeAndPan result = {
.volume = -1,
.pan = -1
.pan = kAppPanNoValue
};
NSMenuItem *item = [self getMenuItemForApp:app];
@ -191,7 +191,7 @@ static NSString* const kMoreAppsMenuTitle = @"More Apps";
}
// Set the pan position.
if (volumeAndPan.pan != -1 && [subview isKindOfClass:[BGMAVM_PanSlider class]]) {
if (volumeAndPan.pan != kAppPanNoValue && [subview isKindOfClass:[BGMAVM_PanSlider class]]) {
[(BGMAVM_PanSlider*)subview setPanPosition:volumeAndPan.pan];
}
}
@ -217,7 +217,7 @@ static NSString* const kMoreAppsMenuTitle = @"More Apps";
}
// Set the pan position.
if (pan != -1 && [subview isKindOfClass:[BGMAVM_PanSlider class]]) {
if (pan != kAppPanNoValue && [subview isKindOfClass:[BGMAVM_PanSlider class]]) {
[(BGMAVM_PanSlider*)subview setPanPosition:pan];
}
}

View file

@ -109,7 +109,7 @@
if (volumeAndPan.volume != -1) {
[self setVolume:volumeAndPan.volume forAppWithProcessID:app.processIdentifier bundleID:app.bundleIdentifier];
}
if (volumeAndPan.pan != -1) {
if (volumeAndPan.pan != kAppPanNoValue) {
[self setPanPosition:volumeAndPan.pan forAppWithProcessID:app.processIdentifier bundleID:app.bundleIdentifier];
}
}
@ -118,7 +118,7 @@
fromVolumes:(const CACFArray&)volumes {
BGMAppVolumeAndPan volumeAndPan = {
.volume = -1,
.pan = -1
.pan = kAppPanNoValue
};
for (UInt32 i = 0; i < volumes.GetNumberItems(); i++) {

View file

@ -24,6 +24,9 @@
// Self Include
#import "BGMASApplication.h"
// Local Includes
#import "BGM_Types.h"
@implementation BGMASApplication {
NSScriptObjectSpecifier* parentSpecifier;
NSRunningApplication *application;
@ -60,7 +63,7 @@
- (void) setVolume:(int)vol {
BGMAppVolumeAndPan volume = {
.volume = vol,
.pan = -1
.pan = kAppPanNoValue
};
[appVolumesController setVolumeAndPan:volume forApp:application];
}

View file

@ -163,6 +163,7 @@ enum BGMDeviceAudibleState : SInt32
#define kAppPanLeftRawValue -100
#define kAppPanCenterRawValue 0
#define kAppPanRightRawValue 100
#define kAppPanNoValue INT_MIN
// kAudioDeviceCustomPropertyEnabledOutputControls indices
enum