mirror of
https://github.com/kyleneideck/BackgroundMusic
synced 2024-11-10 06:34:22 +00:00
Use kAppPanNoValue in place of INT_MIN
This commit is contained in:
parent
89186d526f
commit
5a5f9d0a8d
5 changed files with 11 additions and 7 deletions
|
@ -36,7 +36,7 @@
|
|||
bgmMenu:(NSMenu*)inMenu
|
||||
appVolumeView:(NSView*)inView;
|
||||
|
||||
// Pass -1 for initialVolume or INT_MIN for 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;
|
||||
|
|
|
@ -153,7 +153,7 @@ static NSString* const kMoreAppsMenuTitle = @"More Apps";
|
|||
- (BGMAppVolumeAndPan) getVolumeAndPanForApp:(NSRunningApplication*)app {
|
||||
BGMAppVolumeAndPan result = {
|
||||
.volume = -1,
|
||||
.pan = INT_MIN
|
||||
.pan = kAppPanNoValue
|
||||
};
|
||||
|
||||
NSMenuItem *item = [self getMenuItemForApp:app];
|
||||
|
@ -191,7 +191,7 @@ static NSString* const kMoreAppsMenuTitle = @"More Apps";
|
|||
}
|
||||
|
||||
// Set the pan position.
|
||||
if (volumeAndPan.pan != INT_MIN && [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 != INT_MIN && [subview isKindOfClass:[BGMAVM_PanSlider class]]) {
|
||||
if (pan != kAppPanNoValue && [subview isKindOfClass:[BGMAVM_PanSlider class]]) {
|
||||
[(BGMAVM_PanSlider*)subview setPanPosition:pan];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -109,7 +109,7 @@
|
|||
if (volumeAndPan.volume != -1) {
|
||||
[self setVolume:volumeAndPan.volume forAppWithProcessID:app.processIdentifier bundleID:app.bundleIdentifier];
|
||||
}
|
||||
if (volumeAndPan.pan != INT_MIN) {
|
||||
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 = INT_MIN
|
||||
.pan = kAppPanNoValue
|
||||
};
|
||||
|
||||
for (UInt32 i = 0; i < volumes.GetNumberItems(); i++) {
|
||||
|
|
|
@ -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 = INT_MIN
|
||||
.pan = kAppPanNoValue
|
||||
};
|
||||
[appVolumesController setVolumeAndPan:volume forApp:application];
|
||||
}
|
||||
|
|
|
@ -163,6 +163,7 @@ enum BGMDeviceAudibleState : SInt32
|
|||
#define kAppPanLeftRawValue -100
|
||||
#define kAppPanCenterRawValue 0
|
||||
#define kAppPanRightRawValue 100
|
||||
#define kAppPanNoValue INT_MIN
|
||||
|
||||
// kAudioDeviceCustomPropertyEnabledOutputControls indices
|
||||
enum
|
||||
|
|
Loading…
Reference in a new issue