ckb-next  v0.2.8 at branch master
ckb-next driver for corsair devices
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
media_mac.m File Reference
#import <AudioToolbox/AudioServices.h>
#import <Foundation/Foundation.h>
#include "media.h"
+ Include dependency graph for media_mac.m:

Go to the source code of this file.

Functions

muteState getMuteState ()
 
void disableAppNap ()
 

Function Documentation

void disableAppNap ( )

Definition at line 34 of file media_mac.m.

Referenced by main().

34  {
35  [[NSProcessInfo processInfo] beginActivityWithOptions:NSActivityUserInitiatedAllowingIdleSystemSleep reason:@"Keyboard animation"];
36 }

+ Here is the caller graph for this function:

muteState getMuteState ( )

Definition at line 5 of file media_mac.m.

References MUTED, UNKNOWN, and UNMUTED.

Referenced by KbPerf::applyIndicators().

5  {
6  // Get the system's default audio device
7  AudioObjectPropertyAddress propertyAddress = {
8  kAudioHardwarePropertyDefaultOutputDevice,
9  kAudioObjectPropertyScopeGlobal,
10  kAudioObjectPropertyElementMaster
11  };
12  AudioDeviceID deviceID = 0;
13  UInt32 dataSize = sizeof(deviceID);
14  if(AudioHardwareServiceGetPropertyData(kAudioObjectSystemObject, &propertyAddress, 0, NULL, &dataSize, &deviceID)
15  != kAudioHardwareNoError){
16  return UNKNOWN;
17  }
18  // Grab the mute property
19  AudioObjectPropertyAddress propertyAddress2 = {
20  kAudioDevicePropertyMute,
21  kAudioDevicePropertyScopeOutput,
22  kAudioObjectPropertyElementMaster
23  };
24  if(!AudioHardwareServiceHasProperty(deviceID, &propertyAddress2))
25  return UNKNOWN;
26  bool state = 0;
27  dataSize = sizeof(state);
28  if(AudioHardwareServiceGetPropertyData(deviceID, &propertyAddress2, 0, NULL, &dataSize, &state)
29  != kAudioHardwareNoError)
30  return UNKNOWN;
31  return state ? MUTED : UNMUTED;
32 }
Definition: media.h:20
Definition: media.h:21
Definition: media.h:22

+ Here is the caller graph for this function: